Skip to content

Commit acbbd3e

Browse files
committed
Introduce 'run-opm-command' in the fbc pipeline
1 parent 19b03fb commit acbbd3e

File tree

6 files changed

+88
-32
lines changed

6 files changed

+88
-32
lines changed

.konflux/Dockerfile.catalog

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,18 @@
22
ARG OPM_IMAGE=registry.redhat.io/openshift4/ose-operator-registry-rhel9:v4.18
33
ARG BUILDER_IMAGE=brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.23
44

5-
# build the catalog
5+
# fix the catalog (talm exclusive, naming issue)
66
FROM ${BUILDER_IMAGE} AS builder
77

8-
# create dir structure to generate the catalog
9-
RUN mkdir -p /app/hack /app/.konflux/catalog
8+
# create dir structure to fix the catalog
9+
RUN mkdir -p /app/.konflux/catalog
1010
COPY Makefile /app
1111
COPY .konflux/catalog/ /app/.konflux/catalog/
12-
COPY telco5g-konflux /app/telco5g-konflux
13-
1412
# we need to copy the vendor/ folder as the Makefile depends on it
1513
COPY vendor/ /app/vendor/
1614

17-
# generate the catalog
18-
19-
# debug
20-
RUN echo "root dir" && ls -lra $HOME
21-
2215
WORKDIR /app
23-
RUN --mount=type=secret,id=telco-5g-redhat-pull-secret/.dockerconfigjson \
24-
mkdir -p $HOME/.docker/ && \
25-
cp /run/secrets/telco-5g-redhat-pull-secret/.dockerconfigjson $HOME/.docker/config.json
26-
27-
# debug
28-
RUN echo "run secrets" && ls -lra /run/secrets/ && echo "docker dir" && ls -lra $HOME/.docker/ && cat $HOME/.docker/config.json
29-
30-
ENV REGISTRY_AUTH_FILE=$HOME/.docker/config.json
31-
32-
# The Konflux build is not hermetic so it will download the tools (opm, yq, etc) automatically
33-
# Konflux will externally sync the submodules so we can skip it here
34-
RUN SKIP_SUBMODULE_SYNC=yes make konflux-generate-catalog-production && \
35-
rm -f $HOME/.docker/config.json
16+
RUN SKIP_SUBMODULE_SYNC=yes make konflux-fix-catalog-name
3617

3718
# run the catalog
3819
FROM ${OPM_IMAGE}
@@ -43,6 +24,8 @@ CMD ["serve", "/configs", "--cache-dir=/tmp/cache"]
4324
# ensure this correponds to olm.package name
4425
ENV PACKAGE_NAME=topology-aware-lifecycle-manager
4526

27+
# This assumes that the catalog is already built and exists in the .konflux/catalog/$PACKAGE_NAME directory
28+
# This should be done automatically by the fbc pipeline using the `run-opm-command` task
4629
COPY --from=builder /app/.konflux/catalog/$PACKAGE_NAME/ /configs/$PACKAGE_NAME
4730
# RUN ["/bin/opm", "validate", "/configs/topology-aware-lifecycle-manager"]
4831
RUN ["/bin/opm", "serve", "/configs", "--cache-dir=/tmp/cache", "--cache-only"]

.konflux/catalog/catalog-idms.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
# We use this IDMS to map the quay.io build to registry.redhat.io in the catalog.json post rendering
3+
apiVersion: config.openshift.io/v1
4+
kind: ImageDigestMirrorSet
5+
metadata:
6+
name: catalog-idms
7+
spec:
8+
imageDigestMirrors:
9+
- mirrors:
10+
- quay.io/redhat-user-workloads/telco-5g-tenant/topology-aware-lifecycle-manager-bundle-4-18
11+
source: registry.redhat.io/openshift4/topology-aware-lifecycle-manager-operator-bundle
12+

