Skip to content

Commit c89d6c8

Browse files
committed
Merge branch 'master' into CLOUDP-343190_tpf_delete_on_create_with_default
2 parents 468d6a0 + 21083a0 commit c89d6c8

File tree

6 files changed

+46
-43
lines changed

6 files changed

+46
-43
lines changed

.github/workflows/acceptance-tests-runner.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,33 @@ on:
1212
provider_version:
1313
description: 'Previous MongoDB Atlas Provider version to use in Migration tests, e.g. 1.14.0, empty for latest'
1414
type: string
15-
required: false
15+
required: true
1616
test_group:
1717
description: 'Test group to run, e.g. advanced_cluster, empty for all'
1818
type: string
19-
required: false
19+
required: true
2020
test_name:
2121
description: 'Name of the test to run, e.g. TestAccNetworkRSNetworkPeering_basicAzure, empty for all (this is regex & requires Test group to be specified as well)'
2222
type: string
23-
required: false
23+
required: true
2424
ref:
2525
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
2626
type: string
27-
required: false
27+
required: true
28+
# Boolean inputs are passed as null between workflows when false. For comparisons use my_input == true or my_input != true.
29+
# Don't use my_input or my_input == false.
2830
reduced_tests:
2931
description: 'If run only minimum tests for advanced_cluster, e.g. in PRs'
3032
type: boolean
31-
required: false
32-
default: false
33+
required: true
3334
use_sa:
3435
description: "Run tests using Service Account instead of API Keys"
3536
type: boolean
36-
required: false
37+
required: true
3738
send_notification:
3839
description: 'Send a Slack notification if stream tests fail.'
3940
type: boolean
40-
required: false
41+
required: true
4142
mongodb_atlas_org_id:
4243
type: string
4344
required: true
@@ -213,14 +214,14 @@ env:
213214
# If the name (regex) of the test is set, only that test is run.
214215
# Don't run migration tests if using Service Accounts because previous provider versions don't support SA yet.
215216
# Only Migration tests are run when a specific previous provider version is set.
216-
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
217+
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa == true && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
217218
MONGODB_ATLAS_BASE_URL: ${{ inputs.mongodb_atlas_base_url }}
218219
MONGODB_REALM_BASE_URL: ${{ inputs.mongodb_realm_base_url }}
219220
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
220-
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_public_key || '' }}
221-
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_private_key || '' }}
222-
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa && secrets.mongodb_atlas_client_id || '' }}
223-
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa && secrets.mongodb_atlas_client_secret || '' }}
221+
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_public_key || '' }}
222+
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_private_key || '' }}
223+
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa == true && secrets.mongodb_atlas_client_id || '' }}
224+
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa == true && secrets.mongodb_atlas_client_secret || '' }}
224225
MONGODB_ATLAS_PUBLIC_KEY_READ_ONLY: ${{ secrets.mongodb_atlas_public_key_read_only }}
225226
MONGODB_ATLAS_PRIVATE_KEY_READ_ONLY: ${{ secrets.mongodb_atlas_private_key_read_only }}
226227
MONGODB_ATLAS_GOV_PUBLIC_KEY: ${{ secrets.mongodb_atlas_gov_public_key }}
@@ -421,14 +422,14 @@ jobs:
421422
env:
422423
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
423424
HTTP_MOCKER_CAPTURE: 'true'
424-
ACCTEST_REGEX_RUN: ${{ inputs.reduced_tests && '^TestAccMockable' || env.ACCTEST_REGEX_RUN }}
425+
ACCTEST_REGEX_RUN: ${{ inputs.reduced_tests == true && '^TestAccMockable' || env.ACCTEST_REGEX_RUN }}
425426
ACCTEST_PACKAGES: ./internal/service/advancedcluster
426427
run: make testacc
427428

