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. pull-requests: write
  10. checks: write
  11. statuses: read
  12. name: e2e tests
  13. env:
  14. # Common versions
  15. GO_VERSION: '1.21'
  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. jobs:
  53. integration-trusted:
  54. runs-on: ubuntu-latest
  55. permissions:
  56. id-token: write
  57. checks: write
  58. contents: read
  59. if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor !='dependabot[bot]'
  60. steps:
  61. - name: Branch based PR checkout
  62. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  63. - name: Fetch History
  64. run: git fetch --prune --unshallow
  65. - uses: ./.github/actions/e2e
  66. # Repo owner has commented /ok-to-test on a (fork-based) pull request
  67. integration-fork:
  68. runs-on: ubuntu-latest
  69. permissions:
  70. id-token: write
  71. checks: write
  72. contents: read
  73. if: github.event_name == 'repository_dispatch'
  74. steps:
  75. # Check out merge commit
  76. - name: Fork based /ok-to-test checkout
  77. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  78. with:
  79. ref: '${{ env.TARGET_SHA }}'
  80. - name: Fetch History
  81. run: git fetch --prune --unshallow
  82. - id: e2e
  83. uses: ./.github/actions/e2e
  84. - id: create_token
  85. uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
  86. with:
  87. app_id: ${{ secrets.APP_ID }}
  88. private_key: ${{ secrets.PRIVATE_KEY }}
  89. # Update check run called "integration-fork"
  90. - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
  91. id: update-check-run
  92. if: ${{ always() }}
  93. env:
  94. number: ${{ github.event.client_payload.pull_request.number }}
  95. job: ${{ github.job }}
  96. # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
  97. conclusion: ${{ job.status }}
  98. with:
  99. github-token: ${{ secrets.GITHUB_TOKEN }}
  100. script: |
  101. const { data: pull } = await github.rest.pulls.get({
  102. ...context.repo,
  103. pull_number: process.env.number
  104. });
  105. const ref = pull.head.sha;
  106. console.log("\n\nPR sha: " + ref)
  107. const { data: checks } = await github.rest.checks.listForRef({
  108. ...context.repo,
  109. ref
  110. });
  111. console.log("\n\nPR CHECKS: " + checks)
  112. const check = checks.check_runs.filter(c => c.name === process.env.job);
  113. console.log("\n\nPR Filtered CHECK: " + check)
  114. console.log(check)
  115. const { data: result } = await github.rest.checks.update({
  116. ...context.repo,
  117. check_run_id: check[0].id,
  118. status: 'completed',
  119. conclusion: process.env.conclusion
  120. });
  121. return result;
  122. - name: Update on Succeess
  123. if: always() && steps.e2e.conclusion == 'success'
  124. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  125. with:
  126. token: ${{ steps.create_token.outputs.token }}
  127. issue-number: ${{ github.event.client_payload.pull_request.number }}
  128. body: |
  129. [Bot] - :white_check_mark: [e2e for ${{ env.TARGET_SHA }} passed](https://github.com/external-secrets/external-secrets/actions/runs/${{ github.run_id }})
  130. - name: Update on Failure
  131. if: always() && steps.e2e.conclusion != 'success'
  132. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  133. with:
  134. token: ${{ steps.create_token.outputs.token }}
  135. issue-number: ${{ github.event.client_payload.pull_request.number }}
  136. body: |
  137. [Bot] - :x: [e2e for ${{ env.TARGET_SHA }} failed](https://github.com/external-secrets/external-secrets/actions/runs/${{ github.run_id }})