e2e.yml 3.9 KB

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