-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(operator): add release workflow
- Loading branch information
Showing
10 changed files
with
431 additions
and
65 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Setup Minikube | ||
description: Setup Minikube | ||
inputs: | ||
github_token: | ||
description: GitHub token | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
|
||
- name: Enable port-forwarding | ||
shell: bash | ||
run: | | ||
sudo apt-get -y install socat | ||
- name: Setup Minikube | ||
uses: manusa/[email protected] | ||
with: | ||
'minikube version': v1.33.1 | ||
'kubernetes version': v1.25.0 | ||
'github token': ${{ inputs.github_token }} | ||
'start args': --force | ||
|
||
- name: Enable Minikube features | ||
shell: bash | ||
run: | | ||
minikube addons enable ingress | ||
minikube addons enable olm | ||
- name: Setup Minikube tunnel | ||
shell: bash | ||
run: | | ||
minikube tunnel & |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,12 @@ on: | |
branches: | ||
- main | ||
paths: | ||
- 'operator/**' | ||
|
||
- operator/** | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'operator/**' | ||
- operator/** | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
@@ -32,10 +31,9 @@ jobs: | |
# deploys it with `imagePullPolicy: Always`; and also the operator image itself for the same reason. | ||
- name: Configure env. variables 2 | ||
run: | | ||
echo "IMAGE=ttl.sh/apicurio-registry-operator-$UUID:8h" >> $GITHUB_ENV | ||
echo "BUNDLE_IMAGE=ttl.sh/apicurio-registry-operator-bundle-$UUID:8h" >> $GITHUB_ENV | ||
echo "CATALOG_IMAGE=ttl.sh/apicurio-registry-operator-catalog-$UUID:8h" >> $GITHUB_ENV | ||
echo "ADDITIONAL_CATALOG_IMAGE=" >> $GITHUB_ENV | ||
echo "IMAGE=ttl.sh/apicurio-registry-3-operator-$UUID:8h" >> $GITHUB_ENV | ||
echo "BUNDLE_IMAGE=ttl.sh/apicurio-registry-3-operator-bundle-$UUID:8h" >> $GITHUB_ENV | ||
echo "CATALOG_IMAGE=ttl.sh/apicurio-registry-3-operator-catalog-$UUID:8h" >> $GITHUB_ENV | ||
- name: Checkout ${{ github.ref }} | ||
uses: actions/checkout@v4 | ||
|
@@ -47,31 +45,24 @@ jobs: | |
distribution: temurin | ||
cache: maven | ||
|
||
- name: Enable port-forwarding | ||
run: | | ||
sudo apt-get -y install socat | ||
- name: Setup Minikube | ||
uses: manusa/[email protected] | ||
- uses: ./.github/workflows/composite/setup-minikube | ||
with: | ||
'minikube version': v1.33.1 | ||
'kubernetes version': v1.25.0 | ||
'github token': ${{ secrets.GITHUB_TOKEN }} | ||
'start args': '--force' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Enable minikube features | ||
run: | | ||
minikube addons enable ingress | ||
minikube addons enable olm | ||
- name: Setup minikube tunnel | ||
- name: Build only | ||
if: github.event_name != 'push' | ||
working-directory: operator | ||
run: | | ||
minikube tunnel & | ||
make BUILD_OPTS=--no-transfer-progress SKIP_TESTS=true build | ||
- 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 | ||
make BUILD_OPTS=--no-transfer-progress build | ||
- name: Build temporary operator image | ||
working-directory: operator | ||
|
@@ -91,13 +82,13 @@ jobs: | |
- name: Run remote and OLM tests on Minikube | ||
working-directory: operator | ||
run: | | ||
make BUILD_OPTS="--no-transfer-progress" remote-tests-all | ||
make BUILD_OPTS=--no-transfer-progress remote-tests-all | ||
- name: Update install file | ||
working-directory: operator | ||
run: | | ||
# We need to remove unset the variables to generate a clean install file. | ||
# See https://stackoverflow.com/questions/70137245/how-to-remove-an-environment-variable-on-github-actions | ||
# See https://github.com/actions/runner/issues/1126 | ||
unset IMAGE | ||
unset BUNDLE_IMAGE | ||
unset CATALOG_IMAGE | ||
|
@@ -110,7 +101,7 @@ jobs: | |
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."; | ||
echo "No changes to the install file."; | ||
fi | ||
operator-publish: | ||
|
@@ -120,11 +111,12 @@ jobs: | |
if: github.event_name == 'push' | ||
steps: | ||
|
||
# Do not publish (version)-snapshot tag, instead use `latest-snapshot`. | ||
- 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 | ||
|
@@ -139,13 +131,14 @@ jobs: | |
- name: Build | ||
working-directory: operator | ||
run: | | ||
make BUILD_OPTS="--no-transfer-progress" SKIP_TESTS=true build | ||
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 | ||
- name: Build and publish operator image # TODO: Also push to DockerHub Registry | ||
# TODO: Also push to DockerHub Registry | ||
- name: Build and publish operator image | ||
working-directory: operator | ||
run: | | ||
make image-build image-push | ||
|
@@ -154,3 +147,26 @@ jobs: | |
working-directory: operator | ||
run: | | ||
make bundle | ||
- name: Build and publish operator catalog | ||
working-directory: operator | ||
run: | | ||
make catalog | ||
- name: Slack Notification (Always) | ||
if: always() | ||
run: | | ||
MESSAGE="'${{ github.workflow }}/${{ github.job }}' job completed with status: ${{ job.status }}" | ||
REPO="${{ github.repository }}" | ||
LINK="https://github.com/$REPO/actions/runs/${{ github.run_id }}" | ||
PAYLOAD="{\"workflow\": \"${{ github.workflow }}\", \"status\": \"${{ job.status }}\", \"message\": \"$MESSAGE\", \"link\": \"$LINK\", \"repository\": \"$REPO\"}" | ||
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}" | ||
- name: Slack Notification (Error) | ||
if: failure() | ||
run: | | ||
MESSAGE="'${{ github.workflow }}/${{ github.job }}' job FAILED!" | ||
REPO="${{ github.repository }}" | ||
LINK="https://github.com/$REPO/actions/runs/${{ github.run_id }}" | ||
PAYLOAD="{\"workflow\": \"${{ github.workflow }}\", \"status\": \"${{ job.status }}\", \"message\": \"$MESSAGE\", \"link\": \"$LINK\", \"repository\": \"$REPO\"}" | ||
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "${{ secrets.SLACK_ERROR_WEBHOOK }}" |
Oops, something went wrong.