Add e2e test workflow #11
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: ${{ 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 }} | |
OPERATOR_NAMESPACE: opendatahub-operator-system | |
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: Pull operator image from registry | |
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=${{env.IMAGE_BUILDER}} | |
- name: Setup and start KinD cluster | |
uses: ./.github/actions/kind | |
- name: Verify KinD | |
run: | | |
kind get clusters | |
kubectl get nodes -o wide | |
- name: Load Image in KinD cluster | |
run: | | |
kind load docker-image quay.io/${{ env.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --name kind-cluster | |
docker exec -t kind-cluster-control-plane crictl images | |
- name: Create Namespace for ODHO | |
run: | | |
kubectl create namespace ${{env.OPERATOR_NAMESPACE}} | |
kubectl config set-context --current --namespace=$${{env.OPERATOR_NAMESPACE}} | |
- name: Deploy Operatorhub operator | |
id: deploy | |
run: | | |
echo Deploying Operatorhub operator | |
IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
kubectl config use-context kind-kind-cluster | |
make deploy -e IMG=$IMG OPERATOR_NAMESPACE=${{env.OPERATOR_NAMESPACE}} IMAGE_BUILDER=${{env.IMAGE_BUILDER}} | |
- name: Wait for ODHO deployment | |
run: | | |
echo "Get pods" | |
kubectl get pods -A | |
echo "Log describe" | |
kubectl describe pods -n ${{env.OPERATOR_NAMESPACE}} | |
echo "Get replicasets" | |
kubectl get replicasets -n ${{env.OPERATOR_NAMESPACE}} | |
echo "Get events" | |
kubectl get events -n ${{env.OPERATOR_NAMESPACE}} | |
kubectl wait -n ${{ env.OPERATOR_NAMESPACE}} --timeout=5m --for=condition=Available=true deployment opendatahub-operator-controller-manager | |
- name: Run e2e tests | |
run: | | |
make e2e-test OPERATOR_NAMESPACE=${{env.OPERATOR_NAMESPACE}} | |
- name: Clean up KinD cluster | |
run: | | |
kind delete cluster --name kind-cluster |