428429
advanced_cluster_tpf_mig_from_sdkv2:
429430
needs: [ change-detection, get-provider-version ]
430431
# Previous advanced_cluster versions don't support SA.
431-
if: ${{ inputs.reduced_tests == false && inputs.use_sa == false && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
432+
if: ${{ inputs.reduced_tests != true && inputs.use_sa != true && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
432433
runs-on: ubuntu-latest
433434
permissions: {}
434435
steps:
@@ -454,7 +455,7 @@ jobs:
454455
advanced_cluster_tpf_mig_from_tpf_preview:
455456
needs: [ change-detection, get-provider-version ]
456457
# Previous advanced_cluster versions don't support SA.
457-
if: ${{ inputs.reduced_tests == false && inputs.use_sa == false && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
458+
if: ${{ inputs.reduced_tests != true && inputs.use_sa != true && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
458459
runs-on: ubuntu-latest
459460
permissions: {}
460461
steps:
@@ -903,7 +904,7 @@ jobs:
903904
event_trigger:
904905
needs: [change-detection, get-provider-version]
905906
# Realm SDK doesn't support SA.
906-
if: ${{ inputs.use_sa == false && (needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger') }}
907+
if: ${{ inputs.use_sa != true && (needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger') }}
907908
runs-on: ubuntu-latest
908909
permissions: {}
909910
steps:
@@ -1212,10 +1213,10 @@ jobs:
12121213
terraform_wrapper: false
12131214
- name: Acceptance Tests
12141215
env:
1215-
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_rp_public_key || '' }}
1216-
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_rp_private_key || '' }}
1217-
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa && secrets.mongodb_atlas_rp_client_id || '' }}
1218-
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa && secrets.mongodb_atlas_rp_client_secret || '' }}
1216+
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_rp_public_key || '' }}
1217+
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_rp_private_key || '' }}
1218+
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa == true && secrets.mongodb_atlas_rp_client_id || '' }}
1219+
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa == true && secrets.mongodb_atlas_rp_client_secret || '' }}
12191220
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_rp_org_id }}
12201221
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
12211222
ACCTEST_PACKAGES: ./internal/service/resourcepolicy
@@ -1330,7 +1331,7 @@ jobs:
13301331

13311332
slack-notification-stream:
13321333
needs: [stream]
1333-
if: ${{ !cancelled() && needs.stream.result == 'failure' && !contains(github.event.inputs.send_notification, 'false') }}
1334+
if: ${{ !cancelled() && needs.stream.result == 'failure' && inputs.send_notification == true }}
13341335
runs-on: ubuntu-latest
13351336
permissions: {}
13361337
steps:

.github/workflows/acceptance-tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Acceptance Tests'
2-
run-name: "Acceptance Tests ${{ inputs.atlas_cloud_env }} ${{ inputs.test_group }} ${{ inputs.use_sa && 'sa' || 'pak'}}"
2+
run-name: "Acceptance Tests ${{ inputs.atlas_cloud_env }} ${{ inputs.test_group }} ${{ inputs.use_sa == true && 'sa' || 'pak'}}"
33

44
# Used for running acceptance tests, either triggered manually or called by other workflows.
55
on:
@@ -28,7 +28,7 @@ on:
2828
ref:
2929
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
3030
type: string
31-
required: false
31+
required: false
3232
use_sa:
3333
description: "Run tests using Service Account instead of API Keys"
3434
type: boolean
@@ -122,13 +122,12 @@ jobs:
122122
with:
123123
terraform_version: ${{ inputs.terraform_version || '1.13.x' }}
124124
provider_version: ${{ inputs.provider_version }}
125-
ref: ${{ inputs.ref }}
126125
test_group: ${{ inputs.test_group }}
127126
test_name: ${{ inputs.test_name }}
128-
reduced_tests: ${{ inputs.reduced_tests || false }}
129-
use_sa: ${{ inputs.use_sa || false }}
130-
send_notification: ${{ !contains(github.event.inputs.send_notification, 'false') }}
131-
aws_region_federation: ${{ vars.AWS_REGION_FEDERATION }}
127+
ref: ${{ inputs.ref }}
128+
reduced_tests: ${{ inputs.reduced_tests == true }}
129+
use_sa: ${{ inputs.use_sa == true }}
130+
send_notification: ${{ inputs.send_notification == true }}
132131
mongodb_atlas_org_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_ORG_ID_CLOUD_QA || vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV }}
133132
mongodb_atlas_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_BASE_URL_QA || vars.MONGODB_ATLAS_BASE_URL }}
134133
mongodb_realm_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_REALM_BASE_URL_QA || vars.MONGODB_REALM_BASE_URL }}
@@ -139,6 +138,7 @@ jobs:
139138
azure_service_principal_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.AZURE_SERVICE_PRINCIPAL_ID_QA || vars.AZURE_SERVICE_PRINCIPAL_ID }}
140139
azure_tenant_id: ${{ vars.AZURE_TENANT_ID }}
141140
aws_secret_name: ${{ inputs.atlas_cloud_env == 'qa' && vars.AWS_SECRET_NAME_QA || vars.AWS_SECRET_NAME }}
141+
aws_region_federation: ${{ vars.AWS_REGION_FEDERATION }}
142142
mongodb_atlas_federation_settings_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATION_SETTINGS_ID_QA || vars.MONGODB_ATLAS_FEDERATION_SETTINGS_ID }}
143143
mongodb_atlas_federated_okta_idp_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATED_OKTA_IDP_ID_QA || vars.MONGODB_ATLAS_FEDERATED_OKTA_IDP_ID }}
144144
mongodb_atlas_federated_idp_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATED_IDP_ID_QA || vars.MONGODB_ATLAS_FEDERATED_IDP_ID }}

