From 9765f84657a081a427c83edf07ec0e6df35f2766 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 10 Apr 2024 13:36:19 +0300 Subject: [PATCH] Add e2e tests Signed-off-by: Stefan Prodan --- .github/workflows/e2e.yaml | 43 +++++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 23 ++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/e2e.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml new file mode 100644 index 0000000..096c5d8 --- /dev/null +++ b/.github/workflows/e2e.yaml @@ -0,0 +1,43 @@ +name: e2e + +on: + workflow_dispatch: + push: + branches: [ '*' ] + tags-ignore: [ '*' ] + +jobs: + kubernetes: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Flux + uses: fluxcd/flux2/action@main + - name: Setup cluster fleet + run: make fleet-up + - name: Install Flux on the hub cluster + run: flux --context=kind-flux-hub install + - name: Setup cluster reconciliation + run: | + flux create source git flux-system \ + --url=${{ github.event.repository.html_url }} \ + --branch=${GITHUB_REF#refs/heads/} \ + --username=${GITHUB_ACTOR} \ + --password=${{ secrets.GITHUB_TOKEN }} \ + --ignore-paths="hub/flux-system/" + flux create kustomization flux-system \ + --source=flux-system \ + --path="./hub" + - name: Verify clusters reconciliation + run: | + kubectl -n staging wait kustomization/apps --for=condition=ready --timeout=5m + kubectl -n production wait kustomization/apps --for=condition=ready --timeout=5m + - name: Debug failure + if: failure() + run: | + kubectl -n flux-system get all + kubectl -n flux-system logs deploy/source-controller + kubectl -n flux-system logs deploy/kustomize-controller + kubectl -n flux-system logs deploy/helm-controller + flux get all --all-namespaces diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..9191f48 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,23 @@ +name: test + +on: + workflow_dispatch: + pull_request: + push: + branches: [ '*' ] + tags-ignore: [ '*' ] + +jobs: + manifests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup yq + uses: fluxcd/pkg/actions/yq@main + - name: Setup kubeconform + uses: fluxcd/pkg/actions/kubeconform@main + - name: Setup kustomize + uses: fluxcd/pkg/actions/kustomize@main + - name: Validate manifests + run: make validate