Skip to content

Commit

Permalink
fix: apply-mapping no longer fails if build-date is null (#561)
Browse files Browse the repository at this point in the history
Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren authored Sep 18, 2024
1 parent 41f52bb commit 1d11b05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tasks/apply-mapping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ This task supports variable expansion in tag values from the mapping. The curren
| dataPath | Path to the JSON string of the merged data to use in the data workspace | No | - |
| failOnEmptyResult | Fail the task if the resulting snapshot contains zero components | Yes | false |

## Changes in 1.6.1
* The task no longer fails if the build-date label is missing from the image

## Changes in 1.6.0
* The {{ timestamp }} tag now uses the build-date label of the image
* Added {{ release_timestamp }} tag which works as the old {{ timestamp }} tag did
Expand Down
4 changes: 2 additions & 2 deletions tasks/apply-mapping/apply-mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Task
metadata:
name: apply-mapping
labels:
app.kubernetes.io/version: "1.6.0"
app.kubernetes.io/version: "1.6.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -204,7 +204,7 @@ spec:
os="$(jq -rs 'map(.platform.os) | .[0]' <<< "$arch_json")"
build_date="$(skopeo inspect --no-tags --override-os "${os}" --override-arch "${arch}" \
docker://"${IMAGE_REF}" | jq -r '.Labels."build-date"')"
timestamp="$(date -d "${build_date}" "+$passedTimestampFormat")"
timestamp="$(date -d "${build_date}" "+$passedTimestampFormat" || true)"
if [ "${build_date}" == "null" ] ; then
timestamp="null"
fi
Expand Down

0 comments on commit 1d11b05

Please sign in to comment.