From d7b5f3ac65ffd39d201a09972eb5e0335c8200e3 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 18:41:14 -0400 Subject: [PATCH 01/26] testing --- actions/deployTerraform/action.yml | 17 ++++++++++++++++- deploy/test/test.go | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 deploy/test/test.go diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index a8e032b..c2feb7d 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -172,4 +172,19 @@ runs: shell: bash working-directory: ./deploy/terraform if: github.ref == 'refs/heads/master' && github.event_name == 'push' - run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false \ No newline at end of file + run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false + + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: "1.14.1" + + - name: Run Tests + working-directory: ./deploy/test + run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml + + - uses: actions/upload-artifact@v3 + if: (success() || failure()) + with: + name: Test results + path: .deploy/test/*.xml \ No newline at end of file diff --git a/deploy/test/test.go b/deploy/test/test.go new file mode 100644 index 0000000..4e321ed --- /dev/null +++ b/deploy/test/test.go @@ -0,0 +1,14 @@ +package terraform + +import ( + "testing" + + "github.com/gruntwork-io/terratest/modules/azure" + "github.com/gruntwork-io/terratest/modules/terraform" + "github.com/stretchr/testify/assert" +) + +func Test_EndToEnd(t *testing.T) { + t.Parallel() + assert.True(1,1) +} \ No newline at end of file From a917e6c3ea98a1546d030e8c23044a28692aafa2 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 18:45:04 -0400 Subject: [PATCH 02/26] added shell --- actions/deployTerraform/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index c2feb7d..086aaf0 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -181,6 +181,7 @@ runs: - name: Run Tests working-directory: ./deploy/test + shell: bash run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml - uses: actions/upload-artifact@v3 From 81508c94f2d475284fa0f3e36b76157ecf47bb9b Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 18:52:03 -0400 Subject: [PATCH 03/26] fix indent --- actions/deployTerraform/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 086aaf0..f85483d 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -185,7 +185,7 @@ runs: run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml - uses: actions/upload-artifact@v3 - if: (success() || failure()) - with: - name: Test results - path: .deploy/test/*.xml \ No newline at end of file + if: always() + with: + name: Test results + path: .deploy/test/*.xml \ No newline at end of file From 42d69658bc2df6bf5b3eb1fa20852709e4db5ec5 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 19:11:18 -0400 Subject: [PATCH 04/26] testing --- actions/deployTerraform/action.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index f85483d..7966eda 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -174,18 +174,18 @@ runs: if: github.ref == 'refs/heads/master' && github.event_name == 'push' run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: "1.14.1" + # - name: Install Go + # uses: actions/setup-go@v3 + # with: + # go-version: "1.14.1" - - name: Run Tests - working-directory: ./deploy/test - shell: bash - run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml + # - name: Run Tests + # working-directory: ./deploy/test + # shell: bash + # run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml - - uses: actions/upload-artifact@v3 - if: always() - with: - name: Test results - path: .deploy/test/*.xml \ No newline at end of file + # - uses: actions/upload-artifact@v3 + # if: always() + # with: + # name: Test results + # path: .deploy/test/*.xml \ No newline at end of file From 73d65fbf3e15e0e13394c9ff2ad32fe10022a741 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 19:17:18 -0400 Subject: [PATCH 05/26] testing --- actions/deployTerraform/action.yml | 128 ++++++++++++++--------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 7966eda..5786b9c 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -107,11 +107,11 @@ runs: # id: fmt # run: terraform fmt -check - - name: Terraform Init - shell: bash - working-directory: ./deploy/terraform - id: init - run: terraform init --backend-config=backend.tfvars + # - name: Terraform Init + # shell: bash + # working-directory: ./deploy/terraform + # id: init + # run: terraform init --backend-config=backend.tfvars # - name: Composite Action 1 # uses: ./actions/greet @@ -119,73 +119,73 @@ runs: # with: # who-to-greet: 'Mohamed' - - name: Terraform Validate - shell: bash - working-directory: ./deploy/terraform - id: validate - run: terraform validate -no-color + # - name: Terraform Validate + # shell: bash + # working-directory: ./deploy/terraform + # id: validate + # run: terraform validate -no-color - - name: Terraform Plan - shell: bash - working-directory: ./deploy/terraform - id: plan - if: github.event_name == 'pull_request' - run: terraform plan --var "environment=${{inputs.ENVIRONMENT}}" -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: ${{ inputs.GITHUB_TOKEN }} - script: | - const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` - #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` - #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` + # - name: Terraform Plan + # shell: bash + # working-directory: ./deploy/terraform + # id: plan + # if: github.event_name == 'pull_request' + # run: terraform plan --var "environment=${{inputs.ENVIRONMENT}}" -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: ${{ inputs.GITHUB_TOKEN }} + # script: | + # const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` + # #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` + # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` -
Show Plan + #
Show Plan - \`\`\`\n - ${process.env.PLAN} - \`\`\` + # \`\`\`\n + # ${process.env.PLAN} + # \`\`\` -
+ #
- *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + # *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 - }) + # github.rest.issues.createComment({ + # issue_number: context.issue.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: output + # }) - - name: Terraform Plan Status - shell: bash - working-directory: ./deploy/terraform - if: steps.plan.outcome == 'failure' - run: exit 1 + # - name: Terraform Plan Status + # shell: bash + # working-directory: ./deploy/terraform + # if: steps.plan.outcome == 'failure' + # run: exit 1 - - name: Terraform Apply - shell: bash - working-directory: ./deploy/terraform - if: github.ref == 'refs/heads/master' && github.event_name == 'push' - run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false + # - name: Terraform Apply + # shell: bash + # working-directory: ./deploy/terraform + # if: github.ref == 'refs/heads/master' && github.event_name == 'push' + # run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false - # - name: Install Go - # uses: actions/setup-go@v3 - # with: - # go-version: "1.14.1" + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: "1.14.1" - # - name: Run Tests - # working-directory: ./deploy/test - # shell: bash - # run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml + - name: Run Tests + working-directory: ./deploy/test + shell: bash + run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml - # - uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: Test results - # path: .deploy/test/*.xml \ No newline at end of file + - uses: actions/upload-artifact@v3 + if: always() + with: + name: Test results + path: .deploy/test/*.xml \ No newline at end of file From b916fa8b19c2ea229deca4dd531a58dc57eb86ef Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 19:28:03 -0400 Subject: [PATCH 06/26] test --- actions/deployTerraform/action.yml | 2 +- deploy/test/test.go | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 5786b9c..dac29d4 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -182,7 +182,7 @@ runs: - name: Run Tests working-directory: ./deploy/test shell: bash - run: go test -v -timeout 8000s ./test.go 2>&1 | go-junit-report >test.xml + run: go test -v -timeout 8000s test.go 2>&1 | go-junit-report >test.xml - uses: actions/upload-artifact@v3 if: always() diff --git a/deploy/test/test.go b/deploy/test/test.go index 4e321ed..13464d0 100644 --- a/deploy/test/test.go +++ b/deploy/test/test.go @@ -1,14 +1,10 @@ -package terraform +package main import ( "testing" - - "github.com/gruntwork-io/terratest/modules/azure" - "github.com/gruntwork-io/terratest/modules/terraform" "github.com/stretchr/testify/assert" ) -func Test_EndToEnd(t *testing.T) { - t.Parallel() - assert.True(1,1) +func Test(t *testing.T) { + assert.True(t,True) } \ No newline at end of file From 4f37ca66f9705de655383d83757f60b2f1f01d88 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 19:37:29 -0400 Subject: [PATCH 07/26] install go-junit-report --- actions/deployTerraform/action.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index dac29d4..9fffdeb 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -177,15 +177,17 @@ runs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: "1.14.1" + go-version: "1.18.1" - name: Run Tests working-directory: ./deploy/test shell: bash - run: go test -v -timeout 8000s test.go 2>&1 | go-junit-report >test.xml + run: | + go install github.com/jstemmer/go-junit-report@latest + go test -v -timeout 8000s test.go 2>&1 | go-junit-report > test.xml - uses: actions/upload-artifact@v3 - if: always() + if: success() || failure() with: name: Test results path: .deploy/test/*.xml \ No newline at end of file From 503b3bd55bd6bdb16e4837920cae913c0095434c Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 28 Sep 2022 20:01:31 -0400 Subject: [PATCH 08/26] test --- actions/deployTerraform/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 9fffdeb..e4fbe4d 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -183,8 +183,8 @@ runs: working-directory: ./deploy/test shell: bash run: | - go install github.com/jstemmer/go-junit-report@latest - go test -v -timeout 8000s test.go 2>&1 | go-junit-report > test.xml + go install github.com/jstemmer/go-junit-report@latest + go test -v test.go - uses: actions/upload-artifact@v3 if: success() || failure() From 8e8b6df7a1740e573fc4c72cf80c2c06982d5f9c Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 13:59:35 -0400 Subject: [PATCH 09/26] Add go init method --- actions/deployTerraform/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index e4fbe4d..e1c2f33 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -184,10 +184,13 @@ runs: shell: bash run: | go install github.com/jstemmer/go-junit-report@latest + go mod init go test -v test.go - uses: actions/upload-artifact@v3 if: success() || failure() with: name: Test results - path: .deploy/test/*.xml \ No newline at end of file + path: .deploy/test/*.xml + + # 2>&1 | go-junit-report > test.xml \ No newline at end of file From deeed494ee55da0333a8e191368cc2caf8f29f18 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 14:27:35 -0400 Subject: [PATCH 10/26] Test --- actions/deployTerraform/action.yml | 10 +++++++--- deploy/test/{ => terraform}/test.go | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) rename deploy/test/{ => terraform}/test.go (85%) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index e1c2f33..2e74785 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -179,13 +179,17 @@ runs: with: go-version: "1.18.1" - - name: Run Tests + - name: Init Go working-directory: ./deploy/test shell: bash run: | + go mod init github.com/nexilus18/SampleRepo1/test go install github.com/jstemmer/go-junit-report@latest - go mod init - go test -v test.go + + - name: Run Tests + working-directory: ./deploy/test/terraform + shell: bash + run: go test -v test.go - uses: actions/upload-artifact@v3 if: success() || failure() diff --git a/deploy/test/test.go b/deploy/test/terraform/test.go similarity index 85% rename from deploy/test/test.go rename to deploy/test/terraform/test.go index 13464d0..93bb930 100644 --- a/deploy/test/test.go +++ b/deploy/test/terraform/test.go @@ -1,4 +1,4 @@ -package main +package terraform import ( "testing" From 12a257ab6b29e0548f48e34329aa241663f9d821 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 14:31:07 -0400 Subject: [PATCH 11/26] Test --- actions/deployTerraform/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 2e74785..1a60657 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -189,7 +189,9 @@ runs: - name: Run Tests working-directory: ./deploy/test/terraform shell: bash - run: go test -v test.go + run: | + go get github.com/stretchr/testify/assert + go test -v test.go - uses: actions/upload-artifact@v3 if: success() || failure() From 652cd75748b6e38da01424e8cd7ddacd15225169 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 14:41:52 -0400 Subject: [PATCH 12/26] Test --- deploy/test/terraform/test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/test/terraform/test.go b/deploy/test/terraform/test.go index 93bb930..b59ec6e 100644 --- a/deploy/test/terraform/test.go +++ b/deploy/test/terraform/test.go @@ -6,5 +6,5 @@ import ( ) func Test(t *testing.T) { - assert.True(t,True) + assert.Equal(1,1) } \ No newline at end of file From 4f5b4e0ba6873169587a2b3db31f993920766eca Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 14:44:37 -0400 Subject: [PATCH 13/26] Testing --- deploy/test/terraform/test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/test/terraform/test.go b/deploy/test/terraform/test.go index b59ec6e..613209e 100644 --- a/deploy/test/terraform/test.go +++ b/deploy/test/terraform/test.go @@ -6,5 +6,8 @@ import ( ) func Test(t *testing.T) { - assert.Equal(1,1) + var a string = "Hello" + var b string = "Hello" + + assert.Equal(t, a, b, "The two words should be the same.") } \ No newline at end of file From aeb1d66151186a7b4ec9d7b06986dea2c0906aa6 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 14:46:24 -0400 Subject: [PATCH 14/26] change working directory --- actions/deployTerraform/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 1a60657..4583c08 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -197,6 +197,6 @@ runs: if: success() || failure() with: name: Test results - path: .deploy/test/*.xml + path: .deploy/test/terraform/*.xml # 2>&1 | go-junit-report > test.xml \ No newline at end of file From b45de126a9449d5999c6597aedce1bc74600d225 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 15:05:18 -0400 Subject: [PATCH 15/26] upload artifact --- actions/deployTerraform/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 4583c08..0159ac8 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -191,7 +191,7 @@ runs: shell: bash run: | go get github.com/stretchr/testify/assert - go test -v test.go + go test -v test.go 2>&1 | go-junit-report > test.xml - uses: actions/upload-artifact@v3 if: success() || failure() From 14acbcc584768ae9689fafb1c9653874b3ee8bdb Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Thu, 29 Sep 2022 15:09:48 -0400 Subject: [PATCH 16/26] Testing --- actions/deployTerraform/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 0159ac8..0f2d3b2 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -197,6 +197,6 @@ runs: if: success() || failure() with: name: Test results - path: .deploy/test/terraform/*.xml + path: ./deploy/test/terraform/*.xml # 2>&1 | go-junit-report > test.xml \ No newline at end of file From 364b526db0170f55e54f263f2bce7ec9cf99302e Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 09:53:51 -0400 Subject: [PATCH 17/26] Uncomment code --- actions/deployTerraform/action.yml | 106 ++++++++++++++--------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 0f2d3b2..fd4bc31 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -107,11 +107,11 @@ runs: # id: fmt # run: terraform fmt -check - # - name: Terraform Init - # shell: bash - # working-directory: ./deploy/terraform - # id: init - # run: terraform init --backend-config=backend.tfvars + - name: Terraform Init + shell: bash + working-directory: ./deploy/terraform + id: init + run: terraform init --backend-config=backend.tfvars # - name: Composite Action 1 # uses: ./actions/greet @@ -119,60 +119,60 @@ runs: # with: # who-to-greet: 'Mohamed' - # - name: Terraform Validate - # shell: bash - # working-directory: ./deploy/terraform - # id: validate - # run: terraform validate -no-color + - name: Terraform Validate + shell: bash + working-directory: ./deploy/terraform + id: validate + run: terraform validate -no-color - # - name: Terraform Plan - # shell: bash - # working-directory: ./deploy/terraform - # id: plan - # if: github.event_name == 'pull_request' - # run: terraform plan --var "environment=${{inputs.ENVIRONMENT}}" -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: ${{ inputs.GITHUB_TOKEN }} - # script: | - # const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` - # #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` - # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` + - name: Terraform Plan + shell: bash + working-directory: ./deploy/terraform + id: plan + if: github.event_name == 'pull_request' + run: terraform plan --var "environment=${{inputs.ENVIRONMENT}}" -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: ${{ inputs.GITHUB_TOKEN }} + script: | + const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` + #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` - #
Show Plan +
Show Plan - # \`\`\`\n - # ${process.env.PLAN} - # \`\`\` + \`\`\`\n + ${process.env.PLAN} + \`\`\` - #
+
- # *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + *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 - # }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) - # - name: Terraform Plan Status - # shell: bash - # working-directory: ./deploy/terraform - # if: steps.plan.outcome == 'failure' - # run: exit 1 + - name: Terraform Plan Status + shell: bash + working-directory: ./deploy/terraform + if: steps.plan.outcome == 'failure' + run: exit 1 - # - name: Terraform Apply - # shell: bash - # working-directory: ./deploy/terraform - # if: github.ref == 'refs/heads/master' && github.event_name == 'push' - # run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false + - name: Terraform Apply + shell: bash + working-directory: ./deploy/terraform + if: github.ref == 'refs/heads/master' && github.event_name == 'push' + run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false - name: Install Go uses: actions/setup-go@v3 @@ -197,6 +197,4 @@ runs: if: success() || failure() with: name: Test results - path: ./deploy/test/terraform/*.xml - - # 2>&1 | go-junit-report > test.xml \ No newline at end of file + path: ./deploy/test/terraform/*.xml \ No newline at end of file From cca4dab55c296c22c835d00eb6d84a6ce0445207 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 10:47:58 -0400 Subject: [PATCH 18/26] Test --- actions/deployTerraform/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index fd4bc31..a5fbdde 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -174,6 +174,7 @@ runs: if: github.ref == 'refs/heads/master' && github.event_name == 'push' run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false + - name: Install Go uses: actions/setup-go@v3 with: From b48ad98582348b47987b305e455a257e971f301b Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 10:51:06 -0400 Subject: [PATCH 19/26] test --- actions/deployTerraform/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index a5fbdde..fd4bc31 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -174,7 +174,6 @@ runs: if: github.ref == 'refs/heads/master' && github.event_name == 'push' run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false - - name: Install Go uses: actions/setup-go@v3 with: From 7deb4d90882a5fa297cb933e96744c467607de1e Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 10:53:02 -0400 Subject: [PATCH 20/26] testing --- actions/deployTerraform/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index fd4bc31..1da5a1b 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -193,8 +193,8 @@ runs: go get github.com/stretchr/testify/assert go test -v test.go 2>&1 | go-junit-report > test.xml - - uses: actions/upload-artifact@v3 - if: success() || failure() - with: - name: Test results - path: ./deploy/test/terraform/*.xml \ No newline at end of file + # - uses: actions/upload-artifact@v3 + # if: success() || failure() + # with: + # name: Test results + # path: ./deploy/test/terraform/*.xml \ No newline at end of file From 80b0289785250015031c624de7b3fb5811b1a59d Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 11:36:06 -0400 Subject: [PATCH 21/26] Testing --- .github/workflows/terraform.yml | 76 ++++++++++++++++----------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 8eaebb8..ed659d0 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -34,44 +34,44 @@ jobs: TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} ENVIRONMENT: dev - test-env: - name: "Test Enviornment" - runs-on: ubuntu-latest - needs: [dev-env] - environment: test - defaults: - run: - working-directory: ./deploy/terraform - steps: - - name: Checkout - uses: actions/checkout@v3 + # test-env: + # name: "Test Enviornment" + # runs-on: ubuntu-latest + # needs: [dev-env] + # environment: test + # defaults: + # run: + # working-directory: ./deploy/terraform + # steps: + # - name: Checkout + # uses: actions/checkout@v3 - - name: Deploy Terraform Enviornment - uses: ./actions/deployTerraform - # uses: mhassaninmsft/SampleRepo1@v1 - with: - who-to-greet: 'Mohamed' - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} - ENVIRONMENT: test + # - name: Deploy Terraform Enviornment + # uses: ./actions/deployTerraform + # # uses: mhassaninmsft/SampleRepo1@v1 + # with: + # who-to-greet: 'Mohamed' + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} + # ENVIRONMENT: test - prod-env: - name: "Prod Enviornment" - runs-on: ubuntu-latest - needs: [test-env] - environment: prod - defaults: - run: - working-directory: ./deploy/terraform - steps: - - name: Checkout - uses: actions/checkout@v3 + # prod-env: + # name: "Prod Enviornment" + # runs-on: ubuntu-latest + # needs: [test-env] + # environment: prod + # defaults: + # run: + # working-directory: ./deploy/terraform + # steps: + # - name: Checkout + # uses: actions/checkout@v3 - - name: Deploy Terraform Enviornment - uses: ./actions/deployTerraform - # uses: mhassaninmsft/SampleRepo1@v1 - with: - who-to-greet: 'Mohamed' - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} - ENVIRONMENT: prod \ No newline at end of file + # - name: Deploy Terraform Enviornment + # uses: ./actions/deployTerraform + # # uses: mhassaninmsft/SampleRepo1@v1 + # with: + # who-to-greet: 'Mohamed' + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} + # ENVIRONMENT: prod \ No newline at end of file From 6b7c11ab3dc246443bd10b2b7d4817f73cd45812 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 11:59:05 -0400 Subject: [PATCH 22/26] test --- actions/deployTerraform/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 1da5a1b..fd4bc31 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -193,8 +193,8 @@ runs: go get github.com/stretchr/testify/assert go test -v test.go 2>&1 | go-junit-report > test.xml - # - uses: actions/upload-artifact@v3 - # if: success() || failure() - # with: - # name: Test results - # path: ./deploy/test/terraform/*.xml \ No newline at end of file + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: Test results + path: ./deploy/test/terraform/*.xml \ No newline at end of file From 308dc2020ff729b1c32a5001fb6ffa40b1e0f36f Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 12:09:36 -0400 Subject: [PATCH 23/26] Testing --- .github/workflows/terraform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index ed659d0..c93942d 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -3,7 +3,7 @@ name: "Terraform" on: push: branches: - - master + - nexilus/e2e-test pull_request: branches: - master From 527a847befca5f74acfa85de7b69f0295376f979 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 12:26:07 -0400 Subject: [PATCH 24/26] Testing --- .github/workflows/terraform.yml | 78 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index c93942d..8eaebb8 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -3,7 +3,7 @@ name: "Terraform" on: push: branches: - - nexilus/e2e-test + - master pull_request: branches: - master @@ -34,44 +34,44 @@ jobs: TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} ENVIRONMENT: dev - # test-env: - # name: "Test Enviornment" - # runs-on: ubuntu-latest - # needs: [dev-env] - # environment: test - # defaults: - # run: - # working-directory: ./deploy/terraform - # steps: - # - name: Checkout - # uses: actions/checkout@v3 + test-env: + name: "Test Enviornment" + runs-on: ubuntu-latest + needs: [dev-env] + environment: test + defaults: + run: + working-directory: ./deploy/terraform + steps: + - name: Checkout + uses: actions/checkout@v3 - # - name: Deploy Terraform Enviornment - # uses: ./actions/deployTerraform - # # uses: mhassaninmsft/SampleRepo1@v1 - # with: - # who-to-greet: 'Mohamed' - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} - # ENVIRONMENT: test + - name: Deploy Terraform Enviornment + uses: ./actions/deployTerraform + # uses: mhassaninmsft/SampleRepo1@v1 + with: + who-to-greet: 'Mohamed' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} + ENVIRONMENT: test - # prod-env: - # name: "Prod Enviornment" - # runs-on: ubuntu-latest - # needs: [test-env] - # environment: prod - # defaults: - # run: - # working-directory: ./deploy/terraform - # steps: - # - name: Checkout - # uses: actions/checkout@v3 + prod-env: + name: "Prod Enviornment" + runs-on: ubuntu-latest + needs: [test-env] + environment: prod + defaults: + run: + working-directory: ./deploy/terraform + steps: + - name: Checkout + uses: actions/checkout@v3 - # - name: Deploy Terraform Enviornment - # uses: ./actions/deployTerraform - # # uses: mhassaninmsft/SampleRepo1@v1 - # with: - # who-to-greet: 'Mohamed' - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} - # ENVIRONMENT: prod \ No newline at end of file + - name: Deploy Terraform Enviornment + uses: ./actions/deployTerraform + # uses: mhassaninmsft/SampleRepo1@v1 + with: + who-to-greet: 'Mohamed' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TFVARS_CONTENT: ${{ secrets.BACKEND_TFVARS }} + ENVIRONMENT: prod \ No newline at end of file From a37366c8006fb84961f3538c2d57827158206ae7 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 15:52:10 -0400 Subject: [PATCH 25/26] Test --- actions/deployTerraform/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index fd4bc31..1da5a1b 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -193,8 +193,8 @@ runs: go get github.com/stretchr/testify/assert go test -v test.go 2>&1 | go-junit-report > test.xml - - uses: actions/upload-artifact@v3 - if: success() || failure() - with: - name: Test results - path: ./deploy/test/terraform/*.xml \ No newline at end of file + # - uses: actions/upload-artifact@v3 + # if: success() || failure() + # with: + # name: Test results + # path: ./deploy/test/terraform/*.xml \ No newline at end of file From 38edb59b0fc77a1ef984c234c386f40306344095 Mon Sep 17 00:00:00 2001 From: Neyissa Exilus Date: Wed, 5 Oct 2022 15:57:29 -0400 Subject: [PATCH 26/26] upload test results --- actions/deployTerraform/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 1da5a1b..fd4bc31 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -193,8 +193,8 @@ runs: go get github.com/stretchr/testify/assert go test -v test.go 2>&1 | go-junit-report > test.xml - # - uses: actions/upload-artifact@v3 - # if: success() || failure() - # with: - # name: Test results - # path: ./deploy/test/terraform/*.xml \ No newline at end of file + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: Test results + path: ./deploy/test/terraform/*.xml \ No newline at end of file