e2e.yml 4.4 KB

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