Skip to content

Commit

Permalink
Merge pull request #131 from arewm/add-build-args-file
Browse files Browse the repository at this point in the history
Add build args file
  • Loading branch information
arewm authored Sep 11, 2024
2 parents 7681656 + fc8b00c commit 3448b6a
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion docs/modules/ROOT/pages/how-tos/configuring/build-with-args.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
= Passing buildah arguments

{ProductName} buildah task accepts link:https://github.com/konflux-ci/build-definitions/blob/main/task/buildah/0.1/buildah.yaml#L78[`BUILD_ARGS` parameter] that allows passing build arguments to the underlying `buildah` command through `--build-arg` flag. To enable this, make the following changes to the PipelineRuns under the `.tekton/` directory:
It is possible to link:https://github.com/containers/buildah/blob/main/docs/buildah-build.1.md[pass arguments to buildah] which is used to build container images in {ProductName}.

== Using an arguments file

The {ProductName} buildah tasks accept link:https://github.com/konflux-ci/build-definitions/blob/main/task/buildah/0.2/buildah.yaml#L78[`BUILD_ARGS` parameter] that allows passing build arguments to the underlying `buildah` command through `--build-arg-file` flag. To enable this, make the following changes to the PipelineRuns under the `.tekton/` directory:

. Create a build args file in your repository. This should contain lines of build arguments in the form of *arg=value*.
. Define a `build-args-file` Pipeline parameter (if not already present) in `.spec.pipelineSpec.params` to accept the passed-in build arguments.

+
[source,yaml]
--
spec:
# ...
pipelineSpec:
params:
# ...
- name: build-args-file
type: string
default: ""
--

. Pass the argument to link:https://github.com/konflux-ci/build-definitions/tree/main/task/buildah/[buildah task]. Add `BUILD_ARGS_FILE` to `build-container.params` (if not already present):

+
[source,yaml]
--
spec:
# ...
pipelineSpec:
tasks:
# ...
- name: build-container
params:
# ...
- name: BUILD_ARGS_FILE
value: "$(params.build-args-file)"
--

. Set the build arguments file in the PipelineRun `.spec.params`:

+
[source,yaml]
--
spec:
params:
# ...
- name: build-args-file
value: path/to/args-file # Add the real path to the build args file within the build context
--

== Setting arguments in the pipeline parameters

The {ProductName} buildah tasks accept link:https://github.com/konflux-ci/build-definitions/blob/main/task/buildah/0.2/buildah.yaml#L74[`BUILD_ARGS` parameter] that allows passing build arguments to the underlying `buildah` command through `--build-arg` flag. To enable this, make the following changes to the PipelineRuns under the `.tekton/` directory:

. Define a `build-args` Pipeline parameter (if not already present) in `.spec.pipelineSpec.params` to accept the passed-in build arguments.

Expand Down

0 comments on commit 3448b6a

Please sign in to comment.