diff --git a/.github/workflows/deploy-test.yaml b/.github/workflows/deploy-test.yaml new file mode 100644 index 00000000000..285931ad22c --- /dev/null +++ b/.github/workflows/deploy-test.yaml @@ -0,0 +1,57 @@ +name: Build, Deploy and Test on kind + +on: + pull_request: + branches: + - '*' + +env: + IMG: gitops-operator:test + +jobs: + deploy-test: + name: Build image, deploy to kind cluster and run tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + + - name: Setup Go + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 + with: + go-version-file: 'go.mod' + + - name: Create kind cluster + uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1 + with: + cluster_name: gitops-test + + - name: Disable webhook and prometheus for non-OCP cluster + run: | + sed -i 's|^- ../webhook|#- ../webhook|' config/default/kustomization.yaml + sed -i 's|^- manager_webhook_patch.yaml|#- manager_webhook_patch.yaml|' config/default/kustomization.yaml + sed -i 's|^- ../prometheus|#- ../prometheus|' config/default/kustomization.yaml + + - name: Build manager image + run: | + make docker-build IMG=${{ env.IMG }} + + - name: Load image into kind + run: | + kind load docker-image ${{ env.IMG }} --name gitops-test + + - name: Install CRDs + run: | + make install + + - name: Deploy operator + run: | + make deploy IMG=${{ env.IMG }} + + - name: Verify Controller Manager deployment is available + run: | + kubectl get deployment -n openshift-gitops-operator + kubectl describe deployment -n openshift-gitops-operator + kubectl wait --for=condition=available --timeout=120s \ + deployment/openshift-gitops-operator-controller-manager \ + -n openshift-gitops-operator diff --git a/config/default/manager_webhook_patch.yaml b/config/default/manager_webhook_patch.yaml index 738de350b71..8b4e4aa8d77 100644 --- a/config/default/manager_webhook_patch.yaml +++ b/config/default/manager_webhook_patch.yaml @@ -21,3 +21,4 @@ spec: secret: defaultMode: 420 secretName: webhook-server-cert + optional: true