Skip to content

Task buildah: add feature to allow pushing additional tags#1382

Closed
kastl-ars wants to merge 3 commits into
tektoncd:mainfrom
kastl-ars:20260611_buildah_task_additional_tags
Closed

Task buildah: add feature to allow pushing additional tags#1382
kastl-ars wants to merge 3 commits into
tektoncd:mainfrom
kastl-ars:20260611_buildah_task_additional_tags

Conversation

@kastl-ars

@kastl-ars kastl-ars commented Jun 12, 2026

Copy link
Copy Markdown

Changes

task/buildah/0.10/buildah.yaml: add feature to allow pushing additional tags
This feature allows specifying additional tags like the commit hash or the date or similar, that will be used in addition to "latest".
Please note, those tags need to be strings, not commands like $(date +%Y%m%d).

I have tested this locally and will look into the checklist to see, what I missed.

Discussion see #1373

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Follows the [authoring recommendations][authoring]
  • Includes [docs][docs] (if user facing)
  • Includes [tests][tests] (for new tasks or changed functionality)
    • See the [end-to-end testing documentation][e2e] for guidance and CI details.
  • Meets the [Tekton contributor standards][contributor] (including functionality, content, code)
  • Commit messages follow [commit message best practices][commit]
  • Has a kind label. You can add one by adding a comment on this PR that
    contains /kind <type>. Valid types are bug, cleanup, design, documentation,
    feature, flake, misc, question, tep
  • Complies with [Catalog Organization TEP][TEP], see [example]. Note [An issue has been filed to automate this validation][validation]
    • File path follows <kind>/<name>/<version>/name.yaml
    • Has README.md at <kind>/<name>/<version>/README.md
    • Has mandatory metadata.labels - app.kubernetes.io/version the same as the <version> of the resource
    • Has mandatory metadata.annotations tekton.dev/pipelines.minVersion
    • mandatory spec.description follows the convention

Signed-off-by: Johannes Kastl <johannes.kastl@atvantage.com>
…al tags

This feature allows specifying additional tags like the commit hash or the date or similar,
that will be used in addition to "latest".

Please note, those tags need to be strings, not commands like $(date +%Y%m%d).
@tekton-robot
tekton-robot requested a review from chmouel June 12, 2026 07:02
@tekton-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign chmouel after the PR has been reviewed.
You can assign the PR to them by writing /assign @chmouel in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot
tekton-robot requested a review from imjasonh June 12, 2026 07:02
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 12, 2026

Copy link
Copy Markdown

CLA Not Signed

@kastl-ars

Copy link
Copy Markdown
Author

/kind feature

@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 12, 2026
@tekton-robot

Copy link
Copy Markdown
Diff between version 0.9 and 0.10
diff --git a/task/buildah/0.9/README.md b/task/buildah/0.10/README.md
index 4ac13c1..254298d 100644
--- a/task/buildah/0.9/README.md
+++ b/task/buildah/0.10/README.md
@@ -10,7 +10,7 @@ to assemble a container image, then pushes that image to a container registry.
 ## Install the Task
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.9/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.10/raw
 ```
 
 ## Parameters
diff --git a/task/buildah/0.9/buildah.yaml b/task/buildah/0.10/buildah.yaml
index 91e087b..4927d53 100644
--- a/task/buildah/0.9/buildah.yaml
+++ b/task/buildah/0.10/buildah.yaml
@@ -4,7 +4,7 @@ kind: Task
 metadata:
   name: buildah
   labels:
-    app.kubernetes.io/version: "0.9"
+    app.kubernetes.io/version: "0.10"
   annotations:
     tekton.dev/categories: Image Build
     tekton.dev/pipelines.minVersion: "0.50.0"
@@ -53,6 +53,11 @@ spec:
   - name: SKIP_PUSH
     description: Skip pushing the built image
     default: "false"
+  - name: ADDITIONAL_TAGS
+    type: string
+    default: ""
+    description: |
+      Additional tags for pushing the image.
   - name: BUILD_ARGS
     description: Dockerfile build arguments, array of key=value
     type: array
@@ -96,6 +101,8 @@ spec:
       value: $(params.PUSH_EXTRA_ARGS)
     - name: PARAM_SKIP_PUSH
       value: $(params.SKIP_PUSH)
+    - name: PARAMS_ADDITIONAL_TAGS
+      value: $(params.ADDITIONAL_TAGS)
     args:
     - $(params.BUILD_ARGS[*])
     script: |
@@ -117,6 +124,15 @@ spec:
       buildah ${CERT_DIR_FLAG} "--storage-driver=${PARAM_STORAGE_DRIVER}" push \
         "--tls-verify=${PARAM_TLSVERIFY}" --digestfile /tmp/image-digest ${PARAM_PUSH_EXTRA_ARGS} \
         "${PARAM_IMAGE}" "docker://${PARAM_IMAGE}"
+      # push additional tags, if PARAMS_ADDITIONAL_TAGS is not empty
+      # shellcheck disable=SC2046,SC2086
+      if [ -n "${PARAMS_ADDITIONAL_TAGS}" ]; then
+          for tag in ${PARAMS_ADDITIONAL_TAGS};do
+          buildah ${CERT_DIR_FLAG} "--storage-driver=${PARAM_STORAGE_DRIVER}" push \
+            "--tls-verify=${PARAM_TLSVERIFY}" --digestfile /tmp/image-digest ${PARAM_PUSH_EXTRA_ARGS} \
+            "${PARAM_IMAGE}" "docker://${PARAM_IMAGE}":${tag}
+          done
+      fi
       tee "$(results.IMAGE_DIGEST.path)" < /tmp/image-digest
       printf '%s' "${PARAM_IMAGE}" | tee "$(results.IMAGE_URL.path)"
     volumeMounts:

kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.10/raw
```

