From fff0e4f7c730da5a28e5c5d539c9e434b6ae8e81 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Fri, 8 Mar 2024 16:21:27 +0000 Subject: [PATCH] e2e: Add ci-e2e GH workflow --- .github/workflows/ci-e2e.yaml | 70 +++++++++++++++++++ README.md | 4 +- .../gcp/gcp-credentials.env.template | 2 +- make/managedzones.mk | 2 +- 4 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci-e2e.yaml diff --git a/.github/workflows/ci-e2e.yaml b/.github/workflows/ci-e2e.yaml new file mode 100644 index 00000000..7841ea27 --- /dev/null +++ b/.github/workflows/ci-e2e.yaml @@ -0,0 +1,70 @@ +name: CI-E2E + +on: + push: + branches: + - main + - "release-*" + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + paths-ignore: + - '**.adoc' + - '**.md' + - 'samples/**' + - 'LICENSE' + pull_request_target: + branches: + - main + - "release-*" + paths-ignore: + - '**.adoc' + - '**.md' + - 'samples/**' + - 'LICENSE' + workflow_dispatch: + +env: + TEST_NAMESPACE: e2e-test + +jobs: + e2e_test_suite: + name: E2E Test Suite + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + - uses: actions/setup-go@v5 + with: + go-version: v1.21.x + cache: false + - name: Create AWS provider configuration + run: | + make local-setup-aws-mz-clean local-setup-aws-mz-generate AWS_ZONE_ROOT_DOMAIN=e2e.hcpapps.net AWS_DNS_PUBLIC_ZONE_ID=Z086929132US3PB46EOLR AWS_ACCESS_KEY_ID=${{ secrets.E2E_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY=${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }} + - name: Create GCP provider configuration + run: | + make local-setup-gcp-mz-clean local-setup-gcp-mz-generate GCP_ZONE_NAME=e2e-google-hcpapps-net GCP_ZONE_DNS_NAME=e2e.google.hcpapps.net GCP_GOOGLE_CREDENTIALS='${{ secrets.E2E_GCP_GOOGLE_CREDENTIALS }}' GCP_PROJECT_ID=${{ secrets.E2E_GCP_PROJECT_ID }} + - name: Setup environment + run: | + make local-setup DEPLOY=true TEST_NAMESPACE=${{ env.TEST_NAMESPACE }} + kubectl -n ${{ env.TEST_NAMESPACE }} wait --timeout=60s --for=condition=Ready managedzone/dev-mz-aws + kubectl -n ${{ env.TEST_NAMESPACE }} wait --timeout=60s --for=condition=Ready managedzone/dev-mz-gcp + - name: Run suite AWS + run: | + export TEST_DNS_MANAGED_ZONE_NAME=dev-mz-aws + export TEST_DNS_ZONE_DOMAIN_NAME=e2e.hcpapps.net + export TEST_DNS_NAMESPACE=${{ env.TEST_NAMESPACE }} + export TEST_DNS_PROVIDER=aws + make test-e2e + - name: Run suite GCP + run: | + export TEST_DNS_MANAGED_ZONE_NAME=dev-mz-gcp + export TEST_DNS_ZONE_DOMAIN_NAME=e2e.google.hcpapps.net + export TEST_DNS_NAMESPACE=${{ env.TEST_NAMESPACE }} + export TEST_DNS_PROVIDER=gcp + make test-e2e + - name: Dump Controller logs + if: ${{ failure() }} + run: | + kubectl get deployments -A + kubectl logs --all-containers --ignore-errors deployments/dns-operator-controller-manager -n dns-operator-system diff --git a/README.md b/README.md index 743d0cc1..b35e6b5b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ More details about the AWS provider can be found [here](./docs/provider.md#aws-r ##### GCP Provider ```bash -make local-setup-gcp-mz-clean local-setup-gcp-mz-generate GCP_ZONE_NAME= GCP_ZONE_DNS_NAME= GCP_GOOGLE='' GCP_PROJECT_ID= +make local-setup-gcp-mz-clean local-setup-gcp-mz-generate GCP_ZONE_NAME= GCP_ZONE_DNS_NAME= GCP_GOOGLE_CREDENTIALS='' GCP_PROJECT_ID= ``` More details about the GCP provider can be found [here](./docs/provider.md#google-cloud-dns-provider) @@ -78,7 +78,7 @@ make test-e2e TEST_DNS_MANAGED_ZONE_NAME= TEST_DNS_ZONE_DO |----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | TEST_DNS_MANAGED_ZONE_NAME | Name of the managed zone relevant for the test domain (TEST_DNS_ZONE_DOMAIN_NAME). If using local-setup Managed zones, one of [dev-mz-aws; dev-mz-gcp] | | TEST_DNS_ZONE_DOMAIN_NAME | Domain name being used for the test, must match the domain of the managed zone (TEST_DNS_MANAGED_ZONE_NAME) | -| TEST_DNS_NAMESPACE | The namesapce to run the test in, must be the same namesapce as the TEST_DNS_MANAGED_ZONE_NAME | +| TEST_DNS_NAMESPACE | The namespace to run the test in, must be the same namespace as the TEST_DNS_MANAGED_ZONE_NAME | | TEST_DNS_PROVIDER | DNS Provider currently being tested, one of [aws; gcp] | ### Modifying the API definitions diff --git a/config/local-setup/managedzone/gcp/gcp-credentials.env.template b/config/local-setup/managedzone/gcp/gcp-credentials.env.template index 3a29ad7f..dd1822ec 100644 --- a/config/local-setup/managedzone/gcp/gcp-credentials.env.template +++ b/config/local-setup/managedzone/gcp/gcp-credentials.env.template @@ -1,2 +1,2 @@ -GOOGLE=${GCP_GOOGLE} +GOOGLE=${GCP_GOOGLE_CREDENTIALS} PROJECT_ID=${GCP_PROJECT_ID} diff --git a/make/managedzones.mk b/make/managedzones.mk index 0b08be4c..91d9d49f 100644 --- a/make/managedzones.mk +++ b/make/managedzones.mk @@ -56,7 +56,7 @@ $(LOCAL_SETUP_GCP_MZ_CONFIG): .PHONY: local-setup-gcp-mz-credentials local-setup-gcp-mz-credentials: $(LOCAL_SETUP_GCP_MZ_CREDS) $(LOCAL_SETUP_GCP_MZ_CREDS): - $(call ndef,GCP_GOOGLE) + $(call ndef,GCP_GOOGLE_CREDENTIALS) $(call ndef,GCP_PROJECT_ID) $(call patch-config,${LOCAL_SETUP_GCP_MZ_CREDS}.template,${LOCAL_SETUP_GCP_MZ_CREDS})