Add Github Workflows to Automate Build and Run e2e tests on kind cluster #3
Workflow file for this run
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: e2e Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
- "incubation" | |
paths-ignore: | |
- 'docs/**' | |
- '**.adoc' | |
- '**.md' | |
- 'LICENSE' | |
push: | |
branches: | |
- main | |
- "incubation" | |
paths-ignore: | |
- 'docs/**' | |
- '**.adoc' | |
- '**.md' | |
- 'LICENSE' | |
concurrency: | |
group: ${{ github.head_ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
QUAY_ORG: opendatahub | |
IMAGE_REGISTRY: quay.io | |
BUNDLE_IMAGE_NAME: opendatahub-operator-bundle | |
IMAGE_NAME: opendatahub-operator | |
IMAGE_TAG: pr-${{ github.event.pull_request.number }} | |
jobs: | |
kubernetes-e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Build Operator Bundle | |
run: | | |
# Pull the image from registry | |
while true | |
do | |
echo "Pulling image from Quay.io"; | |
sleep 10 | |
if podman pull quay.io/${{ env.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
then | |
break | |
fi | |
done | |
# Build operator bundle image | |
make bundle-build -e BUNDLE_IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} \ | |
-e IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
- name: Log to Quay.io | |
uses: redhat-actions/podman-login@v1 | |
with: | |
username: ${{ secrets.QUAY_ID }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
registry: ${{ env.IMAGE_REGISTRY}} | |
- name: Push Operator Bundle Image | |
run: | | |
podman push quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
- name: Setup and start KinD cluster | |
uses: ./.github/actions/kind | |
- name: Verify KinD | |
run: | | |
export KUBECONFIG="$(kind get kubeconfig-path --name="kind-cluster")" | |
kind get clusters | |
kubectl get nodes -o wide | |
- name: Load Image in KinD cluster | |
run: | | |
podman save docker.io/kindest/node:v1.28.0 -o quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
kind load image-archive quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} --name kind-cluster | |
- name: Deploy Operatorhub operator | |
id: deploy | |
run: | | |
echo Deploying Operatorhub operator | |
IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
make deploy -e IMG="${IMG}" | |
kubectl wait --timeout=120s --for=condition=Available=true deployment -n opendatahub-operator-system | |
kubectl get nodes -o wide | |
kubectl get pods --all-namesapces | |
kubectl get services --all-namesapces -o wide | |
- name: Run e2e tests | |
run: | | |
make e2e-test | |
- name: Clean up KinD cluster | |
run: | | |
kind delete cluster --name kind-cluster |