## Parameters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADDITIONAL_TAGS param is missing isn't it ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I forgot. I just pushed a commit with the README changes.

Signed-off-by: Johannes Kastl <johannes.kastl@atvantage.com>
@kastl-ars
kastl-ars force-pushed the 20260611_buildah_task_additional_tags branch from 1bcb300 to c541a21 Compare June 19, 2026 04:59
@tekton-robot

Copy link
Copy Markdown
Diff between version 0.9 and 0.10
diff --git a/task/buildah/0.9/README.md b/task/buildah/0.10/README.md
index 4ac13c1..e44b395 100644
--- a/task/buildah/0.9/README.md
+++ b/task/buildah/0.10/README.md
@@ -10,7 +10,7 @@ to assemble a container image, then pushes that image to a container registry.
 ## Install the Task
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.9/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.10/raw
 ```
 
 ## Parameters
@@ -32,6 +32,8 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.9/
 * **PUSH_EXTRA_ARGS**: Extra parameters passed for the push command when
   pushing images. WARNING - must be sanitized to avoid command injection
   (_default:_ `""`)
+* **ADDITIONAL_TAGS**: Additional tags for the newly built image, like a date or
+  a commit hash. Must be plain text, no commands allowed (_default:_ empty)
 * **SKIP_PUSH**: Skip pushing the built image (_default:_ `false`)
 * **BUILD_ARGS**: Dockerfile build arguments, array of key=value (_default:_ [""])
 
diff --git a/task/buildah/0.9/buildah.yaml b/task/buildah/0.10/buildah.yaml
index 91e087b..4927d53 100644
--- a/task/buildah/0.9/buildah.yaml
+++ b/task/buildah/0.10/buildah.yaml
@@ -4,7 +4,7 @@ kind: Task
 metadata:
   name: buildah
   labels:
-    app.kubernetes.io/version: "0.9"
+    app.kubernetes.io/version: "0.10"
   annotations:
     tekton.dev/categories: Image Build
     tekton.dev/pipelines.minVersion: "0.50.0"
@@ -53,6 +53,11 @@ spec:
   - name: SKIP_PUSH
     description: Skip pushing the built image
     default: "false"
+  - name: ADDITIONAL_TAGS
+    type: string
+    default: ""
+    description: |
+      Additional tags for pushing the image.
   - name: BUILD_ARGS
     description: Dockerfile build arguments, array of key=value
     type: array
@@ -96,6 +101,8 @@ spec:
       value: $(params.PUSH_EXTRA_ARGS)
     - name: PARAM_SKIP_PUSH
       value: $(params.SKIP_PUSH)
+    - name: PARAMS_ADDITIONAL_TAGS
+      value: $(params.ADDITIONAL_TAGS)
     args:
     - $(params.BUILD_ARGS[*])
     script: |
@@ -117,6 +124,15 @@ spec:
       buildah ${CERT_DIR_FLAG} "--storage-driver=${PARAM_STORAGE_DRIVER}" push \
         "--tls-verify=${PARAM_TLSVERIFY}" --digestfile /tmp/image-digest ${PARAM_PUSH_EXTRA_ARGS} \
         "${PARAM_IMAGE}" "docker://${PARAM_IMAGE}"
+      # push additional tags, if PARAMS_ADDITIONAL_TAGS is not empty
+      # shellcheck disable=SC2046,SC2086
+      if [ -n "${PARAMS_ADDITIONAL_TAGS}" ]; then
+          for tag in ${PARAMS_ADDITIONAL_TAGS};do
+          buildah ${CERT_DIR_FLAG} "--storage-driver=${PARAM_STORAGE_DRIVER}" push \
+            "--tls-verify=${PARAM_TLSVERIFY}" --digestfile /tmp/image-digest ${PARAM_PUSH_EXTRA_ARGS} \
+            "${PARAM_IMAGE}" "docker://${PARAM_IMAGE}":${tag}
+          done
+      fi
       tee "$(results.IMAGE_DIGEST.path)" < /tmp/image-digest
       printf '%s' "${PARAM_IMAGE}" | tee "$(results.IMAGE_URL.path)"
     volumeMounts:

1 similar comment
@tekton-robot

Copy link
Copy Markdown
Diff between version 0.9 and 0.10
diff --git a/task/buildah/0.9/README.md b/task/buildah/0.10/README.md
index 4ac13c1..e44b395 100644
--- a/task/buildah/0.9/README.md
+++ b/task/buildah/0.10/README.md
@@ -10,7 +10,7 @@ to assemble a container image, then pushes that image to a container registry.
 ## Install the Task
 
 ```
-kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.9/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.10/raw
 ```
 
 ## Parameters
@@ -32,6 +32,8 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.9/
 * **PUSH_EXTRA_ARGS**: Extra parameters passed for the push command when
   pushing images. WARNING - must be sanitized to avoid command injection
   (_default:_ `""`)
+* **ADDITIONAL_TAGS**: Additional tags for the newly built image, like a date or
+  a commit hash. Must be plain text, no commands allowed (_default:_ empty)
 * **SKIP_PUSH**: Skip pushing the built image (_default:_ `false`)
 * **BUILD_ARGS**: Dockerfile build arguments, array of key=value (_default:_ [""])
 
diff --git a/task/buildah/0.9/buildah.yaml b/task/buildah/0.10/buildah.yaml
index 91e087b..4927d53 100644
--- a/task/buildah/0.9/buildah.yaml
+++ b/task/buildah/0.10/buildah.yaml
@@ -4,7 +4,7 @@ kind: Task
 metadata:
   name: buildah
   labels:
-    app.kubernetes.io/version: "0.9"
+    app.kubernetes.io/version: "0.10"
   annotations:
     tekton.dev/categories: Image Build
     tekton.dev/pipelines.minVersion: "0.50.0"
@@ -53,6 +53,11 @@ spec:
   - name: SKIP_PUSH
     description: Skip pushing the built image
     default: "false"
+  - name: ADDITIONAL_TAGS
+    type: string
+    default: ""
+    description: |
+      Additional tags for pushing the image.
   - name: BUILD_ARGS
     description: Dockerfile build arguments, array of key=value
     type: array
@@ -96,6 +101,8 @@ spec:
       value: $(params.PUSH_EXTRA_ARGS)
     - name: PARAM_SKIP_PUSH
       value: $(params.SKIP_PUSH)
+    - name: PARAMS_ADDITIONAL_TAGS
+      value: $(params.ADDITIONAL_TAGS)
     args:
     - $(params.BUILD_ARGS[*])
     script: |
@@ -117,6 +124,15 @@ spec:
       buildah ${CERT_DIR_FLAG} "--storage-driver=${PARAM_STORAGE_DRIVER}" push \
         "--tls-verify=${PARAM_TLSVERIFY}" --digestfile /tmp/image-digest ${PARAM_PUSH_EXTRA_ARGS} \
         "${PARAM_IMAGE}" "docker://${PARAM_IMAGE}"
+      # push additional tags, if PARAMS_ADDITIONAL_TAGS is not empty
+      # shellcheck disable=SC2046,SC2086
+      if [ -n "${PARAMS_ADDITIONAL_TAGS}" ]; then
+          for tag in ${PARAMS_ADDITIONAL_TAGS};do
+          buildah ${CERT_DIR_FLAG} "--storage-driver=${PARAM_STORAGE_DRIVER}" push \
+            "--tls-verify=${PARAM_TLSVERIFY}" --digestfile /tmp/image-digest ${PARAM_PUSH_EXTRA_ARGS} \
+            "${PARAM_IMAGE}" "docker://${PARAM_IMAGE}":${tag}
+          done
+      fi
       tee "$(results.IMAGE_DIGEST.path)" < /tmp/image-digest
       printf '%s' "${PARAM_IMAGE}" | tee "$(results.IMAGE_URL.path)"
     volumeMounts:

@kastl-ars

Copy link
Copy Markdown
Author

For some reason I cannot sign the CLA, I'll try creating a new PR with my private account.

@kastl-ars kastl-ars closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants