e2e.yml 3.3 KB

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