Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .tekton/hyperfleet-operator-bundle-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ metadata:
== "main" &&
(".tekton/hyperfleet-operator-bundle-push.yaml".pathChanged() ||
"bundle.Dockerfile".pathChanged() ||
"config/***".pathChanged())
"config/***".pathChanged() ||
"validators/related-images/**".pathChanged())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see the validator path added to the trigger. One gap: bundle.Dockerfile also copies go.mod/go.sum, so a dependency bump that changes the validator build won't retrigger the bundle push. Consider adding go.mod/go.sum to the CEL expression as well.

@ma-hill ma-hill Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don’t think that should be added as a trigger, because the bundle will get built once the operator image gets built and it will pick up the updated dependency to go.mod/go.sum.. the pipeline should really only be built when there are changes to the bundle.Dockerfile, tekton pipeline, and if the validator code changed.

Basically the updated dependency will trigger the operator image build —> trigger the bundle image build. Thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree with this ^^^^

labels:
appstudio.openshift.io/application: hyperfleet
appstudio.openshift.io/component: hyperfleet-operator-bundle
Expand Down Expand Up @@ -228,6 +229,7 @@ spec:
- $(params.build-args[*])
- KUSTOMIZE_VARIANT=config/manifests/prod
- BUNDLE_VERSION=0.0.1
- VALIDATE_RELATED_IMAGES=true
- name: BUILD_ARGS_FILE
value: $(params.build-args-file)
- name: PRIVILEGED_NESTED
Expand Down
1 change: 1 addition & 0 deletions .tekton/hyperfleet-operator-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata:
x.matches('^bundle\\.Dockerfile$')
|| x.matches('^config/manifests/prod/')
|| x.matches('^hack/test-disconnected-mirror\\.sh$')
|| x.matches('^validators/')
|| x.matches('^\\.tekton/hyperfleet-operator-bundle-push\\.yaml$')
|| x.matches('^catalog/')
|| x.matches('^catalog\\.Dockerfile$')
Expand Down
16 changes: 3 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,10 @@ cleanup-test-e2e: ## Tear down the Kind cluster used for e2e tests

##@ Lint

.PHONY: verify-related-images
verify-related-images: ## Verify a final built bundle CSV (CSV_FILE is required).
@test -n "$(CSV_FILE)" || { echo "Set CSV_FILE to the CSV extracted from the built bundle"; exit 1; }
go run ./hack/verify-related-images -csv "$(CSV_FILE)"

.PHONY: lint
lint: ## Run golangci-lint.
$(GOLANGCI_LINT) run

.PHONY: verify-bundle-related-images
verify-bundle-related-images: ## Transform the repository bundle CSV and verify its related images.
@set -euo pipefail; \
yq_path=$$($(call gotool,-n yq)); \
YQ="$$yq_path" bash ./hack/verify-bundle-related-images.sh; \
PATH="$$(dirname "$$yq_path"):$$PATH" go test -tags integration ./hack/verify-related-images; \
YQ="$$yq_path" bash ./hack/test-verify-bundle-related-images.sh

.PHONY: lint-fix
lint-fix: ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix
Expand Down Expand Up @@ -351,6 +338,8 @@ endif
# To override the operator and API images:
# make bundle-build RELATED_IMAGE_HYPERFLEET_OPERATOR=<image> RELATED_IMAGE_HYPERFLEET_API=<image>
KUSTOMIZE_VARIANT ?= config/manifests/dev
# For dev builds - unset validation of related images
VALIDATE_RELATED_IMAGES ?= false
.PHONY: bundle-build
bundle-build: ## Builds the bundle and bundle image.
cat config/manifests/dev/patch-images.yaml | envsubst > config/manifests/dev/kustomization.yaml
Expand All @@ -360,6 +349,7 @@ bundle-build: ## Builds the bundle and bundle image.
--build-arg CHANNELS=$(CHANNELS) \
--build-arg DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) \
--build-arg KUSTOMIZE_VARIANT=$(KUSTOMIZE_VARIANT) \
--build-arg VALIDATE_RELATED_IMAGES=$(VALIDATE_RELATED_IMAGES) \
--build-arg APP_VERSION=$(APP_VERSION) \
-t $(BUNDLE_IMG) .

Expand Down
20 changes: 16 additions & 4 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1789040808 AS validator

WORKDIR /workdir
COPY validators/ ./validators/
COPY go.mod go.mod
COPY go.sum go.sum

RUN go build -o ./bin/related-images-validator ./validators/related-images/

FROM quay.io/konflux-ci/operator-sdk-builder:latest@sha256:bd34ca58b2d08e8ee3b9cdf46b32f69173084ca09c1d3aba47285e2c35b4d1fc AS builder

WORKDIR /workdir
COPY config/ ./config/
COPY --from=validator /workdir/bin/related-images-validator ./related-images-validator

# Specify the kustomize variant, either bases/kustomization.yaml or prod/kustomization.yaml
# prod/kustomization.yaml gets image update references from konflux.
# Specify the kustomize variant, either config/manifests/dev or config/manifests/prod
ARG KUSTOMIZE_VARIANT=config/manifests/dev
# ARG KUSTOMIZE_VARIANT=config/manifests/prod for konflux builds
RUN kustomize build /workdir/${KUSTOMIZE_VARIANT} > /workdir/manifests.yaml

ARG CHANNELS=stable
ARG DEFAULT_CHANNEL=stable
ARG BUNDLE_VERSION=0.0.1

RUN mkdir -p /workdir/bundle
RUN cat manifests.yaml | operator-sdk generate bundle -q --version ${BUNDLE_VERSION} \
--channels=${CHANNELS} --default-channel=${DEFAULT_CHANNEL} \
--package=hyperfleet-operator && \
operator-sdk bundle validate ./bundle --select-optional name=operatorhubv2

ARG VALIDATE_RELATED_IMAGES=true
RUN if [ "$VALIDATE_RELATED_IMAGES" = "true" ]; then \
./related-images-validator -csv bundle/manifests/*.clusterserviceversion.yaml; \
fi

FROM scratch

ARG CHANNELS=stable
Expand Down
110 changes: 0 additions & 110 deletions hack/test-verify-bundle-related-images.sh

This file was deleted.

25 changes: 0 additions & 25 deletions hack/verify-bundle-related-images.sh

This file was deleted.

154 changes: 0 additions & 154 deletions hack/verify-related-images/integration_test.go

This file was deleted.

Loading