1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00
external-secrets/.github/workflows/e2e.yml

106 lines
3.3 KiB
YAML
Raw Normal View History

2021-06-13 13:28:52 +00:00
# Run secret-dependent e2e tests only after /ok-to-test approval
on:
pull_request:
repository_dispatch:
types: [ok-to-test-command]
permissions:
id-token: write
checks: write
contents: read
name: e2e tests
2021-06-13 13:28:52 +00:00
env:
# Common versions
GO_VERSION: '1.19'
GINKGO_VERSION: 'v2.8.0'
2021-06-13 13:28:52 +00:00
DOCKER_BUILDX_VERSION: 'v0.4.2'
KIND_VERSION: 'v0.17.0'
KIND_IMAGE: 'kindest/node:v1.26.0'
2021-06-13 13:28:52 +00:00
# Common users. We can't run a step 'if secrets.GHCR_USERNAME != ""' but we can run
# a step 'if env.GHCR_USERNAME' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
2021-06-18 10:14:48 +00:00
GCP_SM_SA_JSON: ${{ secrets.GCP_SM_SA_JSON}}
2021-12-29 12:02:56 +00:00
GCP_GKE_ZONE: ${{ secrets.GCP_GKE_ZONE}}
GCP_GSA_NAME: ${{ secrets.GCP_GSA_NAME}} # Goolge Service Account
GCP_KSA_NAME: ${{ secrets.GCP_KSA_NAME}} # Kubernetes Service Account
2021-07-12 18:27:48 +00:00
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID}}
AWS_REGION: "eu-central-1"
AWS_OIDC_ROLE_ARN: ${{ secrets.AWS_OIDC_ROLE_ARN }}
2021-06-29 12:48:49 +00:00
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}}
TENANT_ID: ${{ secrets.TENANT_ID}}
VAULT_URL: ${{ secrets.VAULT_URL}}
2021-06-13 13:28:52 +00:00
jobs:
2021-06-13 13:28:52 +00:00
integration-trusted:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor !='dependabot[bot]'
2021-06-13 13:28:52 +00:00
steps:
- name: Branch based PR checkout
uses: actions/checkout@v3
2021-06-13 13:28:52 +00:00
- name: Fetch History
run: git fetch --prune --unshallow
- uses: ./.github/actions/e2e
2021-06-13 13:28:52 +00:00
# Repo owner has commented /ok-to-test on a (fork-based) pull request
integration-fork:
runs-on: ubuntu-latest
if: github.event_name == 'repository_dispatch'
2021-06-13 13:28:52 +00:00
steps:
# Check out merge commit
- name: Fork based /ok-to-test checkout
uses: actions/checkout@v3
2021-06-13 13:28:52 +00:00
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
- name: Fetch History
run: git fetch --prune --unshallow
- uses: ./.github/actions/e2e
2021-06-13 13:28:52 +00:00
# Update check run called "integration-fork"
- uses: actions/github-script@v6
2021-06-13 13:28:52 +00:00
id: update-check-run
if: ${{ always() }}
env:
number: ${{ github.event.client_payload.pull_request.number }}
job: ${{ github.job }}
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
2021-06-25 23:56:42 +00:00
conclusion: ${{ job.status }}
2021-06-13 13:28:52 +00:00
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pull } = await github.rest.pulls.get({
2021-06-13 13:28:52 +00:00
...context.repo,
pull_number: process.env.number
});
const ref = pull.head.sha;
2021-11-15 15:47:09 +00:00
console.log("\n\nPR sha: " + ref)
const { data: checks } = await github.rest.checks.listForRef({
2021-06-13 13:28:52 +00:00
...context.repo,
ref
});
2021-11-15 15:47:09 +00:00
console.log("\n\nPR CHECKS: " + checks)
2021-06-13 13:28:52 +00:00
const check = checks.check_runs.filter(c => c.name === process.env.job);
2021-11-15 15:47:09 +00:00
console.log("\n\nPR Filtered CHECK: " + check)
console.log(check)
const { data: result } = await github.rest.checks.update({
2021-06-13 13:28:52 +00:00
...context.repo,
2021-11-15 15:47:09 +00:00
check_run_id: check[0].id,
2021-06-13 13:28:52 +00:00
status: 'completed',
conclusion: process.env.conclusion
});
return result;