Skip to content

Commit fa8c2d1

Browse files
committed
Use opm in tekton pipelines
1 parent 52aff9a commit fa8c2d1

6 files changed

Lines changed: 82 additions & 28 deletions

File tree

pkg/konfluxgen/fbc-builder.yaml

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ spec:
3030
description: Additional image tags
3131
name: additional-tags
3232
type: array
33+
- default: []
34+
description: Array of opm command arguments
35+
name: opm-args
36+
type: array
37+
- default: ""
38+
description: OPM output path
39+
name: opm-output-path
40+
type: string
3341
- description: Source Repository URL
3442
name: git-url
3543
type: string
@@ -115,6 +123,32 @@ spec:
115123
- name: kind
116124
value: task
117125
resolver: bundles
126+
- name: run-opm-command
127+
params:
128+
- name: OPM_ARGS
129+
value:
130+
- $(params.opm-args[*])
131+
- name: OPM_OUTPUT_PATH
132+
value: $(params.opm-output-path)
133+
- name: SOURCE_ARTIFACT
134+
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
135+
- name: ociStorage
136+
value: $(params.output-image).opm
137+
- name: ociArtifactExpiresAfter
138+
value: $(params.image-expires-after)
139+
- name: IDMS_PATH
140+
value: ""
141+
runAfter:
142+
- clone-repository
143+
taskRef:
144+
params:
145+
- name: name
146+
value: run-opm-command-oci-ta
147+
- name: bundle
148+
value: quay.io/konflux-ci/tekton-catalog/task-run-opm-command-oci-ta:0.1@sha256:c79858b867713e44927438f6193c49004bf40bfd9248682f20c5a83ea2a9d2f1
149+
- name: kind
150+
value: task
151+
resolver: bundles
118152
- name: init
119153
params:
120154
- name: enable-cache-proxy
@@ -152,31 +186,6 @@ spec:
152186
workspaces:
153187
- name: basic-auth
154188
workspace: git-auth
155-
- name: run-opm-command
156-
params:
157-
- name: SOURCE_ARTIFACT
158-
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
159-
- name: ociStorage
160-
value: $(params.output-image).opm
161-
- name: ociArtifactExpiresAfter
162-
value: $(params.image-expires-after)
163-
- name: OPM_ARGS
164-
value: []
165-
- name: OPM_OUTPUT_PATH
166-
value: ""
167-
- name: IDMS_PATH
168-
value: ""
169-
runAfter:
170-
- clone-repository
171-
taskRef:
172-
params:
173-
- name: name
174-
value: run-opm-command-oci-ta
175-
- name: bundle
176-
value: quay.io/konflux-ci/tekton-catalog/task-run-opm-command-oci-ta:0.1@sha256:c79858b867713e44927438f6193c49004bf40bfd9248682f20c5a83ea2a9d2f1
177-
- name: kind
178-
value: task
179-
resolver: bundles
180189
- name: prefetch-dependencies
181190
params:
182191
- name: input

pkg/konfluxgen/konfluxgen.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ type Config struct {
100100
Excludes []string
101101
ExcludesImages []string
102102

103-
FBCImages []string
104-
JavaImages []string
105-
BundleImage string
103+
FBCImages []string
104+
OpmArgs []string
105+
OpmOutputPath string
106+
JavaImages []string
107+
BundleImage string
106108

107109
ResourcesOutputPathSkipRemove bool
108110
ResourcesOutputPath string
@@ -381,6 +383,8 @@ func Generate(cfg Config) error {
381383
DockerfilePath: dockerfilePath,
382384

383385
PipelineRunAnnotations: cfg.PipelineRunAnnotationsFunc(c.ReleaseBuildConfiguration, ib),
386+
OpmArgs: cfg.OpmArgs,
387+
OpmOutputPath: cfg.OpmOutputPath,
384388
}
385389

386390
// TODO REVIEW: Remove special case once all hermetic builds are moved to docker-java-build pipeline With actual hermetic builds
@@ -686,6 +690,9 @@ type DockerfileApplicationConfig struct {
686690

687691
DockerfilePath string
688692

693+
OpmArgs []string
694+
OpmOutputPath string
695+
689696
PipelineRunAnnotations map[string]string
690697
}
691698

pkg/konfluxgen/kustomize/kustomize-fbc-builder/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ kind: Kustomization
44
resources:
55
- ../fbc-builder.yaml
66
patches:
7+
- path: patch_opm_params.patch.yaml
8+
target:
9+
kind: Pipeline
710
- path: ../patch_additional_tags.patch.yaml
811
target:
912
kind: Pipeline
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: tekton.dev/v1
2+
kind: Pipeline
3+
metadata:
4+
name: fbc-builder
5+
spec:
6+
params:
7+
- name: opm-args
8+
description: Array of opm command arguments
9+
type: array
10+
default: []
11+
- name: opm-output-path
12+
description: OPM output path
13+
type: string
14+
default: ""
15+
tasks:
16+
- name: run-opm-command
17+
params:
18+
- name: OPM_ARGS
19+
value:
20+
- $(params.opm-args[*])
21+
- name: OPM_OUTPUT_PATH
22+
value: $(params.opm-output-path)

pkg/konfluxgen/pipeline-run.template.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ spec:
7474
- name: prefetch-input-dev-package-managers
7575
value: '{{{ .PrefetchDeps.DevPackageManagers }}}'
7676
{{{- end }}}
77+
{{{- if gt (len .OpmArgs) 0 }}}
78+
- name: opm-args
79+
value:
80+
{{{- range $arg := .OpmArgs }}}
81+
- {{{ $arg }}}
82+
{{{- end }}}
83+
{{{- end }}}
84+
{{{- if .OpmOutputPath }}}
85+
- name: opm-output-path
86+
value: {{{ .OpmOutputPath }}}
87+
{{{- end }}}
7788
{{{- if or (eq .Pipeline "docker-build") (eq .Pipeline "docker-java-build") (eq .Pipeline "bundle-build")}}}
7889
taskRunSpecs:
7990
- pipelineTaskName: sast-shell-check

pkg/prowgen/prowgen_konflux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@ func generateFBCApplications(soMetadata *project.Metadata, openshiftRelease Repo
574574
" files.all.exists(x, x.matches('^.tekton/'))"+
575575
" )", ocpVersion)
576576
},
577+
OpmArgs: []string{"alpha", "render", "basic", fmt.Sprintf("\"/olm-catalog/serverless-operator-index/v%s/catalog-template.yaml\"", ocpVersion), "--migrate-level=bundle-object-to-csv-metadata"},
578+
OpmOutputPath: fmt.Sprintf("\"/olm-catalog/serverless-operator-index/v%s/catalog/serverless-operator/catalog.yaml\"", ocpVersion),
577579
AdditionalComponentConfigs: []konfluxgen.TemplateConfig{
578580
{
579581
ReleaseBuildConfiguration: cioperatorapi.ReleaseBuildConfiguration{

0 commit comments

Comments
 (0)