.tekton/fbc-pipeline.yaml

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,78 @@ spec:
148148
workspaces:
149149
- name: basic-auth
150150
workspace: git-auth
151+
- name: run-opm-pre-actions
152+
params:
153+
- name: ociStorage
154+
value: $(params.output-image).script
155+
- name: ociArtifactExpiresAfter
156+
value: $(params.image-expires-after)
157+
- name: SCRIPT_RUNNER_IMAGE
158+
value: quay.io/konflux-ci/yq:latest
159+
# update catalog template
160+
- name: SCRIPT
161+
value: ./telco5g-konflux/scripts/catalog/konflux-update-catalog-template.sh --set-catalog-template-input-file .konflux/catalog/catalog-template.in.yaml --set-bundle-builds-file .konflux/catalog/bundle.builds.in.yaml
162+
- name: HERMETIC
163+
value: $(params.hermetic)
164+
- name: SOURCE_ARTIFACT
165+
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
166+
runAfter:
167+
- clone-repository
168+
taskRef:
169+
params:
170+
- name: name
171+
value: run-script-oci-ta
172+
- name: bundle
173+
value: quay.io/konflux-ci/tekton-catalog/task-run-script-oci-ta:0.1@sha256:834a934f1e631a79aea7f2d001162cf90086e664e648c8ca15b69ad9798571ee
174+
- name: kind
175+
value: task
176+
resolver: bundles
177+
- name: run-opm-command
178+
params:
179+
- name: SOURCE_ARTIFACT
180+
value: $(tasks.run-opm-pre-actions.results.SCRIPT_ARTIFACT)
181+
- name: ociStorage
182+
value: $(params.output-image).opm
183+
- name: ociArtifactExpiresAfter
184+
value: $(params.image-expires-after)
185+
- name: OPM_ARGS
186+
value:
187+
- alpha
188+
- render-template
189+
- basic
190+
# arg for OCP 4.17 and newer
191+
- "--migrate-level=bundle-object-to-csv-metadata"
192+
- ".konflux/catalog/catalog-template.in.yaml"
193+
- name: OPM_OUTPUT_PATH
194+
value: ".konflux/catalog/topology-aware-lifecycle-manager/catalog.json"
195+
# replace catalog.json pullspecs with idms config
196+
- name: IDMS_PATH
197+
value: ".konflux/catalog/catalog-idms.yaml"
198+
- name: FILE_TO_UPDATE_PULLSPEC
199+
value: ".konflux/catalog/topology-aware-lifecycle-manager/catalog.json"
200+
runAfter:
201+
- run-opm-pre-actions
202+
taskRef:
203+
params:
204+
- name: name
205+
value: run-opm-command-oci-ta
206+
- name: bundle
207+
value: quay.io/konflux-ci/tekton-catalog/task-run-opm-command-oci-ta:0.1@sha256:4ab5dba35166a976c3d6293913501fdfc79a3222395388fc6208641ab8bc9359
208+
- name: kind
209+
value: task
210+
resolver: bundles
151211
- name: prefetch-dependencies
152212
params:
153213
- name: input
154214
value: $(params.prefetch-input)
155215
- name: SOURCE_ARTIFACT
156-
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
216+
value: $(tasks.run-opm-command.results.SOURCE_ARTIFACT)
157217
- name: ociStorage
158218
value: $(params.output-image).prefetch
159219
- name: ociArtifactExpiresAfter
160220
value: $(params.image-expires-after)
161221
runAfter:
162-
- clone-repository
222+
- run-opm-command
163223
taskRef:
164224
params:
165225
- name: name
@@ -202,6 +262,9 @@ spec:
202262
value: $(params.build-args-file)
203263
- name: SOURCE_ARTIFACT
204264
value: $(tasks.prefetch-dependencies.results.SOURCE_ARTIFACT)
265+
- name: ADDITIONAL_BASE_IMAGES
266+
value:
267+
- $(tasks.run-opm-pre-actions.results.SCRIPT_RUNNER_IMAGE_REFERENCE)
205268
- name: CACHI2_ARTIFACT
206269
value: $(tasks.prefetch-dependencies.results.CACHI2_ARTIFACT)
207270
- name: IMAGE_APPEND_PLATFORM

.tekton/topology-aware-lifecycle-manager-fbc-4-18-pull-request.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ spec:
4848
value: .konflux/container_build_args.conf
4949
- name: additional-tags
5050
value: []
51-
# We have configured an fbc exception for hermetic builds on the release repo.
5251
- name: hermetic
53-
value: "false"
52+
value: "true"
5453
pipelineRef:
5554
name: fbc-pipeline
5655
taskRunTemplate:

.tekton/topology-aware-lifecycle-manager-fbc-4-18-push.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ spec:
4545
value: .konflux/container_build_args.conf
4646
- name: additional-tags
4747
value: ["latest"]
48-
# We have configured an fbc exception for hermetic builds on the release repo.
4948
- name: hermetic
50-
value: "false"
49+
value: "true"
5150
pipelineRef:
5251
name: fbc-pipeline
5352
taskRunTemplate:

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ CRD_OPTIONS ?= "crd"
8686
PACKAGE_NAME_KONFLUX = topology-aware-lifecycle-manager
8787
CATALOG_TEMPLATE_KONFLUX_INPUT = .konflux/catalog/catalog-template.in.yaml
8888
CATALOG_TEMPLATE_KONFLUX_OUTPUT = .konflux/catalog/catalog-template.out.yaml
89-
CATALOG_KONFLUX = .konflux/catalog/$(PACKAGE_NAME_KONFLUX)/catalog.yaml
89+
CATALOG_KONFLUX = .konflux/catalog/$(PACKAGE_NAME_KONFLUX)/catalog.json
9090

9191
# Konflux bundle image configuration
9292
BUNDLE_NAME_SUFFIX = bundle-4-18
@@ -554,9 +554,9 @@ sync-git-submodules:
554554
.PHONY: konflux-fix-catalog-name
555555
konflux-fix-catalog-name: ## Fix catalog package name for TALM
556556
if [ "$$(uname)" = "Darwin" ]; then \
557-
sed -i '' 's/cluster-group-upgrades-operator/topology-aware-lifecycle-manager/g' .konflux/catalog/$(PACKAGE_NAME_KONFLUX)/catalog.yaml; \
557+
sed -i '' 's/cluster-group-upgrades-operator/topology-aware-lifecycle-manager/g' $(CATALOG_KONFLUX); \
558558
else \
559-
sed -i 's/cluster-group-upgrades-operator/topology-aware-lifecycle-manager/g' .konflux/catalog/$(PACKAGE_NAME_KONFLUX)/catalog.yaml; \
559+
sed -i 's/cluster-group-upgrades-operator/topology-aware-lifecycle-manager/g' $(CATALOG_KONFLUX); \
560560
fi
561561

562562
.PHONY: konflux-validate-catalog-template-bundle

0 commit comments

Comments
 (0)