Skip to content

Commit

Permalink
Add a matrixed multi-arch pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: arewm <[email protected]>
  • Loading branch information
arewm committed Aug 2, 2024
1 parent c9a479c commit 5878a49
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
Empty file.
9 changes: 9 additions & 0 deletions pipelines/docker-build-multi-arch-oci-ta/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../docker-build-oci-ta

patches:
- path: patch.yaml
target:
kind: Pipeline
73 changes: 73 additions & 0 deletions pipelines/docker-build-multi-arch-oci-ta/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
- op: replace
path: /metadata/name
value: docker-build-multi-arch-oci-ta
# Order of Tasks from the base docker-build Pipeline:
# $ kustomize build pipelines/docker-build-oci-ta | yq ".spec.tasks.[].name" | nl -v 0
# 0 init
# 1 clone-repository
# 2 prefetch-dependencies
# 3 build-container
# 4 build-image-index
# 5 build-source-image
# 6 deprecated-base-image-check
# 7 clair-scan
# 8 ecosystem-cert-preflight-checks
# 9 sast-snyk-check
# 10 clamav-scan
# 11 sbom-json-check
# 12 apply-tags
# 13 push-dockerfile
# change name to build-containers
# add build-platforms parameter
# add matrix to run based on build-platforms
# change build-image-index to use results from build-containers as well as run after it
# change build-image-index to build image index
# change JAVA_COMMUNITY_DEPENDENCIES value to "$(tasks.build-containers.results.JAVA_COMMUNITY_DEPENDENCIES[0])"

# build-container
- op: replace
path: /spec/tasks/3/name
value: build-containers
- op: replace
path: /spec/tasks/3/taskRef/name
value: buildah-remote-oci-ta
- op: add
path: /spec/tasks/3/matrix
value:
params:
- name: PLATFORM
value: ["$(params.build-platforms)"]

# build-image-index
- op: replace
path: /spec/tasks/4/params
value:
- name: IMAGE
value: $(params.output-image)
- name: COMMIT_SHA
value: $(tasks.clone-repository.results.commit)
- name: BUILD_IMAGE_INDEX
value: "true"
- name: IMAGES
value:
- $(tasks.build-containers.results.IMAGE_REF[*])
- op: replace
path: /spec/tasks/4/runAfter
value:
- build-containers

# Add a pipeline definition parameter to customize the build platforms
- op: add
path: /spec/params/-
value:
name: build-platforms
description: List of platforms to build the container images on. The available set of values is determined by the configuration of the multi-platform-controller.
type: array
default:
- "local/amd64"

# Just use the first container built for the JAVA_COMMUNITY_DEPENDENCIES result
- op: replace
path: /spec/results/4/value
value: $(tasks.build-containers.results.JAVA_COMMUNITY_DEPENDENCIES[0])

0 comments on commit 5878a49

Please sign in to comment.