Skip to content

Commit c523f3a

Browse files
committed
feat(operator): add release workflow
1 parent 81d5202 commit c523f3a

File tree

10 files changed

+431
-65
lines changed

10 files changed

+431
-65
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Setup Minikube
2+
description: Setup Minikube
3+
inputs:
4+
github_token:
5+
description: GitHub token
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
12+
- name: Enable port-forwarding
13+
shell: bash
14+
run: |
15+
sudo apt-get -y install socat
16+
17+
- name: Setup Minikube
18+
uses: manusa/actions-setup-minikube@v2.13.0
19+
with:
20+
'minikube version': v1.33.1
21+
'kubernetes version': v1.25.0
22+
'github token': ${{ inputs.github_token }}
23+
'start args': --force
24+
25+
- name: Enable Minikube features
26+
shell: bash
27+
run: |
28+
minikube addons enable ingress
29+
minikube addons enable olm
30+
31+
- name: Setup Minikube tunnel
32+
shell: bash
33+
run: |
34+
minikube tunnel &

.github/workflows/operator.yaml

+47-31
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ on:
44
branches:
55
- main
66
paths:
7-
- 'operator/**'
8-
7+
- operator/**
98
pull_request:
109
branches:
1110
- main
1211
paths:
13-
- 'operator/**'
12+
- operator/**
1413

1514
concurrency:
1615
group: ${{ github.workflow }}-${{ github.ref }}
@@ -32,10 +31,9 @@ jobs:
3231
# deploys it with `imagePullPolicy: Always`; and also the operator image itself for the same reason.
3332
- name: Configure env. variables 2
3433
run: |
35-
echo "IMAGE=ttl.sh/apicurio-registry-operator-$UUID:8h" >> $GITHUB_ENV
36-
echo "BUNDLE_IMAGE=ttl.sh/apicurio-registry-operator-bundle-$UUID:8h" >> $GITHUB_ENV
37-
echo "CATALOG_IMAGE=ttl.sh/apicurio-registry-operator-catalog-$UUID:8h" >> $GITHUB_ENV
38-
echo "ADDITIONAL_CATALOG_IMAGE=" >> $GITHUB_ENV
34+
echo "IMAGE=ttl.sh/apicurio-registry-3-operator-$UUID:8h" >> $GITHUB_ENV
35+
echo "BUNDLE_IMAGE=ttl.sh/apicurio-registry-3-operator-bundle-$UUID:8h" >> $GITHUB_ENV
36+
echo "CATALOG_IMAGE=ttl.sh/apicurio-registry-3-operator-catalog-$UUID:8h" >> $GITHUB_ENV
3937
4038
- name: Checkout ${{ github.ref }}
4139
uses: actions/checkout@v4
@@ -47,31 +45,24 @@ jobs:
4745
distribution: temurin
4846
cache: maven
4947

50-
- name: Enable port-forwarding
51-
run: |
52-
sudo apt-get -y install socat
53-
54-
- name: Setup Minikube
55-
uses: manusa/actions-setup-minikube@v2.13.0
48+
- uses: ./.github/workflows/composite/setup-minikube
5649
with:
57-
'minikube version': v1.33.1
58-
'kubernetes version': v1.25.0
59-
'github token': ${{ secrets.GITHUB_TOKEN }}
60-
'start args': '--force'
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
6151

62-
- name: Enable minikube features
63-
run: |
64-
minikube addons enable ingress
65-
minikube addons enable olm
66-
67-
- name: Setup minikube tunnel
52+
- name: Build only
53+
if: github.event_name != 'push'
54+
working-directory: operator
6855
run: |
69-
minikube tunnel &
56+
make BUILD_OPTS=--no-transfer-progress SKIP_TESTS=true build
7057
7158
- name: Build and run local tests on Minikube
59+
# Speed up the PR check by running both local and remote tests on push to main,
60+
# and only run remote tests against a PR.
61+
# TODO: Is this ok?
62+
if: github.event_name == 'push'
7263
working-directory: operator
7364
run: |
74-
make BUILD_OPTS="--no-transfer-progress" build
65+
make BUILD_OPTS=--no-transfer-progress build
7566
7667
- name: Build temporary operator image
7768
working-directory: operator
@@ -91,13 +82,13 @@ jobs:
9182
- name: Run remote and OLM tests on Minikube
9283
working-directory: operator
9384
run: |
94-
make BUILD_OPTS="--no-transfer-progress" remote-tests-all
85+
make BUILD_OPTS=--no-transfer-progress remote-tests-all
9586
9687
- name: Update install file
9788
working-directory: operator
9889
run: |
9990
# We need to remove unset the variables to generate a clean install file.
100-
# See https://stackoverflow.com/questions/70137245/how-to-remove-an-environment-variable-on-github-actions
91+
# See https://github.com/actions/runner/issues/1126
10192
unset IMAGE
10293
unset BUNDLE_IMAGE
10394
unset CATALOG_IMAGE
@@ -110,7 +101,7 @@ jobs:
110101
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.';
111102
exit 1;
112103
else
113-
echo "No changes to the install file.";
104+
echo "No changes to the install file.";
114105
fi
115106
116107
operator-publish:
@@ -120,11 +111,12 @@ jobs:
120111
if: github.event_name == 'push'
121112
steps:
122113

123-
# Do not publish (version)-snapshot tag, instead use `latest-snapshot`.
124114
- name: Configure env. variables
125115
run: |
116+
# We want to use latest-snapshot instead of x.y.z-snapshot
126117
echo "IMAGE_TAG=latest-snapshot" >> $GITHUB_ENV
127118
echo "BUNDLE_IMAGE_TAG=latest-snapshot" >> $GITHUB_ENV
119+
echo "CATALOG_IMAGE_TAG=latest-snapshot" >> $GITHUB_ENV
128120
129121
- name: Checkout ${{ github.ref }}
130122
uses: actions/checkout@v4
@@ -139,13 +131,14 @@ jobs:
139131
- name: Build
140132
working-directory: operator
141133
run: |
142-
make BUILD_OPTS="--no-transfer-progress" SKIP_TESTS=true build
134+
make BUILD_OPTS=--no-transfer-progress SKIP_TESTS=true build
143135
144136
- name: Login to quay.io registry
145137
run: |
146138
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
147139
148-
- name: Build and publish operator image # TODO: Also push to DockerHub Registry
140+
# TODO: Also push to DockerHub Registry
141+
- name: Build and publish operator image
149142
working-directory: operator
150143
run: |
151144
make image-build image-push
@@ -154,3 +147,26 @@ jobs:
154147
working-directory: operator
155148
run: |
156149
make bundle
150+
151+
- name: Build and publish operator catalog
152+
working-directory: operator
153+
run: |
154+
make catalog
155+
156+
- name: Slack Notification (Always)
157+
if: always()
158+
run: |
159+
MESSAGE="'${{ github.workflow }}/${{ github.job }}' job completed with status: ${{ job.status }}"
160+
REPO="${{ github.repository }}"
161+
LINK="https://github.com/$REPO/actions/runs/${{ github.run_id }}"
162+
PAYLOAD="{\"workflow\": \"${{ github.workflow }}\", \"status\": \"${{ job.status }}\", \"message\": \"$MESSAGE\", \"link\": \"$LINK\", \"repository\": \"$REPO\"}"
163+
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}"
164+
165+
- name: Slack Notification (Error)
166+
if: failure()
167+
run: |
168+
MESSAGE="'${{ github.workflow }}/${{ github.job }}' job FAILED!"
169+
REPO="${{ github.repository }}"
170+
LINK="https://github.com/$REPO/actions/runs/${{ github.run_id }}"
171+
PAYLOAD="{\"workflow\": \"${{ github.workflow }}\", \"status\": \"${{ job.status }}\", \"message\": \"$MESSAGE\", \"link\": \"$LINK\", \"repository\": \"$REPO\"}"
172+
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "${{ secrets.SLACK_ERROR_WEBHOOK }}"

0 commit comments

Comments
 (0)