This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
Note that the repo is archived #346
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OLM-Tests | |
on: | |
push: | |
branches: | |
- main | |
- v[0-9]+.[0-9]+ | |
pull_request: | |
branches: | |
- main | |
- v[0-9]+.[0-9]+ | |
jobs: | |
main: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for all tags and branches | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Download binaries | |
run: | | |
make download-binaries | |
- name: Verify bundle | |
run: | | |
make bundle | |
git diff --exit-code | |
- name: Create and set up K8s KinD Cluster | |
run: | | |
make test-cluster | |
- name: Build and Push Test Container Image and Bundle/Bundle Index Images | |
run: | | |
# TODO: Use operator-sdk run bundle and bundle-upgrade commands for | |
# testing with OLM. | |
OPERATOR_VERSION=$(awk '/^VERSION \?=/ {print $3}' Makefile) | |
REPO=localhost:5000 | |
IMG=${REPO}/gatekeeper-operator:${GITHUB_SHA} | |
PREV_BUNDLE_INDEX_IMG=quay.io/gatekeeper/gatekeeper-operator-bundle-index:$(make get-replaces-version) | |
make build-and-push-bundle-images IMG=${IMG} REPO=${REPO} VERSION=${GITHUB_SHA} OPERATOR_VERSION=${OPERATOR_VERSION} | |
- name: Deploy OLM | |
run: | | |
make deploy-olm | |
- name: Deploy resources on KIND cluster to install Gatekeeper | |
run: | | |
make deploy-using-olm REPO=localhost:5000 VERSION=$GITHUB_SHA NAMESPACE=mygatekeeper | |
while ! kubectl -n mygatekeeper get deployment gatekeeper-operator-controller; do \ | |
echo "Waiting for operator deployment"; \ | |
sleep 2; \ | |
done | |
kubectl -n mygatekeeper wait deployment/gatekeeper-operator-controller --for condition=Available --timeout=90s | |
- name: E2E Tests | |
run: | | |
kubectl -n mygatekeeper logs deployment/gatekeeper-operator-controller -c manager -f > operator.log & | |
make test-e2e NAMESPACE=mygatekeeper | |
kubectl delete --wait namespace mygatekeeper | |
- name: Debug | |
if: ${{ failure() }} | |
run: | | |
echo "::group::Operator Logs" | |
cat operator.log | |
echo "::endgroup::" | |
echo "::group::Deployments" | |
kubectl -n mygatekeeper get deployments -o yaml | |
echo "::endgroup::" |