Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .tekton/hyperfleet-operator-bundle-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ metadata:
pipelinesascode.tekton.dev/cancel-in-progress: "false"
pipelinesascode.tekton.dev/max-keep-runs: "3"
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch
== "main" && ( ".tekton/hyperfleet-operator-bundle-push.yaml".pathChanged() || "bundle.konflux.Dockerfile".pathChanged()
|| "bundle-hack/***".pathChanged() || "bundle/***".pathChanged() )
== "main" && ( ".tekton/hyperfleet-operator-bundle-push.yaml".pathChanged() || "bundle.Dockerfile".pathChanged())

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.

The bundle content now comes from config/, but this only fires on bundle.Dockerfile. So a nudge PR touching config/manager/prod/kustomization.yaml never rebuilds the bundle. Worse, it does match the operator push (it only excludes the bundle Dockerfile and this file), so the operator rebuilds, gets a new digest, opens another nudge, and we loop. Add "config/***".pathChanged() here, and exclude the prod kustomization in the operator push CEL

labels:
appstudio.openshift.io/application: hyperfleet
appstudio.openshift.io/component: hyperfleet-operator-bundle
Expand All @@ -25,7 +24,7 @@ spec:
- name: output-image
value: quay.io/redhat-user-workloads/hyperfleet-tenant/hyperfleet/hyperfleet-operator-bundle:{{revision}}
- name: dockerfile
value: ./bundle.konflux.Dockerfile
value: ./bundle.Dockerfile
- name: path-context
value: .
pipelineSpec:
Expand Down Expand Up @@ -222,6 +221,7 @@ spec:
value: $(tasks.clone-repository.results.commit)
- name: BUILD_ARGS
value:
- KUSTOMIZE_VARIANT=config/manager/prod/kustomization.yaml
- $(params.build-args[*])
- name: BUILD_ARGS_FILE
value: $(params.build-args-file)
Expand Down
7 changes: 2 additions & 5 deletions .tekton/hyperfleet-operator-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
annotations:
build.appstudio.openshift.io/build-nudge-files: bundle.konflux.Dockerfile
build.appstudio.openshift.io/build-nudge-files: config/manager/prod/kustomization.yaml
build.appstudio.openshift.io/repo: https://github.com/openshift-hyperfleet/hyperfleet-operator?rev={{revision}}
build.appstudio.redhat.com/commit_sha: '{{revision}}'
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
Expand All @@ -12,10 +12,7 @@ metadata:
event == "push"
&& target_branch == "main"
&& !(files.all.all(x,
x.matches('^bundle\\.konflux\\.Dockerfile$')
|| x.matches('^bundle\\.Dockerfile$')
|| x.matches('^bundle-hack/')
|| x.matches('^bundle/')
x.matches('^bundle\\.Dockerfile$')
|| x.matches('^\\.tekton/hyperfleet-operator-bundle-push\\.yaml$')
))
labels:
Expand Down
22 changes: 8 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi

##@ Bundles/Catalog


# Non-olm installs
# Generates dist/install.yaml
# Install resources
Expand Down Expand Up @@ -349,24 +348,19 @@ ifneq ($(origin CATALOG_BASE_IMG), undefined)
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
endif

.PHONY: bundle
bundle: manifests operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
$(OPERATOR_SDK) generate kustomize manifests -q
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
$(OPERATOR_SDK) bundle validate ./bundle

.PHONY: bundle-override-img
bundle-override-img: manifests operator-sdk ## Generate bundle with IMG override, then restore kustomization.yaml
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
$(OPERATOR_SDK) bundle validate ./bundle
@echo "Bundle generated with IMG=$(IMG)"
@echo "Note: config/manager/kustomization.yaml has been modified. Commit or reset as needed."
cd config/manager/dev && $(KUSTOMIZE) edit set image controller=$(IMG)

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
$(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
bundle-build: ## Builds the bundle and bundle image.
$(CONTAINER_TOOL) build -f bundle.Dockerfile \
--platform $(PLATFORM) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNELS) \

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.

the Dockerfile ARG is CHANNELS but this passes CHANNEL, so make bundle-build CHANNELS=candidate silently builds stable. Also worth passing KUSTOMIZE_VARIANT through here so you can build the prod variant locally

--build-arg APP_VERSION=$(APP_VERSION) \
-t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
Expand Down
24 changes: 0 additions & 24 deletions bundle-hack/update_bundle.sh

This file was deleted.

41 changes: 37 additions & 4 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
FROM registry.k8s.io/kustomize/kustomize:v5.0.0 AS kustomize

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.

registry.k8s.io and quay.io/operator-framework (line 11) aren't in the app-interface-standard base image allowlist, so Conforma fails base_image_permitted on the release, same thing we hit on the catalog PR. registry.redhat.io/openshift4/ose-operator-sdk-rhel9:v4.18 has operator-sdk, and registry.redhat.io/openshift4/ose-cli-rhel9:v4.18 gives you oc kustomize for the first stage.


COPY config/ /workdir/config/

# Override the base kustomization.yaml
ARG KUSTOMIZE_VARIANT=dev/kustomization.yaml
RUN cp /workdir/config/manager/${KUSTOMIZE_VARIANT} \

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.

this won't build on Konflux. The tekton push passes KUSTOMIZE_VARIANT=config/manager/prod/kustomization.yaml but this line prefixes /workdir/config/manager/ itself, so the cp target becomes config/manager/config/manager/prod/... and fails. Pick one convention, I'd go with the full repo path in the ARG

ARG KUSTOMIZE_VARIANT=config/manager/dev/kustomization.yaml
RUN cp /workdir/${KUSTOMIZE_VARIANT} /workdir/config/manager/kustomization.yaml &&
kustomize build /workdir/config/manifests > /workdir/manifests.yaml

/workdir/config/manager/kustomization.yaml && \
kustomize build /workdir/config/manifests > /workdir/manifests.yaml

FROM quay.io/operator-framework/operator-sdk:v1.42.3 AS operator
COPY --from=kustomize /workdir/manifests.yaml /workdir/manifests.yaml
ARG CHANNELS=stable
ARG VERSION=0.0.1
WORKDIR /workdir
RUN cat manifests.yaml | operator-sdk generate bundle -q --version ${VERSION} \
--channels=${CHANNELS} --default-channel=stable \
--package=hyperfleet-operator && \
operator-sdk bundle validate ./bundle

FROM scratch

# Core bundle labels.
Expand All @@ -15,7 +35,20 @@ LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
# Copy patched manifests from builder, metadata and tests from source.
COPY --from=operator /workdir/bundle/manifests /manifests/
COPY --from=operator /workdir/bundle/metadata /metadata/
COPY --from=operator /workdir/bundle/tests/scorecard /tests/scorecard/

ARG APP_VERSION="0.0.0-dev"
LABEL name="hyperfleet-operator-bundle" \
vendor="Red Hat, Inc." \
version="${APP_VERSION}" \
summary="OLM bundle for the HyperFleet Operator" \
description="OLM bundle for the HyperFleet Operator, which installs and manages HyperFleet." \
com.redhat.component="hyperfleet-operator-bundle-container" \
io.k8s.description="OLM bundle for the HyperFleet Operator, which installs and manages HyperFleet." \
distribution-scope="public" \
release="1" \
url="https://github.com/openshift-hyperfleet/hyperfleet-operator" \
maintainer="Red Hat HyperFleet Team"
57 changes: 0 additions & 57 deletions bundle.konflux.Dockerfile

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading