From 71c50d40edf0207a4dd38794f372c09a15c6f653 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:08:51 +0100 Subject: [PATCH 01/10] concurrency group --- .github/workflows/test-suite.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 3a8e30e0c6..f09da2d193 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 * * *" # workflow runs every day at midnight UTC +concurrency: + group: '${{ github.workflow }}' + cancel-in-progress: false + jobs: clean-before: From 8a085979692e22b4f12276ddfb750ebbf9fd1d19 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:23:56 +0100 Subject: [PATCH 02/10] add terraform version to asdf --- .tool-versions | 1 + 1 file changed, 1 insertion(+) diff --git a/.tool-versions b/.tool-versions index d70ca2f542..f087445c0b 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ golang 1.21.3 +terraform 1.6.6 From 74312c23b8987c3d217c1e8dd51af66dcf3f04ea Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:37:04 +0100 Subject: [PATCH 03/10] TEMPORARY - show terraform version --- .github/workflows/acceptance-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 37dbdc6401..470dbdc181 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -456,6 +456,7 @@ jobs: with: terraform_version: ${{ env.terraform_version }} terraform_wrapper: false + - run: terraform --version - name: Acceptance Tests env: MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV_NETWORK }} From 54e8cc23e88ad2cb849d9ea2dcd158dff71e1b84 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:55:10 +0100 Subject: [PATCH 04/10] Revert "TEMPORARY - show terraform version" This reverts commit 74312c23b8987c3d217c1e8dd51af66dcf3f04ea. --- .github/workflows/acceptance-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 470dbdc181..37dbdc6401 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -456,7 +456,6 @@ jobs: with: terraform_version: ${{ env.terraform_version }} terraform_wrapper: false - - run: terraform --version - name: Acceptance Tests env: MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV_NETWORK }} From 0d652dabc775e115299ed373cdc7fb42032bbfc1 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:55:42 +0100 Subject: [PATCH 05/10] define versions to run --- .github/workflows/test-suite.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index f09da2d193..cecbdfb3d1 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -2,13 +2,25 @@ name: 'Test Suite' on: workflow_dispatch: + inputs: + terraform_matrix: + description: 'Terraform matrix version (JSON array)' + default: '["1.6.x", "1.5.x", "1.4.x", "1.3.x", "1.2.x"]' + provider_matrix: + description: 'MongoDB Atlas Provider matrix version (JSON array)' + default: '["", "1.12.3"]' # "" for latest version + schedule: - cron: "0 0 * * *" # workflow runs every day at midnight UTC concurrency: group: '${{ github.workflow }}' cancel-in-progress: false - + +env: + schedule_terraform_matrix: '["1.6.x", "1.0.8"]' + schedule_provider_matrix: '["", "1.12.3]' # "" for latest version + jobs: clean-before: From 6c8960ca1ff8e1adf828ebdb2b11adddbe3e07d9 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Tue, 19 Dec 2023 00:08:12 +0100 Subject: [PATCH 06/10] versions job --- .github/workflows/test-suite.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index cecbdfb3d1..cbd8c55e76 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -12,30 +12,37 @@ on: schedule: - cron: "0 0 * * *" # workflow runs every day at midnight UTC - + concurrency: group: '${{ github.workflow }}' cancel-in-progress: false - -env: - schedule_terraform_matrix: '["1.6.x", "1.0.8"]' - schedule_provider_matrix: '["", "1.12.3]' # "" for latest version - + jobs: + versions: + env: + schedule_terraform_matrix: '["1.6.x", "1.0.8"]' + schedule_provider_matrix: '["", "1.12.3]' # "" for latest version + runs-on: ubuntu-latest + outputs: + terraform_matrix: ${{ inputs.terraform_matrix || vars.schedule_terraform_matrix }} + provider_matrix: ${{ inputs.provider_matrix || vars.schedule_provider_matrix }} + steps: + - if: false + run: echo jobs need steps clean-before: secrets: inherit uses: ./.github/workflows/cleanup-test-env.yml mig-tests: - needs: clean-before + needs: [clean-before, versions] if: ${{ !cancelled() }} strategy: max-parallel: 1 fail-fast: false matrix: - terraform_version: ['', '1.0.8'] # '' for latest version - provider_version: ['', '1.11.1'] # '' for latest version + terraform_version: ${{ fromJSON(needs.versions.outputs.terraform_matrix) }} + provider_version: ${{ fromJSON(needs.versions.outputs.provider_matrix) }} name: mig-tests-${{ matrix.terraform_version || 'latest' }}-${{ matrix.provider_version || 'latest' }} secrets: inherit uses: ./.github/workflows/migration-tests.yml @@ -44,13 +51,13 @@ jobs: provider_version: ${{ matrix.provider_version }} acc-tests: - needs: mig-tests + needs: [mig-tests, versions] if: ${{ !cancelled() }} strategy: max-parallel: 1 fail-fast: false matrix: - terraform_version: ['', '1.0.8'] # '' for latest version + terraform_version: ${{ fromJSON(needs.versions.outputs.terraform_matrix) }} name: acc-tests-${{ matrix.terraform_version || 'latest' }} secrets: inherit uses: ./.github/workflows/acceptance-tests.yml From 41814797f57e0908d9028d3b5a11a6e47eed042d Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Tue, 19 Dec 2023 00:35:00 +0100 Subject: [PATCH 07/10] typo --- .github/workflows/test-suite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index cbd8c55e76..d8174734a4 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -4,10 +4,10 @@ on: workflow_dispatch: inputs: terraform_matrix: - description: 'Terraform matrix version (JSON array)' + description: 'Terraform version matrix (JSON array)' default: '["1.6.x", "1.5.x", "1.4.x", "1.3.x", "1.2.x"]' provider_matrix: - description: 'MongoDB Atlas Provider matrix version (JSON array)' + description: 'MongoDB Atlas Provider version matrix (JSON array)' default: '["", "1.12.3"]' # "" for latest version schedule: From 5f82991476ac7f100139e952e4fbb05e7ed00374 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Tue, 19 Dec 2023 09:00:34 +0100 Subject: [PATCH 08/10] TEMPORARY - fail linter --- internal/testutil/acc/skip.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/testutil/acc/skip.go b/internal/testutil/acc/skip.go index 8c2c1e9708..24dc1c7634 100644 --- a/internal/testutil/acc/skip.go +++ b/internal/testutil/acc/skip.go @@ -16,7 +16,6 @@ func SkipTest(tb testing.TB) { // SkipIfTFAccNotDefined is added to acceptance tests were you do not want any preparation code executed if the resulting steps will not run. // Keep in mind that if TF_ACC is empty, go still runs acceptance tests but terraform-plugin-testing does not execute the resulting steps. func SkipIfTFAccNotDefined(tb testing.TB) { - tb.Helper() if strings.EqualFold(os.Getenv("TF_ACC"), "") { tb.Skip() } From bd7242461deaafe109e7f34d541c2112edc55b73 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Tue, 19 Dec 2023 09:07:42 +0100 Subject: [PATCH 09/10] Revert "TEMPORARY - fail linter" This reverts commit 5f82991476ac7f100139e952e4fbb05e7ed00374. --- internal/testutil/acc/skip.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/testutil/acc/skip.go b/internal/testutil/acc/skip.go index 24dc1c7634..8c2c1e9708 100644 --- a/internal/testutil/acc/skip.go +++ b/internal/testutil/acc/skip.go @@ -16,6 +16,7 @@ func SkipTest(tb testing.TB) { // SkipIfTFAccNotDefined is added to acceptance tests were you do not want any preparation code executed if the resulting steps will not run. // Keep in mind that if TF_ACC is empty, go still runs acceptance tests but terraform-plugin-testing does not execute the resulting steps. func SkipIfTFAccNotDefined(tb testing.TB) { + tb.Helper() if strings.EqualFold(os.Getenv("TF_ACC"), "") { tb.Skip() } From d6395edcf5872a32696e46846b77a5968bed1953 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:47:38 +0100 Subject: [PATCH 10/10] Update .github/workflows/test-suite.yml Co-authored-by: Agustin Bettati --- .github/workflows/test-suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index d8174734a4..c1fd8b0b6a 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -7,7 +7,7 @@ on: description: 'Terraform version matrix (JSON array)' default: '["1.6.x", "1.5.x", "1.4.x", "1.3.x", "1.2.x"]' provider_matrix: - description: 'MongoDB Atlas Provider version matrix (JSON array)' + description: 'MongoDB Atlas Provider version matrix for running migration tests (JSON array)' default: '["", "1.12.3"]' # "" for latest version schedule: