e2e.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. issues: read
  9. pull-requests: read
  10. checks: read
  11. statuses: read
  12. name: e2e tests
  13. env:
  14. # Common versions
  15. GO_VERSION: '1.24'
  16. GINKGO_VERSION: 'v2.8.0'
  17. DOCKER_BUILDX_VERSION: 'v0.4.2'
  18. KIND_VERSION: 'v0.17.0'
  19. KIND_IMAGE: 'kindest/node:v1.26.0'
  20. # Common users. We can't run a step 'if secrets.GHCR_USERNAME != ""' but we can run
  21. # a step 'if env.GHCR_USERNAME' != ""', so we copy these to succinctly test whether
  22. # credentials have been provided before trying to run steps that need them.
  23. TARGET_SHA: ${{ github.event.client_payload.slash_command.args.named.sha }}
  24. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  25. GCP_SM_SA_JSON: ${{ secrets.GCP_SM_SA_JSON}}
  26. GCP_GKE_ZONE: ${{ secrets.GCP_GKE_ZONE}}
  27. GCP_GSA_NAME: ${{ secrets.GCP_GSA_NAME}} # Goolge Service Account
  28. GCP_KSA_NAME: ${{ secrets.GCP_KSA_NAME}} # Kubernetes Service Account
  29. GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID}}
  30. AWS_REGION: "eu-central-1"
  31. AWS_OIDC_ROLE_ARN: ${{ secrets.AWS_OIDC_ROLE_ARN }}
  32. AWS_SA_NAME: ${{ secrets.AWS_SA_NAME }}
  33. AWS_SA_NAMESPACE: ${{ secrets.AWS_SA_NAMESPACE }}
  34. TFC_AZURE_CLIENT_ID: ${{ secrets.TFC_AZURE_CLIENT_ID}}
  35. TFC_AZURE_CLIENT_SECRET: ${{ secrets.TFC_AZURE_CLIENT_SECRET }}
  36. TFC_AZURE_TENANT_ID: ${{ secrets.TFC_AZURE_TENANT_ID}}
  37. TFC_AZURE_SUBSCRIPTION_ID: ${{ secrets.TFC_AZURE_SUBSCRIPTION_ID }}
  38. TFC_VAULT_URL: ${{ secrets.TFC_VAULT_URL}}
  39. SCALEWAY_API_URL: ${{ secrets.SCALEWAY_API_URL }}
  40. SCALEWAY_REGION: ${{ secrets.SCALEWAY_REGION }}
  41. SCALEWAY_PROJECT_ID: ${{ secrets.SCALEWAY_PROJECT_ID }}
  42. SCALEWAY_ACCESS_KEY: ${{ secrets.SCALEWAY_ACCESS_KEY }}
  43. SCALEWAY_SECRET_KEY: ${{ secrets.SCALEWAY_SECRET_KEY }}
  44. DELINEA_TLD: ${{ secrets.DELINEA_TLD }}
  45. DELINEA_URL_TEMPLATE: ${{ secrets.DELINEA_URL_TEMPLATE }}
  46. DELINEA_TENANT: ${{ secrets.DELINEA_TENANT }}
  47. DELINEA_CLIENT_ID: ${{ secrets.DELINEA_CLIENT_ID }}
  48. DELINEA_CLIENT_SECRET: ${{ secrets.DELINEA_CLIENT_SECRET }}
  49. SECRETSERVER_USERNAME: ${{ secrets.SECRETSERVER_USERNAME }}
  50. SECRETSERVER_PASSWORD: ${{ secrets.SECRETSERVER_PASSWORD }}
  51. SECRETSERVER_URL: ${{ secrets.SECRETSERVER_URL }}
  52. GRAFANA_URL: ${{ secrets.GRAFANA_URL }}
  53. GRAFANA_TOKEN: ${{ secrets.GRAFANA_TOKEN }}
  54. jobs:
  55. integration-trusted:
  56. runs-on: ubuntu-latest
  57. permissions:
  58. id-token: write
  59. checks: write
  60. contents: read
  61. if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor !='dependabot[bot]'
  62. steps:
  63. - name: Branch based PR checkout
  64. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  65. - name: Fetch History
  66. run: git fetch --prune --unshallow
  67. - uses: ./.github/actions/e2e
  68. # Repo owner has commented /ok-to-test on a (fork-based) pull request
  69. integration-fork:
  70. runs-on: ubuntu-latest
  71. permissions:
  72. id-token: write
  73. checks: write
  74. contents: read
  75. pull-requests: write
  76. if: github.event_name == 'repository_dispatch'
  77. steps:
  78. # Check out merge commit
  79. - name: Fork based /ok-to-test checkout
  80. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  81. with:
  82. ref: '${{ env.TARGET_SHA }}'
  83. - name: Fetch History
  84. run: git fetch --prune --unshallow
  85. - id: e2e
  86. uses: ./.github/actions/e2e
  87. - id: create_token
  88. uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
  89. with:
  90. app_id: ${{ secrets.APP_ID }}
  91. private_key: ${{ secrets.PRIVATE_KEY }}
  92. # Update check run called "integration-fork"
  93. - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
  94. id: update-check-run
  95. if: ${{ always() }}
  96. env:
  97. number: ${{ github.event.client_payload.pull_request.number }}
  98. job: ${{ github.job }}
  99. # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
  100. conclusion: ${{ job.status }}
  101. with:
  102. github-token: ${{ secrets.GITHUB_TOKEN }}
  103. script: |
  104. const { data: pull } = await github.rest.pulls.get({
  105. ...context.repo,
  106. pull_number: process.env.number
  107. });
  108. const ref = pull.head.sha;
  109. console.log("\n\nPR sha: " + ref)
  110. const { data: checks } = await github.rest.checks.listForRef({
  111. ...context.repo,
  112. ref
  113. });
  114. console.log("\n\nPR CHECKS: " + checks)
  115. const check = checks.check_runs.filter(c => c.name === process.env.job);
  116. console.log("\n\nPR Filtered CHECK: " + check)
  117. console.log(check)
  118. const { data: result } = await github.rest.checks.update({
  119. ...context.repo,
  120. check_run_id: check[0].id,
  121. status: 'completed',
  122. conclusion: process.env.conclusion
  123. });
  124. return result;
  125. - name: Update on Succeess
  126. if: always() && steps.e2e.conclusion == 'success'
  127. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  128. with:
  129. token: ${{ steps.create_token.outputs.token }}
  130. issue-number: ${{ github.event.client_payload.pull_request.number }}
  131. body: |
  132. [Bot] - :white_check_mark: [e2e for ${{ env.TARGET_SHA }} passed](https://github.com/external-secrets/external-secrets/actions/runs/${{ github.run_id }})
  133. - name: Update on Failure
  134. if: always() && steps.e2e.conclusion != 'success'
  135. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  136. with:
  137. token: ${{ steps.create_token.outputs.token }}
  138. issue-number: ${{ github.event.client_payload.pull_request.number }}
  139. body: |
  140. [Bot] - :x: [e2e for ${{ env.TARGET_SHA }} failed](https://github.com/external-secrets/external-secrets/actions/runs/${{ github.run_id }})