chore: reduce mint maker tekton pipeline bundle updates #4845
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: e2e tests on demand | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| edaqa_ref: | |
| description: 'ref of the eda-qa repository, default is main' | |
| required: false | |
| default: 'main' | |
| pytest_filter: | |
| description: 'filter for pytest to be used after "-k" flag, default is empty' | |
| required: false | |
| default: '' | |
| issue_comment: | |
| types: [created] | |
| env: | |
| EDA_QA_PATH: "./eda-qa" | |
| REGISTRY: quay.io | |
| QUAY_USER: ansible+eda_gha | |
| PYTEST_RETRIES: 2 | |
| jobs: | |
| check-trigger: | |
| if: > | |
| github.repository == 'ansible/eda-server' && | |
| github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| github.event.comment.body == '/run-e2e' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| deployments: write | |
| pull-requests: read | |
| issues: read | |
| outputs: | |
| pr_sha: ${{ steps.pr-info.outputs.sha }} | |
| pr_repo: ${{ steps.pr-info.outputs.repo }} | |
| pr_number: ${{ steps.pr-info.outputs.number }} | |
| deployment_id: ${{ steps.create-deployment.outputs.deployment_id }} | |
| steps: | |
| - name: Check if commenter has write access | |
| id: check-permission | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| username: context.payload.comment.user.login | |
| }); | |
| const allowed = ['admin', 'write'].includes(permission.permission); | |
| if (!allowed) { | |
| core.setFailed(`User ${context.payload.comment.user.login} does not have write access`); | |
| } | |
| console.log(`User ${context.payload.comment.user.login} has ${permission.permission} permission`); | |
| - name: Get PR info | |
| id: pr-info | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number | |
| }); | |
| core.setOutput('sha', pr.data.head.sha); | |
| core.setOutput('repo', pr.data.head.repo.full_name); | |
| core.setOutput('number', context.issue.number); | |
| console.log(`PR #${context.issue.number} head SHA: ${pr.data.head.sha}`); | |
| console.log(`PR head repo: ${pr.data.head.repo.full_name}`); | |
| - name: Create deployment | |
| id: create-deployment | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| try { | |
| const deployment = await github.rest.repos.createDeployment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: 'refs/pull/${{ steps.pr-info.outputs.number }}/head', | |
| environment: 'e2e-tests', | |
| auto_merge: false, | |
| required_contexts: [], | |
| description: 'E2E Tests for PR #${{ steps.pr-info.outputs.number }} @ ${{ steps.pr-info.outputs.sha }}' | |
| }); | |
| if (deployment.data && deployment.data.id) { | |
| core.setOutput('deployment_id', deployment.data.id); | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: deployment.data.id, | |
| state: 'pending', | |
| description: 'Waiting for approval', | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
| }); | |
| console.log(`Created deployment ${deployment.data.id}`); | |
| } else { | |
| core.warning('Deployment was not created - response had no ID'); | |
| core.setOutput('deployment_id', ''); | |
| } | |
| } catch (error) { | |
| core.warning(`Failed to create deployment: ${error.message}`); | |
| core.setOutput('deployment_id', ''); | |
| } | |
| api-e2e-tests: | |
| needs: check-trigger | |
| if: > | |
| always() && | |
| (github.repository == 'ansible/eda-server' && github.event_name == 'workflow_dispatch') || | |
| (needs.check-trigger.result == 'success') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| deployments: write | |
| environment: ${{ github.event_name == 'issue_comment' && 'protected' || '' }} | |
| steps: | |
| - name: Update deployment to in_progress | |
| if: github.event_name == 'issue_comment' && needs.check-trigger.outputs.deployment_id != '' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: '${{ needs.check-trigger.outputs.deployment_id }}', | |
| state: 'in_progress', | |
| description: 'Running E2E tests', | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
| }); | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| repository: ${{ github.event_name == 'issue_comment' && needs.check-trigger.outputs.pr_repo || github.repository }} | |
| ref: ${{ github.event_name == 'issue_comment' && needs.check-trigger.outputs.pr_sha || github.sha }} | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ env.QUAY_USER }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Run api in background | |
| working-directory: . | |
| env: | |
| DJANGO_SETTINGS_MODULE: aap_eda.settings.default | |
| EDA_DEBUG: "false" | |
| run: | | |
| docker compose -p eda -f tools/docker/docker-compose-dev.yaml build | |
| docker compose -p eda -f tools/docker/docker-compose-dev.yaml up -d | |
| while ! curl -s http://localhost:8000/_healthz | grep -q "OK"; do | |
| echo "Waiting for API to be ready..." | |
| sleep 1 | |
| done | |
| - name: Fetch test suite | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| repository: ansible/eda-qa | |
| ref: ${{ github.event.inputs.edaqa_ref }} | |
| path: ${{ env.EDA_QA_PATH }} | |
| token: ${{ secrets.EDA_QA_GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| working-directory: ${{ env.EDA_QA_PATH }} | |
| run: | | |
| pip install . | |
| pip install pytest-rerunfailures | |
| - name: Run tests | |
| working-directory: ${{ env.EDA_QA_PATH }} | |
| env: | |
| EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }} | |
| EDAQA_ENV: authenticated | |
| EDAQA_MAX_CONCURRENT_ACTIVATIONS: 10 | |
| EDAQA_UPSTREAM_ENABLED: true | |
| run: | | |
| if [ -n "${{ github.event.inputs.pytest_filter }}" ]; then | |
| pytest -vv -k "${{ github.event.inputs.pytest_filter }}" --junit-xml=eda-qa-e2e-test-results.xml --reruns ${{ env.PYTEST_RETRIES }} | |
| else | |
| pytest -vv --junit-xml=eda-qa-e2e-test-results.xml --reruns ${{ env.PYTEST_RETRIES }} | |
| fi | |
| - name: Setup jUnit reporter | |
| run: | | |
| pip install httpie | |
| echo "GIT_SHA=$(git rev-parse "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Upload jUnit test results (APDE CI) | |
| working-directory: ${{ env.EDA_QA_PATH }} | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| PDE_UPLOAD_USER: ${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }} | |
| PDE_UPLOAD_PASSWORD: ${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }} | |
| PDE_UPLOAD_URL: ${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }} | |
| run: >- | |
| http --check-status --ignore-stdin | |
| --auth "$PDE_UPLOAD_USER:$PDE_UPLOAD_PASSWORD" | |
| -f POST "$PDE_UPLOAD_URL/api/results/upload/" | |
| xunit_xml@eda-qa-e2e-test-results.xml | |
| component_name=eda | |
| git_commit_sha=${{ env.GIT_SHA }} | |
| git_repository_url="https://github.com/${{ github.repository }}" | |
| - name: Print EDA logs | |
| if: always() | |
| working-directory: tools/docker | |
| run: | | |
| docker compose -p eda -f docker-compose-dev.yaml logs | |
| - name: Update deployment status | |
| if: always() && github.event_name == 'issue_comment' && needs.check-trigger.outputs.deployment_id != '' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const state = '${{ job.status }}' === 'success' ? 'success' : 'failure'; | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: '${{ needs.check-trigger.outputs.deployment_id }}', | |
| state: state, | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
| }); | |
| api-e2e-multinode-tests: | |
| needs: check-trigger | |
| if: > | |
| always() && | |
| (github.repository == 'ansible/eda-server' && github.event_name == 'workflow_dispatch') || | |
| (needs.check-trigger.result == 'success') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| deployments: write | |
| environment: ${{ github.event_name == 'issue_comment' && 'protected' || '' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| repository: ${{ github.event_name == 'issue_comment' && needs.check-trigger.outputs.pr_repo || github.repository }} | |
| ref: ${{ github.event_name == 'issue_comment' && needs.check-trigger.outputs.pr_sha || github.sha }} | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ env.QUAY_USER }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Fetch test suite | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| repository: ansible/eda-qa | |
| ref: ${{ github.event.inputs.edaqa_ref }} | |
| path: ${{ env.EDA_QA_PATH }} | |
| token: ${{ secrets.EDA_QA_GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| working-directory: ${{ env.EDA_QA_PATH }} | |
| run: | | |
| pip install . | |
| pip install pytest-rerunfailures | |
| - name: Build eda-server images | |
| working-directory: . | |
| run: | | |
| docker compose -p eda-multinode -f tools/docker/docker-compose-dev.yaml build | |
| - name: Run multinode tests | |
| working-directory: ${{ env.EDA_QA_PATH }} | |
| env: | |
| EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }} | |
| EDAQA_ENV: default | |
| EDAQA_MULTINODE_EDA_SERVER_PATH: "../" | |
| # multinode-upstream tests require a longer timeout | |
| # to allow for the time it takes to start the workers inside the tests | |
| EDAQA_DEFAULT_TIMEOUT: 120 | |
| run: | | |
| pytest -vv -s eda_qa/tests/whitebox/upstream --junit-xml=eda-qa-e2e-multinode-test-results.xml --reruns ${{ env.PYTEST_RETRIES }} | |
| - name: Setup jUnit reporter | |
| run: | | |
| pip install httpie | |
| echo "GIT_SHA=$(git rev-parse "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Upload jUnit test results (APDE CI) | |
| working-directory: ${{ env.EDA_QA_PATH }} | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| PDE_UPLOAD_USER: ${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }} | |
| PDE_UPLOAD_PASSWORD: ${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }} | |
| PDE_UPLOAD_URL: ${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }} | |
| run: >- | |
| http --check-status --ignore-stdin | |
| --auth "$PDE_UPLOAD_USER:$PDE_UPLOAD_PASSWORD" | |
| -f POST "$PDE_UPLOAD_URL/api/results/upload/" | |
| xunit_xml@eda-qa-e2e-multinode-test-results.xml | |
| component_name=eda | |
| git_commit_sha=${{ env.GIT_SHA }} | |
| git_repository_url="https://github.com/${{ github.repository }}" | |
| - name: Update deployment status | |
| if: always() && github.event_name == 'issue_comment' && needs.check-trigger.outputs.deployment_id != '' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const state = '${{ job.status }}' === 'success' ? 'success' : 'failure'; | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: '${{ needs.check-trigger.outputs.deployment_id }}', | |
| state: state, | |
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
| }); |