|
1 | 1 | name: Tests-selectable
|
2 | 2 |
|
3 | 3 | # This workflow is for running tests based on PR labels
|
| 4 | +# NOTE: |
| 5 | +# The label filter app is used to select tests based on GitHub PR labels |
| 6 | +# Tests in the ./int directory are considered an integration test and executed in a separate job |
| 7 | +# Tests in the ./e2e directory are considered an end-to-end test and executed in a separate job |
| 8 | +# Tests in the ./e2e directory are considered a GOV test ONLY IF their labels contain "atlas-gov" and executed in a separate job |
4 | 9 |
|
5 | 10 | on:
|
6 | 11 | pull_request:
|
|
82 | 87 | ./bin/ginkgo-labels > result.json
|
83 | 88 | echo "Int tests to execute $(cat result.json | jq -c .int)"
|
84 | 89 | echo "E2E tests to execute $(cat result.json | jq -c .e2e)"
|
| 90 | + echo "E2E GOV tests to execute $(cat result.json | jq -c .e2e_gov)" |
85 | 91 |
|
86 | 92 | echo "int_matrix=$(cat result.json | jq -c .int)" >> $GITHUB_OUTPUT
|
87 | 93 | echo "e2e_matrix=$(cat result.json | jq -c .e2e)" >> $GITHUB_OUTPUT
|
| 94 | + echo "e2e_gov_matrix=$(cat result.json | jq -c .e2e_gov)" >> $GITHUB_OUTPUT |
88 | 95 |
|
89 | 96 | compute:
|
90 | 97 | needs: detect-tests
|
@@ -318,27 +325,12 @@ jobs:
|
318 | 325 | run: |
|
319 | 326 | devbox run -- 'kubectl apply -f deploy/crds'
|
320 | 327 |
|
321 |
| - - name: Select environment to run E2E test |
322 |
| - id: select-env |
323 |
| - run: | |
324 |
| - if [[ "${{ matrix.test }}" == *"atlas-gov"* ]]; then |
325 |
| - echo "ENV=https://cloud-qa.mongodbgov.com" >> $GITHUB_OUTPUT |
326 |
| - echo "ORG_ID=${{ secrets.ATLAS_GOV_ORG_ID }}" >> $GITHUB_OUTPUT |
327 |
| - echo "PUBLIC_KEY=${{ secrets.ATLAS_GOV_PUBLIC_KEY }}" >> $GITHUB_OUTPUT |
328 |
| - echo "PRIVATE_KEY=${{ secrets.ATLAS_GOV_PRIVATE_KEY }}" >> $GITHUB_OUTPUT |
329 |
| - else |
330 |
| - echo "ENV=https://cloud-qa.mongodb.com" >> $GITHUB_OUTPUT |
331 |
| - echo "ORG_ID=${{ secrets.ATLAS_ORG_ID }}" >> $GITHUB_OUTPUT |
332 |
| - echo "PUBLIC_KEY=${{ secrets.ATLAS_PUBLIC_KEY }}" >> $GITHUB_OUTPUT |
333 |
| - echo "PRIVATE_KEY=${{ secrets.ATLAS_PRIVATE_KEY }}" >> $GITHUB_OUTPUT |
334 |
| - fi |
335 |
| -
|
336 | 328 | - name: Run E2E test
|
337 | 329 | env:
|
338 |
| - MCLI_PUBLIC_API_KEY: "${{ steps.select-env.outputs.PUBLIC_KEY }}" |
339 |
| - MCLI_PRIVATE_API_KEY: "${{ steps.select-env.outputs.PRIVATE_KEY }}" |
340 |
| - MCLI_ORG_ID: "${{ steps.select-env.outputs.ORG_ID }}" |
341 |
| - MCLI_OPS_MANAGER_URL: "${{ steps.select-env.outputs.ENV }}" |
| 330 | + MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_PUBLIC_KEY }} |
| 331 | + MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_PRIVATE_KEY }} |
| 332 | + MCLI_ORG_ID: ${{ secrets.ATLAS_ORG_ID}} |
| 333 | + MCLI_OPS_MANAGER_URL: "https://cloud-qa.mongodb.com/" |
342 | 334 | IMAGE_URL: "${{ env.GHCR_REPO }}:${{ steps.prepare.outputs.tag }}"
|
343 | 335 | IMAGE_PULL_SECRET_REGISTRY: ghcr.io
|
344 | 336 | IMAGE_PULL_SECRET_USERNAME: $
|
@@ -367,3 +359,65 @@ jobs:
|
367 | 359 | with:
|
368 | 360 | name: logs
|
369 | 361 | path: output/**
|
| 362 | + |
| 363 | + run-e2e-gov-tests: |
| 364 | + needs: [detect-tests, prepare-e2e, prepare-e2e-bundle, compute] |
| 365 | + environment: gov-test |
| 366 | + if: ${{ needs.detect-tests.outputs.e2e_gov_matrix != '[]' && fromJSON(needs.detect-tests.outputs.e2e_gov_matrix) != '[]' }} |
| 367 | + strategy: |
| 368 | + fail-fast: false |
| 369 | + matrix: |
| 370 | + test: ${{ fromJSON(needs.detect-tests.outputs.e2e_gov_matrix) }} |
| 371 | + runs-on: ubuntu-latest |
| 372 | + name: "e2e gov: ${{ matrix.test }}" |
| 373 | + steps: |
| 374 | + - name: Get repo files from cache |
| 375 | + id: get-repo-files-from-cache |
| 376 | + uses: actions/cache@v4 |
| 377 | + with: |
| 378 | + path: ./* |
| 379 | + key: ${{ github.sha }} |
| 380 | + |
| 381 | + - name: Checkout if cache repo files missed |
| 382 | + if: steps.get-repo-files-from-cache.outputs.cache-hit != 'true' |
| 383 | + uses: actions/checkout@v4 |
| 384 | + with: |
| 385 | + ref: ${{github.event.pull_request.head.sha}} |
| 386 | + submodules: true |
| 387 | + fetch-depth: 0 |
| 388 | + |
| 389 | + - name: Create k8s Kind Cluster |
| 390 | + if: ${{ !env.ACT }} |
| 391 | + |
| 392 | + with: |
| 393 | + version: v0.26.0 |
| 394 | + config: test/helper/e2e/config/kind.yaml |
| 395 | + cluster_name: "atlas-gov-e2e-test" |
| 396 | + wait: 180s |
| 397 | + |
| 398 | + - name: Install devbox |
| 399 | + uses: jetify-com/[email protected] |
| 400 | + with: |
| 401 | + enable-cache: 'true' |
| 402 | + |
| 403 | + - name: Install CRDs |
| 404 | + run: devbox run -- 'make install' |
| 405 | + |
| 406 | + - name: Run e2e test |
| 407 | + env: |
| 408 | + MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_GOV_PUBLIC_KEY }} |
| 409 | + MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_GOV_PRIVATE_KEY }} |
| 410 | + MCLI_ORG_ID: ${{ secrets.ATLAS_GOV_ORG_ID}} |
| 411 | + MCLI_OPS_MANAGER_URL: "https://cloud-qa.mongodbgov.com/" |
| 412 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 413 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 414 | + AWS_ACCOUNT_ARN_LIST: ${{ secrets.AWS_ACCOUNT_ARN_LIST }} |
| 415 | + PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }} |
| 416 | + TEST_NAME: "${{ matrix.test }}"" |
| 417 | + run: devbox run -- ./scripts/launch-ci-e2e.sh |
| 418 | + - name: Upload operator logs |
| 419 | + if: ${{ failure() }} |
| 420 | + uses: actions/upload-artifact@v4 |
| 421 | + with: |
| 422 | + name: logs |
| 423 | + path: output/** |
0 commit comments