e2e.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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: write
  9. name: e2e tests
  10. env:
  11. # Common versions
  12. GO_VERSION: '1.21'
  13. GINKGO_VERSION: 'v2.8.0'
  14. DOCKER_BUILDX_VERSION: 'v0.4.2'
  15. KIND_VERSION: 'v0.17.0'
  16. KIND_IMAGE: 'kindest/node:v1.26.0'
  17. # Common users. We can't run a step 'if secrets.GHCR_USERNAME != ""' but we can run
  18. # a step 'if env.GHCR_USERNAME' != ""', so we copy these to succinctly test whether
  19. # credentials have been provided before trying to run steps that need them.
  20. TARGET_SHA: ${{ github.event.client_payload.slash_command.args.named.sha }}
  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. SECRETSERVER_USERNAME: ${{ secrets.SECRETSERVER_USERNAME }}
  45. SECRETSERVER_PASSWORD: ${{ secrets.SECRETSERVER_PASSWORD }}
  46. SECRETSERVER_URL: ${{ secrets.SECRETSERVER_URL }}
  47. jobs:
  48. integration-trusted:
  49. runs-on: ubuntu-latest
  50. permissions:
  51. id-token: write
  52. checks: write
  53. contents: read
  54. if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor !='dependabot[bot]'
  55. steps:
  56. - name: Branch based PR checkout
  57. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  58. - name: Fetch History
  59. run: git fetch --prune --unshallow
  60. - uses: ./.github/actions/e2e
  61. # Repo owner has commented /ok-to-test on a (fork-based) pull request
  62. integration-fork:
  63. runs-on: ubuntu-latest
  64. permissions:
  65. id-token: write
  66. checks: write
  67. contents: read
  68. if: github.event_name == 'repository_dispatch'
  69. steps:
  70. # Check out merge commit
  71. - name: Fork based /ok-to-test checkout
  72. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  73. with:
  74. ref: '${{ env.TARGET_SHA }}'
  75. - name: Fetch History
  76. run: git fetch --prune --unshallow
  77. - id: e2e
  78. uses: ./.github/actions/e2e
  79. # Update check run called "integration-fork"
  80. - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
  81. id: update-check-run
  82. if: ${{ always() }}
  83. env:
  84. number: ${{ github.event.client_payload.pull_request.number }}
  85. job: ${{ github.job }}
  86. # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
  87. conclusion: ${{ job.status }}
  88. with:
  89. github-token: ${{ secrets.GITHUB_TOKEN }}
  90. script: |
  91. const { data: pull } = await github.rest.pulls.get({
  92. ...context.repo,
  93. pull_number: process.env.number
  94. });
  95. const ref = pull.head.sha;
  96. console.log("\n\nPR sha: " + ref)
  97. const { data: checks } = await github.rest.checks.listForRef({
  98. ...context.repo,
  99. ref
  100. });
  101. console.log("\n\nPR CHECKS: " + checks)
  102. const check = checks.check_runs.filter(c => c.name === process.env.job);
  103. console.log("\n\nPR Filtered CHECK: " + check)
  104. console.log(check)
  105. const { data: result } = await github.rest.checks.update({
  106. ...context.repo,
  107. check_run_id: check[0].id,
  108. status: 'completed',
  109. conclusion: process.env.conclusion
  110. });
  111. return result;
  112. - name: Find Comment
  113. if: always()
  114. uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
  115. id: fc
  116. with:
  117. issue-number: ${{ github.event.client_payload.pull_request.number }}
  118. body-includes: /ok-to-test sha=${{ env.TARGET_SHA }}
  119. - name: Update on Succeess
  120. if: always() && steps.fc.outputs.comment-id != '' && steps.e2e.conclusion == 'success'
  121. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  122. with:
  123. issue-number: ${{ github.event.client_payload.pull_request.number }}
  124. body: |
  125. [Bot] - :white_check_mark: [e2e tests pass](https://github.com/external-secrets/external-secrets/actions/runs/${{ steps.update-check-run.outputs.result.id }})
  126. reactions: +1
  127. edit-mode: append
  128. - name: Update on Failure
  129. if: always() && steps.fc.outputs.comment-id != '' && steps.e2e.conclusion != 'success'
  130. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  131. with:
  132. issue-number: ${{ github.event.client_payload.pull_request.number }}
  133. body: |
  134. [Bot] - :x: [e2e tests failed](https://github.com/external-secrets/external-secrets/actions/runs/${{ steps.update-check-run.outputs.result.id }})
  135. reactions: -1
  136. edit-mode: append