e2e.yml 4.3 KB

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