Skip to content

Commit

Permalink
Update related images/Configuration nudges
Browse files Browse the repository at this point in the history
- Add `containerImage` annotation
- Add operator to `relatedImages`

Signed-off-by: Dale Haiducek <[email protected]>
  • Loading branch information
dhaiducek committed Dec 11, 2024
1 parent 00dc7b1 commit a8f3391
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
1 change: 1 addition & 0 deletions .tekton/gatekeeper-operator-3-17-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
build.appstudio.redhat.com/commit_sha: '{{revision}}'
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
pipelinesascode.tekton.dev/max-keep-runs: "3"
build.appstudio.openshift.io/build-nudge-files: "build/konflux-patch.sh"
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch == "release-3.17"
creationTimestamp: null
labels:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ update-bindata: go-bindata ## Update bindata.go file.
$(MAKE) fmt

GATEKEEPER_IMG_BASE ?= quay.io/gatekeeper/gatekeeper
GATEKEEPER_IMG ?= $(GATEKEEPER_IMAGE_BASE):v$(GATEKEEPER_VERSION)
GATEKEEPER_IMG ?= $(GATEKEEPER_IMG_BASE):v$(GATEKEEPER_VERSION)

.PHONY: update-gatekeeper-image
update-gatekeeper-image: ## Update Gatekeeper image in manifests.
Expand Down
33 changes: 26 additions & 7 deletions build/konflux-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,46 @@
set -e

# Gatekeeper Operator image
operator_img="registry.redhat.io/gatekeeper/gatekeeper-rhel9-operator@sha256:6e386be134d928bdb03b702e399c97e7aedecacaa3d0813183a8c5ecf13c7bc2"
operator_img="quay.io/redhat-user-workloads/gatekeeper-tenant/gatekeeper-operator-3-17/gatekeeper-3-17@sha256:0af0f40820e3d081f1dcb51edd2e89d6097f25ad9349028ca5d68dbf50abd0b8"
# Gatekeeper image
gatekeeper_img="registry.redhat.io/gatekeeper/gatekeeper-rhel9@sha256:3095f68c12c5dc3b00ce84e1c37d516d96cbcb06d42eaef5372358786956bd62"
gatekeeper_img="quay.io/redhat-user-workloads/gatekeeper-tenant/gatekeeper-operator-3-17/gatekeeper-operator-3-17@sha256:c6a43d63fbcc602f41df61689f8d5027b26ed4085ceb05f3ecd4e9243fbc87dd"

build_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

csv_file=${build_dir}/../bundle/manifests/gatekeeper-operator.clusterserviceversion.yaml

# Patch images in the CSV for:
# Gatekeeper
# - containerImage annotation
# - Deployment RELATED_IMAGE_GATEKEEPER env
# Operator
# - Deployment image
# Both
# - relatedImages
csv_patch=$(printf '[{
"op": "replace",
"path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/env/0/value",
"path": "/metadata/annotations/containerImage",
"value": "%s",
},{
"op": "replace",
"path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/image",
"value": "%s",
"path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/env",
"value": [{
"name": "RELATED_IMAGE_GATEKEEPER",
"value": "%s"
}],
},{
"op": "replace",
"path": "/spec/relatedImages",
"value": [
{ "name":"gatekeeper", "image": "%s" },
{ "name":"gatekeeper-operator", "image": "%s" }
],
},{
"op": "replace",
"path": "/spec/relatedImages/0/image",
"path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/image",
"value": "%s",
}]' ${gatekeeper_img} ${operator_img} ${gatekeeper_img})
}]' ${gatekeeper_img} ${gatekeeper_img} ${gatekeeper_img} ${operator_img} ${operator_img})

kubectl patch --local=true -f ${csv_file} --type=json --patch="${csv_patch}" --output=yaml >${csv_file}.bk

mv ${csv_file}.bk ${csv_file}

0 comments on commit a8f3391

Please sign in to comment.