diff --git a/pipelines/template-build/template-build.yaml b/pipelines/template-build/template-build.yaml index ab3fdcf58c..27b3799b93 100644 --- a/pipelines/template-build/template-build.yaml +++ b/pipelines/template-build/template-build.yaml @@ -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: @@ -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: diff --git a/task/buildah-remote/0.1/buildah-remote.yaml b/task/buildah-remote/0.1/buildah-remote.yaml index b8be56b09c..aa9a6f9a61 100644 --- a/task/buildah-remote/0.1/buildah-remote.yaml +++ b/task/buildah-remote/0.1/buildah-remote.yaml @@ -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 @@ -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: @@ -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}/${BUILD_ARGS_FILE}") + fi + if [ -n "${PREFETCH_INPUT}" ]; then cp -r cachi2 /tmp/ chmod -R go+rwX /tmp/cachi2 @@ -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" \ diff --git a/task/buildah/0.1/buildah.yaml b/task/buildah/0.1/buildah.yaml index 9387fb5661..45fe9f974f 100644 --- a/task/buildah/0.1/buildah.yaml +++ b/task/buildah/0.1/buildah.yaml @@ -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 @@ -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 @@ -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