.github/workflows/code-health.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,3 @@ jobs:
9393
uses: ./.github/workflows/acceptance-tests.yml
9494
with:
9595
reduced_tests: true
96-
use_sa: false
97-
send_notification: false

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ jobs:
125125
with:
126126
atlas_cloud_env: "qa"
127127
ref: ${{ inputs.version_number }}
128-
use_sa: false
129-
send_notification: false
130128

131129
release:
132130
runs-on: ubuntu-latest

.github/workflows/terraform-compatibility-matrix.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: "HashiCorp Terraform Compatibility Matrix"
22
run-name: 'HashiCorp Terraform Compatibility Matrix ${{ inputs.atlas_cloud_env }}'
33

44
on:
5-
schedule:
6-
- cron: "0 0 1 * *" # runs first day of the month at midnight UTC
5+
# Will be spread in multiple days in CLOUDP-353513, don't schedule at the moment.
6+
# schedule:
7+
# - cron: "0 0 1 * *" # runs first day of the month at midnight UTC
78
workflow_dispatch:
89
inputs:
910
atlas_cloud_env:

.github/workflows/test-suite.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: 'Test Suite'
77
# - Tuesday, Thursday, Saturday: SA against Dev environment
88
# Note: PAK refers to Programmatic API Key authentication (use_sa: false), SA refers to Service Account authentication (use_sa: true)
99
# It can also be run manually.
10-
# The 1st day of the month we run terraform-compatibility-matrix.yml and therefore, we skip the test-suite (see schedule->cron below).
10+
# Pending change in CLOUDP-353513: The 1st day of the month we run terraform-compatibility-matrix.yml and therefore, we skip the test-suite (see schedule->cron below).
1111
on:
1212
workflow_dispatch:
1313
inputs:
@@ -24,7 +24,7 @@ on:
2424
use_sa:
2525
description: "Run tests using Service Account instead of API Keys"
2626
type: boolean
27-
required: false
27+
default: false
2828
workflow_call:
2929
inputs:
3030
terraform_matrix:
@@ -41,7 +41,11 @@ on:
4141
send_notification:
4242
description: 'Send the Slack notification if any of the tests fail.'
4343
type: boolean
44-
default: true
44+
default: false
45+
use_sa:
46+
description: "Run tests using Service Account instead of API Keys"
47+
type: boolean
48+
default: false
4549
schedule:
4650
- cron: "0 0 2-31 * *" # workflow runs every day at midnight UTC except on the first day of the month
4751

@@ -59,7 +63,8 @@ jobs:
5963
terraform_matrix: ${{ inputs.terraform_matrix || env.schedule_terraform_matrix }}
6064
provider_matrix: ${{ inputs.provider_matrix || env.schedule_provider_matrix }}
6165
is_sun: ${{ steps.set_day.outputs.DAY == 'Sun' }}
62-
use_sa: ${{ (inputs.use_sa != null && inputs.use_sa) || (inputs.use_sa == null && (steps.set_day.outputs.DAY == 'Tue' || steps.set_day.outputs.DAY == 'Thu' || steps.set_day.outputs.DAY == 'Sat')) }}
66+
use_sa: ${{ inputs.use_sa == true || (github.event_name == 'schedule' && (steps.set_day.outputs.DAY == 'Tue' || steps.set_day.outputs.DAY == 'Thu' || steps.set_day.outputs.DAY == 'Sat')) }}
67+
send_notification: ${{ github.event_name == 'schedule' || inputs.send_notification == true }}
6368
steps:
6469
- name: set day
6570
id: set_day
@@ -86,9 +91,9 @@ jobs:
8691
terraform_version: ${{ matrix.terraform_version }}
8792
provider_version: ${{ matrix.provider_version }}
8893
atlas_cloud_env: ${{ inputs.atlas_cloud_env || needs.variables.outputs.is_sun == 'true' && 'qa' || '' }} # Run against QA on Sundays
94+
# Job output variables are always returned as strings.
8995
use_sa: ${{ needs.variables.outputs.use_sa == 'true' }}
90-
# This expression is true if unset (scheduled workflow) and works with boolean and string (GHA params are passed as strings)
91-
send_notification: ${{ !contains(github.event.inputs.send_notification, 'false') }}
96+
send_notification: ${{ needs.variables.outputs.send_notification == 'true' }}
9297

9398
clean-after:
9499
needs: tests
@@ -97,8 +102,8 @@ jobs:
97102
uses: ./.github/workflows/cleanup-test-env.yml
98103

99104
slack-notification:
100-
needs: [tests, clean-after]
101-
if: ${{ !cancelled() && needs.tests.result == 'failure' && !contains(github.event.inputs.send_notification, 'false') }}
105+
needs: [tests, variables, clean-after]
106+
if: ${{ !cancelled() && needs.tests.result == 'failure' && needs.variables.outputs.send_notification == 'true' }}
102107
runs-on: ubuntu-latest
103108
permissions: {}
104109
steps:

0 commit comments

Comments
 (0)