Skip to content

Add e2e test workflow #10

Add e2e test workflow

Add e2e test workflow #10

Workflow file for this run

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: ${{ secrets.QUAY_ORG}}
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@v4
with:
go-version: 1.19
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY}}
username: ${{ secrets.QUAY_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build Operator Bundle
run: |
# Pull the image from registry
while true
do
echo "Pulling image from Quay.io";
sleep 10
if docker 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 }} IMAGE_BUILDER=docker
- name: Push Operator Bundle Image
run: |
docker 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 --name=kind-cluster)"
kind get clusters
kubectl get nodes -o wide
- name: Load Image in KinD cluster
run: |
kind export kubeconfig --name kind-cluster
kind load docker-image quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} --name kind-cluster
docker exec -t kind-cluster-control-plane crictl images
- name: Deploy Operatorhub operator
id: deploy
run: |
echo Deploying Operatorhub operator
IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
OPERATOR_NAMESPACE=opendatahub-operator-system
make deploy -e IMG="${IMG}" OPERATOR_NAMESPACE="${OPERATOR_NAMESPACE}"
kubectl get pods --all-namespaces
kubectl wait -n $OPERATOR_NAMESPACE pods --for=condition=Available=true --timeout=180s
- name: Run e2e tests
run: |
make e2e-test OPERATOR_NAMESPACE=opendatahub-operator-system
- name: Clean up KinD cluster
run: |
kind delete cluster --name kind-cluster