Update E2E Tests Snapshots #843
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Update E2E Tests Snapshots | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 15 2 * * 1 # every Monday at 2:15 AM UTC | |
pull_request: | |
types: [labeled] | |
jobs: | |
update-tests: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || (github.event.action == 'labeled' && github.event.label.name == 'update-snapshots') | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
- atlas/autogeneration | |
- atlas/backup/compliancepolicy | |
- atlas/backup/flex | |
- atlas/backup/exports/buckets | |
- atlas/backup/exports/jobs | |
- atlas/backup/restores | |
- atlas/backup/schedule | |
- atlas/backup/snapshot | |
- atlas/clusters/file | |
- atlas/clusters/flags | |
- atlas/clusters/flex | |
- atlas/clusters/m0 | |
- atlas/clusters/sharded | |
- atlas/clusters/upgrade | |
- atlas/datafederation/db | |
- atlas/datafederation/privatenetwork | |
- atlas/datafederation/querylimits | |
- atlas/decrypt | |
- atlas/deployments/atlasclusters | |
- atlas/deployments/local/auth/deprecated | |
- atlas/deployments/local/auth/new | |
- atlas/deployments/local/nocli | |
- atlas/deployments/local/noauth | |
- atlas/generic | |
- atlas/interactive | |
- atlas/ldap | |
- atlas/livemigrations | |
- atlas/logs | |
- atlas/metrics | |
- atlas/networking | |
- atlas/onlinearchive | |
- atlas/performanceAdvisor | |
- atlas/plugin/install | |
- atlas/plugin/run | |
- atlas/plugin/uninstall | |
- atlas/plugin/update | |
- atlas/processes | |
- atlas/search | |
- atlas/search_nodes | |
- atlas/serverless/instance | |
- atlas/streams | |
- atlas/streams_with_cluster | |
- atlas/clusters/iss | |
- atlas/iam | |
- brew | |
- config | |
- kubernetes | |
steps: | |
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
with: | |
config: ${{ vars.PERMISSIONS_CONFIG }} | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v6 | |
with: | |
go-version-file: 'go.mod' | |
- run: go install gotest.tools/gotestsum@latest | |
- run: rm -rf test/e2e/testdata/.snapshots | |
- run: make build | |
- id: config-path | |
env: | |
EDITOR: echo | |
run: echo "CONFIG_PATH=$(./bin/atlas config edit 2>/dev/null)" >> "$GITHUB_OUTPUT" | |
- env: | |
CONFIG_PATH: ${{ steps.config-path.outputs.CONFIG_PATH }} | |
CONFIG_CONTENT: | | |
skip_update_check = true | |
silence_storage_warning = true | |
telemetry_enabled = false | |
[__e2e] | |
org_id = 'a0123456789abcdef012345a' | |
project_id = 'b0123456789abcdef012345b' | |
public_api_key = 'ABCDEF01' | |
private_api_key = '12345678-abcd-ef01-2345-6789abcdef01' | |
ops_manager_url = 'http://localhost:8080/' | |
service = 'cloud' | |
output = 'plaintext' | |
[__e2e_snapshot] | |
org_id = 'a0123456789abcdef012345a' | |
project_id = 'b0123456789abcdef012345b' | |
public_api_key = 'ABCDEF01' | |
private_api_key = '12345678-abcd-ef01-2345-6789abcdef01' | |
ops_manager_url = 'http://localhost:8080/' | |
service = 'cloud' | |
output = 'plaintext' | |
MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID }} | |
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID }} | |
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_API_KEY }} | |
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_API_KEY }} | |
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ secrets.MONGODB_ATLAS_OPS_MANAGER_URL }} | |
run: | | |
echo "$CONFIG_CONTENT" > "$CONFIG_PATH" | |
./bin/atlas config set org_id "$MONGODB_ATLAS_ORG_ID" -P __e2e | |
./bin/atlas config set project_id "$MONGODB_ATLAS_PROJECT_ID" -P __e2e | |
./bin/atlas config set public_api_key "$MONGODB_ATLAS_PUBLIC_API_KEY" -P __e2e | |
./bin/atlas config set private_api_key "$MONGODB_ATLAS_PRIVATE_API_KEY" -P __e2e | |
./bin/atlas config set ops_manager_url "$MONGODB_ATLAS_OPS_MANAGER_URL" -P __e2e | |
- run: make e2e-test | |
env: | |
TEST_CMD: gotestsum --junitfile e2e-tests.xml --format standard-verbose -- | |
E2E_TEST_PACKAGES: ./test/e2e/${{ matrix.package }}/... | |
TEST_MODE: record | |
E2E_CLOUD_ROLE_ID: ${{ secrets.E2E_CLOUD_ROLE_ID }} | |
E2E_TEST_BUCKET: ${{ secrets.E2E_TEST_BUCKET }} | |
E2E_FLEX_INSTANCE_NAME: ${{ secrets.E2E_FLEX_INSTANCE_NAME }} | |
IDENTITY_PROVIDER_ID: ${{ secrets.IDENTITY_PROVIDER_ID }} | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | |
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
E2E_TIMEOUT: 3h | |
- name: set artifact name | |
if: always() | |
id: set-artifact-name | |
run: | | |
echo "NAME=snapshots_${{ matrix.package }}" | sed "s|/|_|g" >> "$GITHUB_OUTPUT" | |
- name: upload artifact | |
if: always() | |
uses: actions/upload-artifact@v4.6.2 | |
with: | |
name: ${{ steps.set-artifact-name.outputs.NAME }} | |
path: test/e2e/testdata/.snapshots | |
include-hidden-files: true | |
- name: Test Summary | |
if: always() | |
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 | |
with: | |
paths: e2e-tests.xml | |
cleanup: | |
if: always() && github.event_name != 'pull_request' || (github.event.action == 'labeled' && github.event.label.name == 'update-snapshots') | |
needs: update-tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
with: | |
config: ${{ vars.PERMISSIONS_CONFIG }} | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v6 | |
with: | |
go-version-file: 'go.mod' | |
- run: go install gotest.tools/gotestsum@latest | |
- run: make build | |
- id: config-path | |
env: | |
EDITOR: echo | |
run: echo "CONFIG_PATH=$(./bin/atlas config edit 2>/dev/null)" >> "$GITHUB_OUTPUT" | |
- env: | |
CONFIG_PATH: ${{ steps.config-path.outputs.CONFIG_PATH }} | |
CONFIG_CONTENT: | | |
skip_update_check = true | |
silence_storage_warning = true | |
telemetry_enabled = false | |
[__e2e] | |
org_id = 'a0123456789abcdef012345a' | |
project_id = 'b0123456789abcdef012345b' | |
public_api_key = 'ABCDEF01' | |
private_api_key = '12345678-abcd-ef01-2345-6789abcdef01' | |
ops_manager_url = 'http://localhost:8080/' | |
service = 'cloud' | |
output = 'plaintext' | |
[__e2e_snapshot] | |
org_id = 'a0123456789abcdef012345a' | |
project_id = 'b0123456789abcdef012345b' | |
public_api_key = 'ABCDEF01' | |
private_api_key = '12345678-abcd-ef01-2345-6789abcdef01' | |
ops_manager_url = 'http://localhost:8080/' | |
service = 'cloud' | |
output = 'plaintext' | |
MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID }} | |
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID }} | |
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_API_KEY }} | |
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_API_KEY }} | |
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ secrets.MONGODB_ATLAS_OPS_MANAGER_URL }} | |
run: | | |
echo "$CONFIG_CONTENT" > "$CONFIG_PATH" | |
./bin/atlas config set org_id "$MONGODB_ATLAS_ORG_ID" -P __e2e | |
./bin/atlas config set project_id "$MONGODB_ATLAS_PROJECT_ID" -P __e2e | |
./bin/atlas config set public_api_key "$MONGODB_ATLAS_PUBLIC_API_KEY" -P __e2e | |
./bin/atlas config set private_api_key "$MONGODB_ATLAS_PRIVATE_API_KEY" -P __e2e | |
./bin/atlas config set ops_manager_url "$MONGODB_ATLAS_OPS_MANAGER_URL" -P __e2e | |
- run: make e2e-test | |
env: | |
TEST_CMD: gotestsum --junitfile e2e-tests.xml --format standard-verbose -- | |
E2E_TEST_PACKAGES: ./test/internal/... | |
E2E_CLOUD_ROLE_ID: ${{ secrets.E2E_CLOUD_ROLE_ID }} | |
E2E_TEST_BUCKET: ${{ secrets.E2E_TEST_BUCKET }} | |
E2E_FLEX_INSTANCE_NAME: ${{ secrets.E2E_FLEX_INSTANCE_NAME }} | |
IDENTITY_PROVIDER_ID: ${{ secrets.IDENTITY_PROVIDER_ID }} | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | |
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID }} | |
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID }} | |
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ secrets.MONGODB_ATLAS_OPS_MANAGER_URL }} | |
E2E_TIMEOUT: 3h | |
- name: Test Summary | |
if: always() | |
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 | |
with: | |
paths: e2e-tests.xml | |
commit: | |
runs-on: ubuntu-latest | |
if: success() && github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'update-snapshots' | |
needs: update-tests | |
steps: | |
- name: set Apix Bot token | |
id: app-token | |
uses: mongodb/apix-action/token@6c3fde402c21942fa46cde003f190c2b23c59530 | |
with: | |
app-id: ${{ secrets.APIXBOT_APP_ID }} | |
private-key: ${{ secrets.APIXBOT_APP_PEM }} | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- run: rm -rf test/e2e/testdata/.snapshots && mkdir -p test/e2e/testdata/.snapshots | |
- name: Download artifacts | |
uses: actions/download-artifact@v5 | |
with: | |
pattern: snapshots_* | |
path: test/e2e/testdata/.snapshots | |
merge-multiple: true | |
- name: commit | |
run: | | |
git config --global user.name "${{ steps.app-token.outputs.user-name }}" | |
git config --global user.email "${{ steps.app-token.outputs.user-email }}" | |
git add test/e2e/testdata/.snapshots | |
git commit -m "Update snapshots" | |
git push | |
- uses: actions-ecosystem/action-remove-labels@v1 | |
with: | |
github_token: ${{ steps.app-token.outputs.token }} | |
labels: update-snapshots | |
comment: | |
runs-on: ubuntu-latest | |
if: failure() && github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'update-snapshots' | |
needs: update-tests | |
steps: | |
- name: set Apix Bot token | |
id: app-token | |
uses: mongodb/apix-action/token@6c3fde402c21942fa46cde003f190c2b23c59530 | |
with: | |
app-id: ${{ secrets.APIXBOT_APP_ID }} | |
private-key: ${{ secrets.APIXBOT_APP_PEM }} | |
- uses: actions-ecosystem/action-remove-labels@v1 | |
with: | |
github_token: ${{ steps.app-token.outputs.token }} | |
labels: update-snapshots | |
- uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 | |
with: | |
header: test | |
message: "Failed to update test snapshots." | |
pr: | |
runs-on: ubuntu-latest | |
if: success() && github.event_name != 'pull_request' | |
needs: update-tests | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- run: rm -rf test/e2e/testdata/.snapshots && mkdir -p test/e2e/testdata/.snapshots | |
- name: Download artifacts | |
uses: actions/download-artifact@v5 | |
with: | |
pattern: snapshots_* | |
path: test/e2e/testdata/.snapshots | |
merge-multiple: true | |
- name: Find JIRA ticket | |
id: find | |
uses: mongodb/apix-action/find-jira@6c3fde402c21942fa46cde003f190c2b23c59530 | |
with: | |
token: ${{ secrets.JIRA_API_TOKEN }} | |
jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Update Test Snapshots" | |
- name: Set JIRA ticket (find) | |
if: steps.find.outputs.found == 'true' | |
run: | | |
echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV" | |
- name: Create JIRA ticket | |
uses: mongodb/apix-action/create-jira@6c3fde402c21942fa46cde003f190c2b23c59530 | |
id: create | |
if: steps.find.outputs.found == 'false' | |
with: | |
token: ${{ secrets.JIRA_API_TOKEN }} | |
project-key: CLOUDP | |
summary: "[AtlasCLI] Update Test Snapshots" | |
issuetype: Story | |
description: Update Test Snapshots | |
components: AtlasCLI | |
assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }} | |
extra-data: | | |
{ | |
"fields": { | |
"fixVersions": [ | |
{ | |
"name": "next-atlascli-release" | |
} | |
], | |
"customfield_12751": [ | |
{ | |
"id": "22223" | |
} | |
], | |
"customfield_10257": { | |
"id": "11861" | |
} | |
} | |
} | |
- name: Set JIRA ticket (create) | |
if: steps.find.outputs.found == 'false' | |
run: | | |
echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV" | |
- name: set Apix Bot token | |
id: app-token | |
uses: mongodb/apix-action/token@6c3fde402c21942fa46cde003f190c2b23c59530 | |
with: | |
app-id: ${{ secrets.APIXBOT_APP_ID }} | |
private-key: ${{ secrets.APIXBOT_APP_PEM }} | |
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e | |
id: pr | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
committer: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" | |
author: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" | |
title: "${{ env.JIRA_KEY }}: Update Test Snapshots" | |
commit-message: "${{ env.JIRA_KEY }}: Update Test Snapshots" | |
delete-branch: true | |
base: master | |
branch: ${{ env.JIRA_KEY }} | |
labels: | | |
auto_close_jira | |
body: | | |
## Proposed changes | |
Update Test Snapshots | |
_Jira ticket:_ ${{ env.JIRA_KEY }} | |
Note: Jira ticket will be closed automatically when this PR is merged. | |
- name: Set auto merge | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
gh pr merge "${{ steps.pr.outputs.pull-request-url }}" --auto --squash | |
report: | |
runs-on: ubuntu-latest | |
if: failure() && github.event_name != 'pull_request' | |
needs: update-tests | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Find JIRA ticket | |
id: find | |
uses: mongodb/apix-action/find-jira@v13 | |
with: | |
token: ${{ secrets.JIRA_API_TOKEN }} | |
jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Failed to update test snapshots" | |
- name: Comment JIRA ticket | |
if: steps.find.outputs.found == 'true' | |
uses: mongodb/apix-action/comment-jira@v13 | |
with: | |
token: ${{ secrets.JIRA_API_TOKEN }} | |
issue-key: ${{ steps.find.outputs.issue-key }} | |
comment: | | |
Another attempt to update test snapshots failed. | |
Check github actions logs for more details at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: Create JIRA ticket | |
uses: mongodb/apix-action/create-jira@v13 | |
id: create | |
if: steps.find.outputs.found == 'false' | |
with: | |
token: ${{ secrets.JIRA_API_TOKEN }} | |
project-key: CLOUDP | |
summary: "[AtlasCLI] Failed to update test snapshots" | |
issuetype: Investigation | |
description: | | |
Failed to update test snapshots | |
Check github actions logs for more details at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
components: AtlasCLI | |
assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }} | |
extra-data: | | |
{ | |
"fields": { | |
"fixVersions": [ | |
{ | |
"name": "next-atlascli-release" | |
} | |
], | |
"customfield_12751": [ | |
{ | |
"id": "22223" | |
} | |
], | |
"customfield_10257": { | |
"id": "11861" | |
} | |
} | |
} |