e2e.yml 4.0 KB

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