e2e.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.8.0'
  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. SCALEWAY_API_URL: ${{ secrets.SCALEWAY_API_URL }}
  34. SCALEWAY_REGION: ${{ secrets.SCALEWAY_REGION }}
  35. SCALEWAY_PROJECT_ID: ${{ secrets.SCALEWAY_PROJECT_ID }}
  36. SCALEWAY_ACCESS_KEY: ${{ secrets.SCALEWAY_ACCESS_KEY }}
  37. SCALEWAY_SECRET_KEY: ${{ secrets.SCALEWAY_SECRET_KEY }}
  38. jobs:
  39. integration-trusted:
  40. runs-on: ubuntu-latest
  41. if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor !='dependabot[bot]'
  42. steps:
  43. - name: Branch based PR checkout
  44. uses: actions/checkout@v3
  45. - name: Fetch History
  46. run: git fetch --prune --unshallow
  47. - uses: ./.github/actions/e2e
  48. # Repo owner has commented /ok-to-test on a (fork-based) pull request
  49. integration-fork:
  50. runs-on: ubuntu-latest
  51. if: github.event_name == 'repository_dispatch'
  52. steps:
  53. # Check out merge commit
  54. - name: Fork based /ok-to-test checkout
  55. uses: actions/checkout@v3
  56. with:
  57. ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
  58. - name: Fetch History
  59. run: git fetch --prune --unshallow
  60. - uses: ./.github/actions/e2e
  61. # Update check run called "integration-fork"
  62. - uses: actions/github-script@v6
  63. id: update-check-run
  64. if: ${{ always() }}
  65. env:
  66. number: ${{ github.event.client_payload.pull_request.number }}
  67. job: ${{ github.job }}
  68. # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
  69. conclusion: ${{ job.status }}
  70. with:
  71. github-token: ${{ secrets.GITHUB_TOKEN }}
  72. script: |
  73. const { data: pull } = await github.rest.pulls.get({
  74. ...context.repo,
  75. pull_number: process.env.number
  76. });
  77. const ref = pull.head.sha;
  78. console.log("\n\nPR sha: " + ref)
  79. const { data: checks } = await github.rest.checks.listForRef({
  80. ...context.repo,
  81. ref
  82. });
  83. console.log("\n\nPR CHECKS: " + checks)
  84. const check = checks.check_runs.filter(c => c.name === process.env.job);
  85. console.log("\n\nPR Filtered CHECK: " + check)
  86. console.log(check)
  87. const { data: result } = await github.rest.checks.update({
  88. ...context.repo,
  89. check_run_id: check[0].id,
  90. status: 'completed',
  91. conclusion: process.env.conclusion
  92. });
  93. return result;