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

151 lines
5.7 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:
contents: read
issues: write
pull-requests: write
checks: write
statuses: read
name: e2e tests
2021-06-13 13:28:52 +00:00
env:
# Common versions
GO_VERSION: '1.21'
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.
TARGET_SHA: ${{ github.event.client_payload.slash_command.args.named.sha }}
2021-06-13 13:28:52 +00:00
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 }}
TFC_AZURE_CLIENT_ID: ${{ secrets.TFC_AZURE_CLIENT_ID}}
TFC_AZURE_CLIENT_SECRET: ${{ secrets.TFC_AZURE_CLIENT_SECRET }}
TFC_AZURE_TENANT_ID: ${{ secrets.TFC_AZURE_TENANT_ID}}
TFC_AZURE_SUBSCRIPTION_ID: ${{ secrets.TFC_AZURE_SUBSCRIPTION_ID }}
TFC_VAULT_URL: ${{ secrets.TFC_VAULT_URL}}
Feature/scaleway provider (#2086) * wip: basic structure of scaleway provider Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * test: add some tests for GetAllSecrets Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: implement PushSecret Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * test: improved test fixtures Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: allow finding secrets by project using the path property Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: add delete secret method Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * Delete dupplicate of push remote ref test implem Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: add capability to use a secret for configuring access token Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: implement GetSecretMap Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: filtering by name and projetc id Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * test: add test for finding secret by name regexp Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: config validation Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * fix: handle situation where no namespace is specified and we cannot provide a default Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: reference secrets by id or name Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * fix: invalid request caused by pagination handling Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: log the error when failing to access secret version Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * fix: pass context to sdk where missing Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: add a cache for reducing AccessSecretVersion() calls Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * refacto: use GetSecret with name instead of ListSecrets Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: allow using secret name in ExternalSecrets Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: use latest_enabled instead of latest Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * refacto: optimized PushSecret and improved its test coverage Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * fix: doesConfigDependOnNamespace was always true Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: use new api with refactored name-based endpoints Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * remove useless todo Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * fix: use secret names as key for GetAllSecrets Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: support gjson propery lookup Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: e2e tests Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * test: e2e test using secret to store api key Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * test: cleanup left over resources on the secret manager before each e2e run Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * doc: add doc for scaleway provider Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * refacto: fix lint issues Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * test: cleanup code in e2e was commented Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: the previous version is disabled when we push to a secret Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * doc: add comments to ScalewayProvider struct to point to console and doc Signed-off-by: Julien Loctaux <no.mail@jloc.fr> * feat: add missing e2e env vars for scaleway Signed-off-by: Moritz Johner <beller.moritz@googlemail.com> * docs: add scaleway to support/stability table Signed-off-by: Moritz Johner <beller.moritz@googlemail.com> --------- Signed-off-by: Julien Loctaux <no.mail@jloc.fr> Signed-off-by: Moritz Johner <beller.moritz@googlemail.com> Co-authored-by: Moritz Johner <beller.moritz@googlemail.com>
2023-03-16 00:03:52 +00:00
SCALEWAY_API_URL: ${{ secrets.SCALEWAY_API_URL }}
SCALEWAY_REGION: ${{ secrets.SCALEWAY_REGION }}
SCALEWAY_PROJECT_ID: ${{ secrets.SCALEWAY_PROJECT_ID }}
SCALEWAY_ACCESS_KEY: ${{ secrets.SCALEWAY_ACCESS_KEY }}
SCALEWAY_SECRET_KEY: ${{ secrets.SCALEWAY_SECRET_KEY }}
DELINEA_TLD: ${{ secrets.DELINEA_TLD }}
DELINEA_URL_TEMPLATE: ${{ secrets.DELINEA_URL_TEMPLATE }}
DELINEA_TENANT: ${{ secrets.DELINEA_TENANT }}
DELINEA_CLIENT_ID: ${{ secrets.DELINEA_CLIENT_ID }}
DELINEA_CLIENT_SECRET: ${{ secrets.DELINEA_CLIENT_SECRET }}
SECRETSERVER_USERNAME: ${{ secrets.SECRETSERVER_USERNAME }}
SECRETSERVER_PASSWORD: ${{ secrets.SECRETSERVER_PASSWORD }}
SECRETSERVER_URL: ${{ secrets.SECRETSERVER_URL }}
2021-06-13 13:28:52 +00:00
jobs:
2021-06-13 13:28:52 +00:00
integration-trusted:
runs-on: ubuntu-latest
permissions:
id-token: write
checks: write
contents: read
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
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
permissions:
id-token: write
checks: write
contents: read
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
2021-06-13 13:28:52 +00:00
with:
ref: '${{ env.TARGET_SHA }}'
2021-06-13 13:28:52 +00:00
- name: Fetch History
run: git fetch --prune --unshallow
- id: e2e
uses: ./.github/actions/e2e
- id: create_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
2021-06-13 13:28:52 +00:00
# Update check run called "integration-fork"
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
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 }}
2021-06-13 13:28:52 +00:00
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;
- name: Update on Succeess
if: always() && steps.e2e.conclusion == 'success'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
token: ${{ steps.create_token.outputs.token }}
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
[Bot] - :white_check_mark: [e2e for ${{ env.TARGET_SHA }} passed](https://github.com/external-secrets/external-secrets/actions/runs/${{ github.run_id }})
- name: Update on Failure
if: always() && steps.e2e.conclusion != 'success'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
token: ${{ steps.create_token.outputs.token }}
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
[Bot] - :x: [e2e for ${{ env.TARGET_SHA }} failed](https://github.com/external-secrets/external-secrets/actions/runs/${{ github.run_id }})