-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Updates migration tests to run separately and use last released version of provider for plan checks #1565
Changes from all commits
30dbcd7
5747e2e
4dd4e1a
316afdf
b8a83f9
89333ab
08c1f51
857de3e
11cf6fe
599b74b
b3a07f7
0ea6a6a
4b1e27a
a5fb8fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: 'Migration Tests' | ||
|
||
on: | ||
workflow_dispatch: {} | ||
workflow_call: # workflow runs after code-health | ||
inputs: | ||
parent-event-name: | ||
required: true | ||
type: string | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
set-output: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lantoli tried with another step: https://github.com/mongodb/terraform-provider-mongodbatlas/pull/1565/files#diff-9e63d3ed50a83cef3c77bb7447f2858374bc51e6dd94ac7f65b3420205c70ea6 Let me know if this approach makes sense, not sure if this is possible with a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's great, thanks! |
||
runs-on: ubuntu-latest | ||
outputs: | ||
condition: ${{ steps.set-condition.outputs.condition }} | ||
steps: | ||
- name: Set Event Condition | ||
id: set-condition | ||
run: | | ||
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ] || [ "${{ github.event_name }}" = "schedule" ] || [ "${{ inputs.parent-event-name }}" = "release" ] || [ "${{ github.event.label.name }}" = "run-testacc-migration" ]; then | ||
echo "::set-output name=condition::true" | ||
else | ||
echo "::set-output name=condition::false" | ||
fi | ||
change-detection: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
repository-projects: read | ||
outputs: | ||
project: ${{ steps.filter.outputs.project }} | ||
config: ${{ steps.filter.outputs.config }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
if: ${{ needs.set-output.outputs.condition == 'true' }} | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
project: | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_project_ip_access_list*.go' | ||
- 'mongodbatlas/fw_resource_mongodbatlas_project_ip_access_list*.go' | ||
config: | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_alert_configuration*.go' | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_database_user*.go' | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_atlas_user*.go' | ||
- 'mongodbatlas/fw_resource_mongodbatlas_alert_configuration*.go' | ||
- 'mongodbatlas/fw_resource_mongodbatlas_database_user*.go' | ||
|
||
project: | ||
needs: [ change-detection ] | ||
if: ${{ needs.set-output.outputs.condition == 'true' || needs.change-detection.outputs.project == 'true' || github.event.label.name == 'run-testacc-project-migration'}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get Last Release | ||
id: get_last_release | ||
run: | | ||
LAST_RELEASE=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/terraform-provider-mongodbatlas/releases/latest | jq -r '.tag_name | ltrimstr("v")') | ||
echo "Last release: $LAST_RELEASE" | ||
echo "MONGODB_ATLAS_LAST_VERSION=$LAST_RELEASE" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Migration Tests | ||
env: | ||
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV }} | ||
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_CLOUD_DEV }} | ||
MONGODB_ATLAS_ORG_ID: ${{ vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV }} | ||
MONGODB_ATLAS_BASE_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }} | ||
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ vars.MONGODB_ATLAS_PROJECT_OWNER_ID }} | ||
MONGODB_ATLAS_API_KEYS_IDS: ${{ vars.MONGODB_ATLAS_API_KEYS_IDS }} | ||
MONGODB_ATLAS_TEAMS_IDS: ${{ vars.MONGODB_ATLAS_TEAMS_IDS }} | ||
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ vars.SKIP_TEST_EXTERNAL_CREDENTIALS }} | ||
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }} | ||
TF_LOG: ${{ vars.LOG_LEVEL }} | ||
TF_ACC: 1 | ||
PARALLEL_GO_TEST: 20 | ||
CI: true | ||
TEST_REGEX: "^TestAccMigrationProject" | ||
run: make testacc | ||
|
||
config: | ||
needs: [ change-detection ] | ||
if: ${{ needs.set-output.outputs.condition == 'true' || needs.change-detection.outputs.config == 'true' || github.event.label.name == 'run-testacc-config-migration'}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get Last Release | ||
id: get_last_release | ||
run: | | ||
LAST_RELEASE=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/terraform-provider-mongodbatlas/releases/latest | jq -r '.tag_name | ltrimstr("v")') | ||
echo "Last release: $LAST_RELEASE" | ||
echo "MONGODB_ATLAS_LAST_VERSION=$LAST_RELEASE" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Migration Tests | ||
env: | ||
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV_NETWORK }} | ||
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_CLOUD_DEV_NETWORK }} | ||
MONGODB_ATLAS_ORG_ID: ${{ vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV_NETWORK }} | ||
MONGODB_ATLAS_BASE_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }} | ||
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ vars.MONGODB_ATLAS_PROJECT_OWNER_ID }} | ||
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ vars.SKIP_TEST_EXTERNAL_CREDENTIALS }} | ||
MONGODB_ATLAS_USERNAME_CLOUD_DEV: ${{ vars.MONGODB_ATLAS_USERNAME_CLOUD_DEV }} | ||
AZURE_ATLAS_APP_ID: ${{vars.AZURE_ATLAS_APP_ID}} | ||
AZURE_SERVICE_PRINCIPAL_ID: ${{vars.AZURE_SERVICE_PRINCIPAL_ID}} | ||
AZURE_TENANT_ID: ${{vars.AZURE_TENANT_ID}} | ||
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }} | ||
TF_LOG: ${{ vars.LOG_LEVEL }} | ||
TF_ACC: 1 | ||
PARALLEL_GO_TEST: 20 | ||
CI: true | ||
TEST_REGEX: "^TestAccMigrationConfig" | ||
run: make testacc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally, thanks! :-)