Skip to content

Commit

Permalink
sast-coverity-check: test names of patched objects
Browse files Browse the repository at this point in the history
... which have to be indexed by numbers due to limitations of kustomize

Related: https://issues.redhat.com/browse/KONFLUX-6272
Closes: #1653
  • Loading branch information
kdudka committed Jan 10, 2025
1 parent 5ddffac commit e314d78
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
8 changes: 7 additions & 1 deletion pipelines/docker-build/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
# 17 rpms-signature-scan

# build-container
- op: test
path: /spec/tasks/3/name
value: build-container
- op: replace
path: /spec/tasks/3/taskRef
value:
Expand Down Expand Up @@ -79,8 +82,11 @@
value: "$(params.build-args-file)"

# FIXME: duplicate the "add" operation for sast-coverity-check, which is based on build-container
- op: test
path: /spec/tasks/11/name
value: sast-coverity-check
- op: add
path: /spec/tasks/11/params # sast-coverity-check
path: /spec/tasks/11/params
value:
- name: IMAGE
value: $(params.output-image)
Expand Down
44 changes: 39 additions & 5 deletions task/sast-coverity-check/0.2/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,46 @@
###################

# Remove all buildah task steps except build

# upload-sbom
- op: test
path: /spec/steps/5/name
value: upload-sbom
- op: remove
path: /spec/steps/5 # upload-sbom
path: /spec/steps/5

# prepare-sboms
- op: test
path: /spec/steps/4/name
value: prepare-sboms
- op: remove
path: /spec/steps/4 # prepare-sboms
path: /spec/steps/4

# sbom-syft-generate
- op: test
path: /spec/steps/3/name
value: sbom-syft-generate
- op: remove
path: /spec/steps/3 # sbom-syft-generate
path: /spec/steps/3

# push
- op: test
path: /spec/steps/2/name
value: push
- op: remove
path: /spec/steps/2 # push
path: /spec/steps/2

# icm
- op: test
path: /spec/steps/1/name
value: icm
- op: remove
path: /spec/steps/1 # icm
path: /spec/steps/1

# Tune the build step (the only one left).
- op: test
path: /spec/steps/0/name
value: build

# Change build step image
- op: replace
Expand Down Expand Up @@ -217,11 +245,17 @@
cstrans-df-run --verbose /shared/cmd-wrap.sh < "$dockerfile_path" > /shared/Containerfile
# Make the buildah task use the instrumented Dockerfile
- op: test
path: /spec/steps/1/env/1/name
value: DOCKERFILE
- op: replace
path: /spec/steps/1/env/1/value # steps -> build -> env -> DOCKERFILE
value: /shared/Containerfile

# Add postprocess step
- op: test
path: /spec/steps/1/name
value: build
- op: add
path: /spec/steps/2
value:
Expand Down

0 comments on commit e314d78

Please sign in to comment.