diff --git a/task/buildah-oci-ta/0.2/README.md b/task/buildah-oci-ta/0.2/README.md index ff1099db5a..428d40a6ac 100644 --- a/task/buildah-oci-ta/0.2/README.md +++ b/task/buildah-oci-ta/0.2/README.md @@ -18,6 +18,7 @@ When prefetch-dependencies task was activated it is using its artifacts to run b |CONTEXT|Path to the directory to use as context.|.|false| |DOCKERFILE|Path to the Dockerfile to build.|./Dockerfile|false| |ENTITLEMENT_SECRET|Name of secret which contains the entitlement certificates|etc-pki-entitlement|false| +|EPOCH_AS_RELEASE_LABEL|Whether or not to automatically set the "release" label to this build time timestamp|false|false| |HERMETIC|Determines if build will be executed without network access.|false|false| |IMAGE|Reference of the image buildah will produce.||true| |IMAGE_EXPIRES_AFTER|Delete image tag after specified time. Empty means to keep the image tag. Time values could be something like 1h, 2d, 3w for hours, days, and weeks, respectively.|""|false| diff --git a/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml b/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml index 46635c4489..4941d308b4 100644 --- a/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml +++ b/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml @@ -59,6 +59,11 @@ spec: description: Name of secret which contains the entitlement certificates type: string default: etc-pki-entitlement + - name: EPOCH_AS_RELEASE_LABEL + description: Whether or not to automatically set the "release" label + to this build time timestamp + type: string + default: "false" - name: HERMETIC description: Determines if build will be executed without network access. type: string @@ -187,6 +192,8 @@ spec: value: $(params.DOCKERFILE) - name: ENTITLEMENT_SECRET value: $(params.ENTITLEMENT_SECRET) + - name: EPOCH_AS_RELEASE_LABEL + value: $(params.EPOCH_AS_RELEASE_LABEL) - name: HERMETIC value: $(params.HERMETIC) - name: IMAGE @@ -375,13 +382,16 @@ spec: VOLUME_MOUNTS="${VOLUME_MOUNTS} --volume ${mount_point}:${YUM_REPOS_D_TARGET}" fi + BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%S') + EPOCH=$(date -u --date="$BUILD_DATE" +'%s') LABELS=( - "--label" "build-date=$(date -u +'%Y-%m-%dT%H:%M:%S')" + "--label" "build-date=$BUILD_DATE" "--label" "architecture=$(uname -m)" "--label" "vcs-type=git" ) [ -n "$COMMIT_SHA" ] && LABELS+=("--label" "vcs-ref=$COMMIT_SHA") [ -n "$IMAGE_EXPIRES_AFTER" ] && LABELS+=("--label" "quay.expires-after=$IMAGE_EXPIRES_AFTER") + [ "$EPOCH_AS_RELEASE_LABEL" == "true" ] && LABELS+=("--label" "release=$EPOCH") ACTIVATION_KEY_PATH="/activation-key" ENTITLEMENT_PATH="/entitlement" diff --git a/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml b/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml index a3012954eb..a06a551c75 100644 --- a/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml +++ b/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml @@ -59,6 +59,11 @@ spec: description: Name of secret which contains the entitlement certificates name: ENTITLEMENT_SECRET type: string + - default: "false" + description: Whether or not to automatically set the "release" label to this build + time timestamp + name: EPOCH_AS_RELEASE_LABEL + type: string - default: "false" description: Determines if build will be executed without network access. name: HERMETIC @@ -168,6 +173,8 @@ spec: value: $(params.DOCKERFILE) - name: ENTITLEMENT_SECRET value: $(params.ENTITLEMENT_SECRET) + - name: EPOCH_AS_RELEASE_LABEL + value: $(params.EPOCH_AS_RELEASE_LABEL) - name: HERMETIC value: $(params.HERMETIC) - name: IMAGE @@ -410,13 +417,16 @@ spec: VOLUME_MOUNTS="${VOLUME_MOUNTS} --volume ${mount_point}:${YUM_REPOS_D_TARGET}" fi + BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%S') + EPOCH=$(date -u --date="$BUILD_DATE" +'%s') LABELS=( - "--label" "build-date=$(date -u +'%Y-%m-%dT%H:%M:%S')" + "--label" "build-date=$BUILD_DATE" "--label" "architecture=$(uname -m)" "--label" "vcs-type=git" ) [ -n "$COMMIT_SHA" ] && LABELS+=("--label" "vcs-ref=$COMMIT_SHA") [ -n "$IMAGE_EXPIRES_AFTER" ] && LABELS+=("--label" "quay.expires-after=$IMAGE_EXPIRES_AFTER") + [ "$EPOCH_AS_RELEASE_LABEL" == "true" ] && LABELS+=("--label" "release=$EPOCH") ACTIVATION_KEY_PATH="/activation-key" ENTITLEMENT_PATH="/entitlement" @@ -490,6 +500,7 @@ spec: -e CONTEXT="$CONTEXT" \ -e DOCKERFILE="$DOCKERFILE" \ -e ENTITLEMENT_SECRET="$ENTITLEMENT_SECRET" \ + -e EPOCH_AS_RELEASE_LABEL="$EPOCH_AS_RELEASE_LABEL" \ -e HERMETIC="$HERMETIC" \ -e IMAGE="$IMAGE" \ -e IMAGE_EXPIRES_AFTER="$IMAGE_EXPIRES_AFTER" \ diff --git a/task/buildah-remote/0.2/buildah-remote.yaml b/task/buildah-remote/0.2/buildah-remote.yaml index 96a6bca21d..15c9f2f64f 100644 --- a/task/buildah-remote/0.2/buildah-remote.yaml +++ b/task/buildah-remote/0.2/buildah-remote.yaml @@ -115,6 +115,11 @@ spec: stages name: SKIP_UNUSED_STAGES type: string + - default: "false" + description: Whether or not to automatically set the "release" label to this build + time timestamp + name: EPOCH_AS_RELEASE_LABEL + type: string - description: The platform to build on name: PLATFORM type: string @@ -181,6 +186,8 @@ spec: value: $(params.SQUASH) - name: SKIP_UNUSED_STAGES value: $(params.SKIP_UNUSED_STAGES) + - name: EPOCH_AS_RELEASE_LABEL + value: $(params.EPOCH_AS_RELEASE_LABEL) - name: BUILDER_IMAGE value: quay.io/konflux-ci/buildah-task:latest@sha256:860a239c5f25376a435a514ae6d53a5c75b1fa492461d17774e9b7cb32d1e275 - name: PLATFORM @@ -392,13 +399,16 @@ spec: VOLUME_MOUNTS="${VOLUME_MOUNTS} --volume ${mount_point}:${YUM_REPOS_D_TARGET}" fi + BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%S') + EPOCH=$(date -u --date="$BUILD_DATE" +'%s') LABELS=( - "--label" "build-date=$(date -u +'%Y-%m-%dT%H:%M:%S')" + "--label" "build-date=$BUILD_DATE" "--label" "architecture=$(uname -m)" "--label" "vcs-type=git" ) [ -n "$COMMIT_SHA" ] && LABELS+=("--label" "vcs-ref=$COMMIT_SHA") [ -n "$IMAGE_EXPIRES_AFTER" ] && LABELS+=("--label" "quay.expires-after=$IMAGE_EXPIRES_AFTER") + [ "$EPOCH_AS_RELEASE_LABEL" == "true" ] && LABELS+=("--label" "release=$EPOCH") ACTIVATION_KEY_PATH="/activation-key" ENTITLEMENT_PATH="/entitlement" @@ -483,6 +493,7 @@ spec: -e ADD_CAPABILITIES="$ADD_CAPABILITIES" \ -e SQUASH="$SQUASH" \ -e SKIP_UNUSED_STAGES="$SKIP_UNUSED_STAGES" \ + -e EPOCH_AS_RELEASE_LABEL="$EPOCH_AS_RELEASE_LABEL" \ -e COMMIT_SHA="$COMMIT_SHA" \ -v "$BUILD_DIR/workspaces/source:$(workspaces.source.path):Z" \ -v "$BUILD_DIR/volumes/shared:/shared:Z" \