From d620c2f0124a26bfae14708f336ab410c871f7d4 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Sat, 3 Feb 2024 13:00:03 +0200 Subject: [PATCH] Run tests for feature branches Signed-off-by: Stefan Prodan --- .github/workflows/x-test.yaml | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/x-test.yaml diff --git a/.github/workflows/x-test.yaml b/.github/workflows/x-test.yaml new file mode 100644 index 0000000..e491263 --- /dev/null +++ b/.github/workflows/x-test.yaml @@ -0,0 +1,77 @@ +name: x-test + +on: + workflow_dispatch: + push: + branches: + - '*' + branches-ignore: + - main + tags-ignore: + - '*' + +permissions: + contents: read + +jobs: + kind: + strategy: + fail-fast: false + matrix: + variant: + - distroless + kubernetes: + - v1.29.0 + flux: + - v2.2 + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Setup Flux + uses: fluxcd/flux2/action@5c5c15ea212b8f029a110f9975851d25c8272695 #v2.2.2 + - name: Setup Kubernetes + uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0 + with: + cluster_name: flux + node_image: kindest/node:${{ matrix.kubernetes }} + - name: Install Flux + run: | + kubectl create ns flux-system + + flux create secret oci flux-enterprise-auth \ + --url=ghcr.io \ + --username=${{ github.actor }} \ + --password=${{ secrets.GHCR_READONLY }} + + flux install \ + --components-extra="image-reflector-controller,image-automation-controller" \ + --registry=ghcr.io/controlplaneio-fluxcd/${{ matrix.variant }} \ + --image-pull-secret=flux-enterprise-auth + - name: Verify images + run: kubectl -n flux-system get deployments.apps -o yaml | grep ${{ matrix.variant }} + - name: Setup cluster reconciliation + run: | + flux create source git flux-system \ + --url=${{ github.event.repository.html_url }} \ + --branch=${{ github.ref_name }} \ + --username=${GITHUB_ACTOR} \ + --password=${{ secrets.GITHUB_TOKEN }} \ + --ignore-paths="clusters/**/flux-system/" + flux create kustomization flux-system \ + --source=flux-system \ + --path=./tests/${{ matrix.flux }}/clusters/kind + - name: Verify cluster reconciliation + run: | + kubectl -n flux-system wait kustomization/sources --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