From 8c2258729320da5cbc11cce4ff0a1bf2bb6c45e2 Mon Sep 17 00:00:00 2001 From: Ishika RAY Date: Fri, 25 Oct 2024 14:50:03 +0530 Subject: [PATCH] uncommented other jobs in destroy --- .github/workflows/waf-on-ce-aws-destroy.yml | 297 ++++++++++---------- 1 file changed, 148 insertions(+), 149 deletions(-) diff --git a/.github/workflows/waf-on-ce-aws-destroy.yml b/.github/workflows/waf-on-ce-aws-destroy.yml index cca74e668..6a8a1fcd0 100644 --- a/.github/workflows/waf-on-ce-aws-destroy.yml +++ b/.github/workflows/waf-on-ce-aws-destroy.yml @@ -8,157 +8,157 @@ on: workflow_dispatch: jobs: - # volt_mesh_site_destroy: - # name: "F5 XC WAF" - # runs-on: ubuntu-latest - # defaults: - # run: - # working-directory: ./xc - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Setup Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} - - # - name: Setup Terraform Backend - # id: backend - # run: | - # cat > backend.tf << EOF - # terraform { - # cloud { - # organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" - # workspaces { - # name = "${{ secrets.TF_CLOUD_WORKSPACE_XC }}" - # } - # } - # } - # EOF - # echo "${{secrets.P12}}" | base64 -d > api.p12 - - # - name: Terraform Init - # id: init - # run: terraform init - - # - name: Terraform Validate - # id: validate - # run: terraform validate -no-color - - # - name: Terraform Plan - # id: plan - # if: github.event_name == 'pull_request' - # run: terraform plan -no-color -input=false - # continue-on-error: true - - # - uses: actions/github-script@v6 - # if: github.event_name == 'pull_request' - # env: - # PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` - # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` - #
Show Plan - # \`\`\`\n - # ${process.env.PLAN} - # \`\`\` - #
- # *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; - # github.rest.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: output - # }) - # - name: Terraform Plan Status - # if: steps.plan.outcome == 'failure' - # run: exit 1 - - # - name: Terraform Apply - # if: github.ref == 'refs/heads/destroy-waf-aws-ce' && github.event_name == 'push' - # run: terraform destroy -auto-approve -input=false - - # terraform_boutique: - # name: "Boutique app" - # runs-on: ubuntu-latest - # needs: [volt_mesh_site_destroy] - # defaults: - # run: - # working-directory: ./shared/boutique - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Setup Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} - - # - name: Setup Terraform Backend - # id: backend - # run: | - # cat > backend.tf << EOF - # terraform { - # cloud { - # organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" - # workspaces { - # name = "${{ secrets.TF_CLOUD_WORKSPACE_BOUTIQUE }}" - # } - # } - # } - # EOF - # - name: Terraform Init - # id: init - # run: terraform init - - # - name: Terraform Validate - # id: validate - # run: terraform validate -no-color - - # - name: Terraform Plan - # id: plan - # if: github.event_name == 'pull_request' - # run: terraform plan -no-color -input=false - # continue-on-error: true - - # - uses: actions/github-script@v6 - # if: github.event_name == 'pull_request' - # env: - # PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` - # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` - #
Show Plan - # \`\`\`\n - # ${process.env.PLAN} - # \`\`\` - #
- # *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; - # github.rest.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: output - # }) - # - name: Terraform Plan Status - # if: steps.plan.outcome == 'failure' - # run: exit 1 - - # - name: Terraform Apply - # if: github.ref == 'refs/heads/destroy-waf-aws-ce' && github.event_name == 'push' - # run: terraform destroy -auto-approve -input=false + volt_mesh_site_destroy: + name: "F5 XC WAF" + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./xc + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} + + - name: Setup Terraform Backend + id: backend + run: | + cat > backend.tf << EOF + terraform { + cloud { + organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" + workspaces { + name = "${{ secrets.TF_CLOUD_WORKSPACE_XC }}" + } + } + } + EOF + echo "${{secrets.P12}}" | base64 -d > api.p12 + + - name: Terraform Init + id: init + run: terraform init + + - name: Terraform Validate + id: validate + run: terraform validate -no-color + + - name: Terraform Plan + id: plan + if: github.event_name == 'pull_request' + run: terraform plan -no-color -input=false + continue-on-error: true + + - uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + env: + PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` +
Show Plan + \`\`\`\n + ${process.env.PLAN} + \`\`\` +
+ *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) + - name: Terraform Plan Status + if: steps.plan.outcome == 'failure' + run: exit 1 + + - name: Terraform Apply + if: github.ref == 'refs/heads/destroy-waf-aws-ce' && github.event_name == 'push' + run: terraform destroy -auto-approve -input=false + + terraform_boutique: + name: "Boutique app" + runs-on: ubuntu-latest + needs: [volt_mesh_site_destroy] + defaults: + run: + working-directory: ./shared/boutique + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} + + - name: Setup Terraform Backend + id: backend + run: | + cat > backend.tf << EOF + terraform { + cloud { + organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" + workspaces { + name = "${{ secrets.TF_CLOUD_WORKSPACE_BOUTIQUE }}" + } + } + } + EOF + - name: Terraform Init + id: init + run: terraform init + + - name: Terraform Validate + id: validate + run: terraform validate -no-color + + - name: Terraform Plan + id: plan + if: github.event_name == 'pull_request' + run: terraform plan -no-color -input=false + continue-on-error: true + + - uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + env: + PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` +
Show Plan + \`\`\`\n + ${process.env.PLAN} + \`\`\` +
+ *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) + - name: Terraform Plan Status + if: steps.plan.outcome == 'failure' + run: exit 1 + + - name: Terraform Apply + if: github.ref == 'refs/heads/destroy-waf-aws-ce' && github.event_name == 'push' + run: terraform destroy -auto-approve -input=false terraform_eks_destroy: name: "AWS EKS" runs-on: ubuntu-latest - # needs: [volt_mesh_site_destroy, terraform_boutique] + needs: [volt_mesh_site_destroy, terraform_boutique] defaults: run: working-directory: ./aws/eks-cluster @@ -231,8 +231,7 @@ jobs: destorying_infra: - # needs: [volt_mesh_site_destroy, terraform_boutique, terraform_eks_destroy] - needs: [terraform_eks_destroy] + needs: [volt_mesh_site_destroy, terraform_boutique, terraform_eks_destroy] name: "AWS Infra" runs-on: ubuntu-latest defaults: