Skip to content

chore: small update to the CSV template #4542

chore: small update to the CSV template

chore: small update to the CSV template #4542

Workflow file for this run

name: Operator Test Workflow
on:
push:
branches:
- main
paths:
- operator/**
pull_request:
branches:
- main
paths:
- operator/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
operator-build-test:
name: Build and Test Operator
runs-on: ubuntu-latest
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
# We need tho push the bundle image because opm always pulls; the catalog image because OLM
# deploys it with `imagePullPolicy: Always`; and also the operator image itself for the same reason.
- name: Configure env. variables
run: |
echo "REGISTRY_APP_IMAGE=ttl.sh/apicurio-registry-${{ github.sha }}:8h" >> $GITHUB_ENV
echo "IMAGE=ttl.sh/apicurio-registry-3-operator-${{ github.sha }}:8h" >> $GITHUB_ENV
echo "BUNDLE_IMAGE=ttl.sh/apicurio-registry-3-operator-bundle-${{ github.sha }}:8h" >> $GITHUB_ENV
echo "CATALOG_IMAGE=ttl.sh/apicurio-registry-3-operator-catalog-${{ github.sha }}:8h" >> $GITHUB_ENV
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: temurin
cache: maven
# We need to build the operand image as well as the operator, otherwise the tests would not reflect changes in the current PR.
- name: Build
run: mvn -B clean package -pl app,distro/docker,operator/olm-tests -am -Pprod -DskipTests -Dmaven.javadoc.skip
- name: Build temporary operand image
run: |
docker build -f ./distro/docker/target/docker/Dockerfile.jvm -t "$REGISTRY_APP_IMAGE" ./distro/docker/target/docker
- uses: apicurio/apicurio-github-actions/setup-minikube@v2
with:
# Do not use the "docker" driver, it is causing port-forwarding errors. I have no clue why :(
# TODO: I might've been wrong, check this again later.
driver: 'none'
ingress-enable: 'true'
olm-enable: 'true'
olm-v1-enable: 'true'
start-args: '--alsologtostderr --v=2' # Debug
- name: Build and run local tests on Minikube
# Speed up the PR check by running both local and remote tests on push to main,
# and only run remote tests against a PR.
# TODO: Is this ok?
if: github.event_name == 'push'
working-directory: operator
run: |
make BUILD_OPTS=--no-transfer-progress build
- name: Build temporary operator image
working-directory: operator
run: |
make image-build image-push
- name: Build temporary operator bundle
working-directory: operator
run: |
make bundle
- name: Build temporary operator catalog
working-directory: operator
run: |
make catalog
- name: Run remote and OLM v1 tests on Minikube
working-directory: operator
run: |
make BUILD_OPTS="--no-transfer-progress -Dtest.operator.olm-version=1" test-remote-all
- name: Run OLM v0 smoke tests on Minikube
working-directory: operator
run: |
make BUILD_OPTS="--no-transfer-progress -Dgroups=OLM" test-remote-all
- name: Update install file
working-directory: operator
run: |
# We need to remove unset the variables to generate a clean install file.
# See https://github.com/actions/runner/issues/1126
unset REGISTRY_APP_IMAGE
unset IMAGE
unset BUNDLE_IMAGE
unset CATALOG_IMAGE
make IMAGE_TAG=latest-snapshot INSTALL_FILE=install/install.yaml dist-install-file
- name: Check install file
run: |
git add operator/install/install.yaml || true
if ! git diff --staged --exit-code; then
echo 'Install file needs to be updated. Please run "cd operator; make SKIP_TESTS=true build IMAGE_TAG=latest-snapshot INSTALL_FILE=install/install.yaml dist-install-file" and commit the result.';
exit 1;
else
echo "No changes to the install file.";
fi
# Uncomment if you need to debug the tests:
# - name: Install debug tools on failure
# if: failure()
# run: |
# NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# echo >> /home/runner/.bashrc
# echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bashrc
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# brew install derailed/k9s/k9s
# . ~/.bashrc
# # Run tests e.g.:
# # make BUILD_OPTS=--no-transfer-progress test-remote-all &> 1.log &
# # tail -f 1.log
#
# - name: Setup tmate session on failure
# if: failure()
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
operator-publish:
name: Publish Operator
runs-on: ubuntu-latest
needs: operator-build-test
if: github.event_name == 'push'
steps:
- name: Configure env. variables
run: |
# We want to use latest-snapshot instead of x.y.z-snapshot
echo "IMAGE_TAG=latest-snapshot" >> $GITHUB_ENV
echo "BUNDLE_IMAGE_TAG=latest-snapshot" >> $GITHUB_ENV
echo "CATALOG_IMAGE_TAG=latest-snapshot" >> $GITHUB_ENV
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: temurin
cache: maven
- name: Build
working-directory: operator
run: |
make BUILD_OPTS=--no-transfer-progress SKIP_TESTS=true build
- name: Login to quay.io registry
run: |
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
# TODO: Also push to DockerHub Registry
- name: Build and publish operator image
working-directory: operator
run: |
make image-build image-push
- name: Build and publish operator bundle
working-directory: operator
run: |
make bundle
- name: Build and publish operator catalog
working-directory: operator
run: |
make catalog
# Slack notification using reusable workflow
notify-slack:
name: Slack Notification
needs: operator-publish
if: always()
uses: ./.github/workflows/reusable-notify-slack.yaml
with:
workflow-name: ${{ github.workflow }}
job-name: 'operator-publish'
job-status: ${{ needs.operator-publish.result }}
secrets:
SLACK_NOTIFICATION_WEBHOOK: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
SLACK_ERROR_WEBHOOK: ${{ secrets.SLACK_ERROR_WEBHOOK }}