Skip to content

Commit

Permalink
Tweak image logic for Konflux
Browse files Browse the repository at this point in the history
Signed-off-by: Dale Haiducek <[email protected]>
  • Loading branch information
dhaiducek committed Nov 6, 2024
1 parent 4f43877 commit 1ee5f75
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .tekton/gatekeeper-operator-bundle-3-17-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- name: image-expires-after
value: 5d
- name: dockerfile
value: build/bundle.Dockerfile
value: build/bundle.Dockerfile.rhtap
- name: path-context
value: .
pipelineSpec:
Expand Down
2 changes: 1 addition & 1 deletion .tekton/gatekeeper-operator-bundle-3-17-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: output-image
value: quay.io/redhat-user-workloads/gatekeeper-tenant/gatekeeper-operator-3-17/gatekeeper-operator-bundle-3-17:{{revision}}
- name: dockerfile
value: build/bundle.Dockerfile
value: build/bundle.Dockerfile.rhtap
- name: path-context
value: .
pipelineSpec:
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ update-bindata: go-bindata ## Update bindata.go file.
rm -rf ./$(GATEKEEPER_MANIFEST_DIR)-rendered
$(MAKE) fmt

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

.PHONY: update-gatekeeper-image
update-gatekeeper-image: ## Update Gatekeeper image in manifests.
yq 'select(.kind == "Deployment") \
|= .spec.template.spec.containers[] \
|= select(.name == "manager").env[] \
|= select(.name == "RELATED_IMAGE_GATEKEEPER").value = "$(GATEKEEPER_IMAGE):v$(GATEKEEPER_VERSION)"' \
|= select(.name == "RELATED_IMAGE_GATEKEEPER").value = "$(GATEKEEPER_IMG)"' \
-i config/manager/manager.yaml

# Set version variables for LDFLAGS
Expand Down
2 changes: 1 addition & 1 deletion build/bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LABEL com.redhat.openshift.versions=v4.12
# Bundle metadata
LABEL name=gatekeeper/gatekeeper-operator-bundle
LABEL description="The Gatekeeper Operator installs and configures Open Policy Agent Gatekeeper."
LABEL io.k8s.description=gatekeeper-operator-bundle
LABEL io.k8s.description="The Gatekeeper Operator installs and configures Open Policy Agent Gatekeeper."
LABEL summary="Red Hat Gatekeeper Operator"
LABEL version=v3.17.0
LABEL release=""
Expand Down
37 changes: 37 additions & 0 deletions build/bundle.Dockerfile.rhtap
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 AS builder

COPY . .
RUN ./konflux-patch.sh

FROM scratch

# Copy files to locations specified by labels.
COPY --from=builder /manifests /manifests/
COPY --from=builder /metadata /metadata/

# Core bundle annotations.
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.bundle.channels.v1="stable,3.17"
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=gatekeeper-operator
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.34.1
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Red Hat annotations.
LABEL com.redhat.component=gatekeeper-operator-bundle-container
LABEL com.redhat.delivery.backport=false
LABEL com.redhat.delivery.operator.bundle=true
LABEL com.redhat.openshift.versions=v4.12
# Bundle metadata
LABEL name=gatekeeper/gatekeeper-operator-bundle
LABEL description="The Gatekeeper Operator installs and configures Open Policy Agent Gatekeeper."
LABEL io.k8s.description="The Gatekeeper Operator installs and configures Open Policy Agent Gatekeeper."
LABEL summary="Red Hat Gatekeeper Operator"
LABEL version=v3.17.0
LABEL release=""
LABEL distribution-scope=public
LABEL maintainer="[email protected]"
LABEL url=https://github.com/stolostron/gatekeeper-operator
LABEL vendor="Red Hat, Inc."
17 changes: 17 additions & 0 deletions build/install-yq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

# Install yq command
VERSION="v4.44.3"
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "aarch64" ]]; then
ARCH="arm64"
fi

BINARY="yq_linux_$ARCH"

curl -s "https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}" -o /usr/bin/yq
chmod +x /usr/bin/yq
9 changes: 9 additions & 0 deletions build/konflux-patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash

# Gatekeeper Operator image
export IMG="quay.io/redhat-user-workloads/gatekeeper-tenant/gatekeeper-operator-3-17/gatekeeper-operator-3-17@sha256:9eeb73c02969ab9c08b867564958133b5f5febc86dfaf6809cd768adcd05ca22"
# Gatekeeper image
export GATEKEEPER_IMG="quay.io/redhat-user-workloads/gatekeeper-tenant/gatekeeper-operator-3-17/gatekeeper-3-17@sha256:ea331b53f5b1ccbc30841cbe81f6faee79101dbb50ecfb7e2ba7a2b944ecc212"

make update-gatekeeper-image
make bundle
2 changes: 1 addition & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ annotations:
# Bundle metadata
name: gatekeeper/gatekeeper-operator-bundle
description: "The Gatekeeper Operator installs and configures Open Policy Agent Gatekeeper."
io.k8s.description: gatekeeper-operator-bundle
io.k8s.description: "The Gatekeeper Operator installs and configures Open Policy Agent Gatekeeper."
summary: "Red Hat Gatekeeper Operator"
version: v3.17.0
release: ""
Expand Down

0 comments on commit 1ee5f75

Please sign in to comment.