Skip to content

Commit

Permalink
new build-args-file parameter which allows to pass build arguments to
Browse files Browse the repository at this point in the history
buildah task

KONFLUX-268

Signed-off-by: Robert Cerven <[email protected]>
  • Loading branch information
rcerven committed Apr 15, 2024
1 parent d4b49e5 commit 070c652
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pipelines/template-build/template-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ spec:
description: Build a source image.
type: string
default: "false"
- name: build-args-file
description: Path to a file with build arguments which will be passed to podman during build
type: string
default: ""
tasks:
- name: init
params:
Expand Down Expand Up @@ -106,6 +110,9 @@ spec:
- input: $(tasks.init.results.build)
operator: in
values: ["true"]
params:
- name: BUILD_ARGS_FILE
value: "$(params.build-args-file)"
runAfter:
- prefetch-dependencies
taskRef:
Expand Down
12 changes: 12 additions & 0 deletions task/buildah-remote/0.1/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ spec:
description: Name of secret which contains the entitlement certificates
name: ENTITLEMENT_SECRET
type: string
- default: ""
description: Path to a file with build arguments which will be passed to podman
during build
name: BUILD_ARGS_FILE
type: string
- description: The platform to build on
name: PLATFORM
type: string
Expand Down Expand Up @@ -127,6 +132,8 @@ spec:
value: $(params.BUILDER_IMAGE)
- name: ENTITLEMENT_SECRET
value: $(params.ENTITLEMENT_SECRET)
- name: BUILD_ARGS_FILE
value: $(params.BUILD_ARGS_FILE)
- name: BUILDER_IMAGE
value: quay.io/redhat-appstudio/buildah:v1.31.0@sha256:34f12c7b72ec2c28f1ded0c494b428df4791c909f1f174dd21b8ed6a57cf5ddb
steps:
Expand Down Expand Up @@ -234,6 +241,10 @@ spec:
BUILDAH_ARGS+=("--target=${TARGET_STAGE}")
fi
if [ -n "${BUILD_ARGS_FILE}" ]; then
BUILDAH_ARGS+=("--build-arg-file=${SOURCE_CODE_DIR}/${CONTEXT}/${BUILD_ARGS_FILE}")
fi
if [ -n "${PREFETCH_INPUT}" ]; then
cp -r cachi2 /tmp/
chmod -R go+rwX /tmp/cachi2
Expand Down Expand Up @@ -317,6 +328,7 @@ spec:
-e TARGET_STAGE="$TARGET_STAGE" \
-e PARAM_BUILDER_IMAGE="$PARAM_BUILDER_IMAGE" \
-e ENTITLEMENT_SECRET="$ENTITLEMENT_SECRET" \
-e BUILD_ARGS_FILE="$BUILD_ARGS_FILE" \
-e COMMIT_SHA="$COMMIT_SHA" \
-v "$BUILD_DIR/workspaces/source:$(workspaces.source.path):Z" \
-v "$BUILD_DIR/.docker/:/root/.docker:Z" \
Expand Down
12 changes: 12 additions & 0 deletions task/buildah/0.1/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ spec:
description: Name of secret which contains the entitlement certificates
type: string
default: "etc-pki-entitlement"
- name: BUILD_ARGS_FILE
description: Path to a file with build arguments which will be passed to podman during build
type: string
default: ""

results:
- description: Digest of the image just built
name: IMAGE_DIGEST
Expand Down Expand Up @@ -115,6 +120,9 @@ spec:
value: $(params.BUILDER_IMAGE)
- name: ENTITLEMENT_SECRET
value: $(params.ENTITLEMENT_SECRET)
- name: BUILD_ARGS_FILE
value: $(params.BUILD_ARGS_FILE)

steps:
- image: quay.io/redhat-appstudio/buildah:v1.31.0@sha256:34f12c7b72ec2c28f1ded0c494b428df4791c909f1f174dd21b8ed6a57cf5ddb
name: build
Expand Down Expand Up @@ -185,6 +193,10 @@ spec:
BUILDAH_ARGS+=("--target=${TARGET_STAGE}")
fi
if [ -n "${BUILD_ARGS_FILE}" ]; then
BUILDAH_ARGS+=("--build-arg-file=${SOURCE_CODE_DIR}/${BUILD_ARGS_FILE}")
fi
if [ -n "${PREFETCH_INPUT}" ]; then
cp -r cachi2 /tmp/
chmod -R go+rwX /tmp/cachi2
Expand Down

0 comments on commit 070c652

Please sign in to comment.