e2e.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Run secret-dependent e2e tests only after /ok-to-test approval
  2. on:
  3. pull_request:
  4. repository_dispatch:
  5. types: [ok-to-test-command]
  6. permissions:
  7. id-token: write
  8. checks: write
  9. contents: read
  10. name: e2e tests
  11. env:
  12. # Common versions
  13. GO_VERSION: '1.19'
  14. GINKGO_VERSION: 'v2.1.6'
  15. DOCKER_BUILDX_VERSION: 'v0.4.2'
  16. KIND_VERSION: 'v0.17.0'
  17. KIND_IMAGE: 'kindest/node:v1.26.0'
  18. # Common users. We can't run a step 'if secrets.GHCR_USERNAME != ""' but we can run
  19. # a step 'if env.GHCR_USERNAME' != ""', so we copy these to succinctly test whether
  20. # credentials have been provided before trying to run steps that need them.
  21. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  22. GCP_SM_SA_JSON: ${{ secrets.GCP_SM_SA_JSON}}
  23. GCP_GKE_ZONE: ${{ secrets.GCP_GKE_ZONE}}
  24. GCP_GSA_NAME: ${{ secrets.GCP_GSA_NAME}} # Goolge Service Account
  25. GCP_KSA_NAME: ${{ secrets.GCP_KSA_NAME}} # Kubernetes Service Account
  26. GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID}}
  27. AWS_REGION: "eu-central-1"
  28. AWS_OIDC_ROLE_ARN: ${{ secrets.AWS_OIDC_ROLE_ARN }}
  29. AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}}
  30. AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}}
  31. TENANT_ID: ${{ secrets.TENANT_ID}}
  32. VAULT_URL: ${{ secrets.VAULT_URL}}
  33. jobs:
  34. integration-trusted:
  35. runs-on: ubuntu-latest
  36. if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor !='dependabot[bot]'
  37. steps:
  38. - name: Branch based PR checkout
  39. uses: actions/checkout@v3
  40. - name: Fetch History
  41. run: git fetch --prune --unshallow
  42. - uses: ./.github/actions/e2e
  43. # Repo owner has commented /ok-to-test on a (fork-based) pull request
  44. integration-fork:
  45. runs-on: ubuntu-latest
  46. if: github.event_name == 'repository_dispatch'
  47. steps:
  48. # Check out merge commit
  49. - name: Fork based /ok-to-test checkout
  50. uses: actions/checkout@v3
  51. with:
  52. ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
  53. - name: Fetch History
  54. run: git fetch --prune --unshallow
  55. - uses: ./.github/actions/e2e
  56. # Update check run called "integration-fork"
  57. - uses: actions/github-script@v6
  58. id: update-check-run
  59. if: ${{ always() }}
  60. env:
  61. number: ${{ github.event.client_payload.pull_request.number }}
  62. job: ${{ github.job }}
  63. # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
  64. conclusion: ${{ job.status }}
  65. with:
  66. github-token: ${{ secrets.GITHUB_TOKEN }}
  67. script: |
  68. const { data: pull } = await github.rest.pulls.get({
  69. ...context.repo,
  70. pull_number: process.env.number
  71. });
  72. const ref = pull.head.sha;
  73. console.log("\n\nPR sha: " + ref)
  74. const { data: checks } = await github.rest.checks.listForRef({
  75. ...context.repo,
  76. ref
  77. });
  78. console.log("\n\nPR CHECKS: " + checks)
  79. const check = checks.check_runs.filter(c => c.name === process.env.job);
  80. console.log("\n\nPR Filtered CHECK: " + check)
  81. console.log(check)
  82. const { data: result } = await github.rest.checks.update({
  83. ...context.repo,
  84. check_run_id: check[0].id,
  85. status: 'completed',
  86. conclusion: process.env.conclusion
  87. });
  88. return result;