Skip to content

Commit 2352d3e

Browse files
committed
Prevent overriding of pullspec set by CI
CI is expected to set a specific pullspec for the NHC image it is building and testing. This pullspec however was overridden by our multistep image build in bundle.ci.Dockerfile (which in turn is necessary to test the console-plugin, which is only contained in the OCP bundle). This change prevents such overriding by: - getting the current pullspec, set by CI, and - exporting it as IMG environ variable to be used when building the bundle. Signed-off-by: Carlo Lobrano <[email protected]>
1 parent df79b73 commit 2352d3e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ bundle-okd: ocp-version-check yq bundle-base ## Generate bundle manifests and me
357357

358358
.PHONY: bundle-ocp
359359
bundle-ocp: yq bundle-base ## Generate bundle manifests and metadata for OCP, then validate generated files.
360+
$(shell rm -r bundle) # OCP bundle should be created from scratch
360361
$(KUSTOMIZE) build config/manifests/ocp | $(OPERATOR_SDK) generate --verbose bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
361362
sed -r -i "s|DOCS_RHWA_VERSION|${DOCS_RHWA_VERSION}|g;" "${CSV}"
362363
# Add env var with must gather image to the NHC container, so its pullspec gets added to the relatedImages section by OSBS
@@ -377,6 +378,10 @@ bundle-ocp: yq bundle-base ## Generate bundle manifests and metadata for OCP, th
377378
ICON_BASE64="$(shell base64 --wrap=0 ./config/assets/nhc_red.png)" \
378379
$(MAKE) bundle-update
379380

381+
.PHONY: bundle-ocp-ci
382+
bundle-ocp-ci: yq ## Generate OCP bundle for CI, without overriding the image pull-spec (CI only)
383+
IMG="$(shell $(YQ) -r '.metadata.annotations.containerImage' ${CSV})" \
384+
$(MAKE) bundle-ocp
380385

381386
.PHONY: bundle-k8s
382387
bundle-k8s: bundle-base ## Generate bundle manifests and metadata for K8s community, then validate generated files.

bundle.ci.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ COPY go.sum go.sum
1212
COPY PROJECT PROJECT
1313
COPY Makefile Makefile
1414
COPY config/ config/
15+
COPY bundle/ bundle/
1516
COPY hack/ hack/
1617

1718
COPY main.go main.go
@@ -21,8 +22,8 @@ COPY controllers/ controllers/
2122
COPY metrics/ metrics/
2223
COPY vendor/ vendor/
2324

24-
# Generate OCP bundle
25-
RUN make bundle-ocp
25+
# Generate OCP bundle without overriding the pullspec set by the CI
26+
RUN make bundle-ocp-ci
2627

2728
# Build bundle image for OCP CI
2829
FROM scratch

0 commit comments

Comments
 (0)