Skip to content

Commit b738ac0

Browse files
committed
ci(template): Publish to quay.io
1 parent f71831c commit b738ac0

4 files changed

Lines changed: 74 additions & 42 deletions

File tree

template/.github/workflows/build.yaml.j2

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
build-arguments: VERSION=${{ steps.version.outputs.OPERATOR_VERSION }}
174174
container-file: docker/Dockerfile
175175

176-
- name: Publish Container Image
176+
- name: Publish Container Image (oci.stackable.tech)
177177
if: ${{ !github.event.pull_request.head.repo.fork }}
178178
uses: stackabletech/actions/publish-image@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
179179
with:
@@ -184,6 +184,17 @@ jobs:
184184
image-manifest-tag: ${{ steps.build.outputs.image-manifest-tag }}
185185
source-image-uri: ${{ steps.build.outputs.image-manifest-uri }}
186186

187+
- name: Publish Container Image (quay.io)
188+
if: ${{ !github.event.pull_request.head.repo.fork }}
189+
uses: stackabletech/actions/publish-image@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
190+
with:
191+
image-registry-uri: quay.io
192+
image-registry-username: stackable+robot_sdp_github_action_build # Doesn't exist yet
193+
image-registry-password: ${{ secrets.QUAY_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }} # Doesn't exist yet
194+
image-repository: stackable/sdp/${{ env.OPERATOR_NAME }}
195+
image-manifest-tag: ${{ steps.build.outputs.image-manifest-tag }}
196+
source-image-uri: ${{ steps.build.outputs.image-manifest-uri }}
197+
187198
publish-index-manifest:
188199
name: Publish/Sign ${{ needs.build-container-image.outputs.operator-version }} Index
189200
if: |
@@ -202,7 +213,7 @@ jobs:
202213
with:
203214
persist-credentials: false
204215

205-
- name: Publish and Sign Image Index
216+
- name: Publish and Sign Image Index (oci.stackable.tech)
206217
uses: stackabletech/actions/publish-image-index-manifest@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
207218
with:
208219
image-registry-uri: oci.stackable.tech
@@ -211,6 +222,15 @@ jobs:
211222
image-repository: sdp/${{ env.OPERATOR_NAME }}
212223
image-index-manifest-tag: ${{ needs.build-container-image.outputs.operator-version }}
213224

225+
- name: Publish and Sign Image Index (quay.io)
226+
uses: stackabletech/actions/publish-image-index-manifest@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
227+
with:
228+
image-registry-uri: quay.io
229+
image-registry-username: stackable+robot_sdp_github_action_build # Doesn't exist yet
230+
image-registry-password: ${{ secrets.QUAY_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }} # Doesn't exist yet
231+
image-repository: stackable/sdp/${{ env.OPERATOR_NAME }}
232+
image-index-manifest-tag: ${{ needs.build-container-image.outputs.operator-version }}
233+
214234
publish-helm-chart:
215235
name: Package/Publish ${{ needs.build-container-image.outputs.operator-version }} Helm Chart
216236
if: |
@@ -229,7 +249,7 @@ jobs:
229249
persist-credentials: false
230250
submodules: recursive
231251

232-
- name: Package, Publish, and Sign Helm Chart
252+
- name: Package, Publish, and Sign Helm Chart (coi.stackable.tech)
233253
uses: stackabletech/actions/publish-helm-chart@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
234254
with:
235255
chart-registry-uri: oci.stackable.tech
@@ -241,6 +261,18 @@ jobs:
241261
app-version: ${{ needs.build-container-image.outputs.operator-version }}
242262
publish-and-sign: ${{ !github.event.pull_request.head.repo.fork }}
243263

264+
- name: Package, Publish, and Sign Helm Chart (quay.io)
265+
uses: stackabletech/actions/publish-helm-chart@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
266+
with:
267+
chart-registry-uri: quay.io
268+
chart-registry-username: stackable+robot_sdp_charts_github_action_build # Doesn't exist yet
269+
chart-registry-password: ${{ secrets.QUAY_ROBOT_SDP_CHARTS_GITHUB_ACTION_BUILD_SECRET }} # Doesn't exist yet
270+
chart-repository: stackable/sdp-charts
271+
chart-directory: deploy/helm/${{ env.OPERATOR_NAME }}
272+
chart-version: ${{ needs.build-container-image.outputs.operator-version }}
273+
app-version: ${{ needs.build-container-image.outputs.operator-version }}
274+
publish-and-sign: ${{ !github.event.pull_request.head.repo.fork }}
275+
244276
openshift-preflight-check:
245277
name: Run OpenShift Preflight Check for ${{ needs.build-container-image.outputs.operator-version }}-${{ matrix.arch }}
246278
if: |
@@ -259,12 +291,18 @@ jobs:
259291
- arm64
260292
runs-on: ubuntu-latest
261293
steps:
262-
- name: Run OpenShift Preflight Check
294+
- name: Run OpenShift Preflight Check (oci.stackable.tech)
263295
uses: stackabletech/actions/run-openshift-preflight@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
264296
with:
265297
image-index-uri: oci.stackable.tech/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }}
266298
image-architecture: ${{ matrix.arch }}
267299

300+
- name: Run OpenShift Preflight Check (quay.io)
301+
uses: stackabletech/actions/run-openshift-preflight@ac6f1d3b87f68826b9a5838d13864ef8e88dcf40 # v0.14.0
302+
with:
303+
image-index-uri: quay.io/stackable/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }}
304+
image-architecture: ${{ matrix.arch }}
305+
268306
# This job is a required check in GitHub Settings for this repository.
269307
# It saves us having to list many required jobs, or work around dynamically
270308
# named jobs (since there is no concept of required settings).

template/Makefile.j2

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,81 +10,75 @@
1010
.PHONY: build publish
1111

1212
OPERATOR_NAME := {[ operator.name }]
13-
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-${OPERATOR_NAME}")
14-
| .version')
13+
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-${OPERATOR_NAME}") | .version')
1514

1615
OCI_REGISTRY_HOSTNAME := oci.stackable.tech
1716
OCI_REGISTRY_PROJECT_IMAGES := sdp
1817

1918
SHELL=/usr/bin/env bash -euo pipefail
2019

2120
render-readme:
22-
scripts/render_readme.sh
21+
scripts/render_readme.sh
2322

2423
render-docs:
25-
scripts/docs_templating.sh
24+
scripts/docs_templating.sh
2625

2726
## Docker related targets
2827
docker-build:
29-
docker build --force-rm --build-arg VERSION=${VERSION} -t
30-
"${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-${ARCH}" -f docker/Dockerfile .
28+
docker build --force-rm --build-arg VERSION=${VERSION} -t "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-${ARCH}" -f docker/Dockerfile .
3129

3230
## Chart related targets
3331
compile-chart: version crds config
3432

3533
chart-clean:
36-
rm -rf "deploy/helm/${OPERATOR_NAME}/configs"
37-
rm -rf "deploy/helm/${OPERATOR_NAME}/crds"
34+
rm -rf "deploy/helm/${OPERATOR_NAME}/configs"
35+
rm -rf "deploy/helm/${OPERATOR_NAME}/crds"
3836

3937
version:
40-
cat "deploy/helm/${OPERATOR_NAME}/Chart.yaml" | yq ".version = \"${VERSION}\" | .appVersion = \"${VERSION}\"" >
41-
"deploy/helm/${OPERATOR_NAME}/Chart.yaml.new"
42-
mv "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new" "deploy/helm/${OPERATOR_NAME}/Chart.yaml"
38+
cat "deploy/helm/${OPERATOR_NAME}/Chart.yaml" | yq ".version = \"${VERSION}\" | .appVersion = \"${VERSION}\"" > "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new"
39+
mv "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new" "deploy/helm/${OPERATOR_NAME}/Chart.yaml"
4340

4441
config:
45-
if [ -d "deploy/config-spec/" ]; then\
46-
mkdir -p "deploy/helm/${OPERATOR_NAME}/configs";\
47-
cp -r deploy/config-spec/* "deploy/helm/${OPERATOR_NAME}/configs";\
48-
fi
42+
if [ -d "deploy/config-spec/" ]; then\
43+
mkdir -p "deploy/helm/${OPERATOR_NAME}/configs";\
44+
cp -r deploy/config-spec/* "deploy/helm/${OPERATOR_NAME}/configs";\
45+
fi
4946

5047
# We generate a crds.yaml, so that the effect of code changes are visible.
5148
# The operator will take care of the CRD rollout itself.
5249
crds:
53-
mkdir -p extra
54-
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd > extra/crds.yaml
50+
mkdir -p extra
51+
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd > extra/crds.yaml
5552

5653
chart-lint: compile-chart
57-
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint
58-
--config deploy/helm/ct.yaml
54+
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint --config deploy/helm/ct.yaml
5955

6056
clean: chart-clean
61-
cargo clean
62-
docker rmi --force '${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}'
57+
cargo clean
58+
docker rmi --force '${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}'
6359

6460
regenerate-charts: chart-clean compile-chart
6561

6662
regenerate-nix:
67-
nix run --extra-experimental-features "nix-command flakes" -f . regenerateNixLockfiles
63+
nix run --extra-experimental-features "nix-command flakes" -f . regenerateNixLockfiles
6864

6965
build: regenerate-charts regenerate-nix docker-build
7066

7167
check-nix:
72-
@which nix || (echo "Error: 'nix' is not installed. Please install it to proceed."; exit 1)
68+
@which nix || (echo "Error: 'nix' is not installed. Please install it to proceed."; exit 1)
7369

7470
check-kubernetes:
75-
@kubectl cluster-info > /dev/null 2>&1 || (echo "Error: Kubernetes is not running or kubectl is not properly
76-
configured."; exit 1)
71+
@kubectl cluster-info > /dev/null 2>&1 || (echo "Error: Kubernetes is not running or kubectl is not properly configured."; exit 1)
7772

7873
run-dev: check-nix check-kubernetes
79-
kubectl apply -f deploy/stackable-operators-ns.yaml
80-
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- up --port {[5430 + operator_index}] --namespace
81-
stackable-operators
74+
kubectl apply -f deploy/stackable-operators-ns.yaml
75+
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- up --port {[5430 + operator_index}] --namespace stackable-operators
8276

8377
stop-dev: check-nix check-kubernetes
84-
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- down
78+
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- down
8579

8680
helm-install:
87-
helm install \
88-
--values deploy/helm/${OPERATOR_NAME}/values.yaml \
89-
--values deploy/helm/${OPERATOR_NAME}/values/$(OCI_REGISTRY_HOSTNAME).yaml \
90-
${OPERATOR_NAME} deploy/helm/${OPERATOR_NAME}
81+
helm install \
82+
--values deploy/helm/${OPERATOR_NAME}/values.yaml \
83+
--values deploy/helm/${OPERATOR_NAME}/values/$(OCI_REGISTRY_HOSTNAME).yaml \
84+
${OPERATOR_NAME} deploy/helm/${OPERATOR_NAME}

template/deploy/helm/[[operator]]/values/oci.stackable.tech.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
# Values overlay for chart packages published to quay.io.
3+
image:
4+
registry: quay.io
5+
repository: stackable/sdp/{[ operator.name }]

0 commit comments

Comments
 (0)