@@ -106,59 +106,22 @@ sudoif command *args:
106106# Build the image using the specified parameters
107107build $ target_image = image_name $ tag = default_tag $ dx = " 0" $ hwe = " 0" $ gdx = " 0":
108108 #!/usr/bin/env bash
109-
110- # Get Version
111- ver=" ${tag}-${centos_version}.$(date +%Y%m%d)"
109+ set -eo pipefail
112110
113111 BUILD_ARGS=()
114- BUILD_ARGS+ =(" --build-arg" " MAJOR_VERSION=${centos_version}" )
115- BUILD_ARGS+ =(" --build-arg" " IMAGE_NAME=${target_image}" )
116- BUILD_ARGS+ =(" --build-arg" " IMAGE_VENDOR=${repo_organization}" )
117- BUILD_ARGS+ =(" --build-arg" " ENABLE_DX=${dx}" )
118- BUILD_ARGS+ =(" --build-arg" " ENABLE_HWE=${hwe}" )
119- BUILD_ARGS+ =(" --build-arg" " ENABLE_GDX=${gdx}" )
120- if [[ -z " $(git status -s)" ]]; then
121- BUILD_ARGS+ =(" --build-arg" " SHA_HEAD_SHORT=$(git rev-parse --short HEAD)" )
122- fi
112+ while IFS=$' \n' read -r label; do
113+ BUILD_ARGS+ =(" --label" " $label" )
114+ done <<< $GENERATED_LABELS && unset label
123115
124116 podman build \
117+ " ${BUILD_ARGS[@]}" \
125118 - -pull=newer \
126- - -tag " ${target_image}:unchunked " \
119+ - -tag " ${target_image}:${tag} " \
127120 - -cache-from " ghcr.io/${repo_organization}/${target_image}" \
128121 .
129-
130- tmp=" $(mktemp -d)"
131- cleanup_tmp() {
132- rm -r " $tmp"
133- podman rm -fiv rechunk
134- }
135- trap cleanup_tmp EXIT
136-
137- podman run \
138- - -rm \
139- - -mount=type=image,src=" ${target_image}" :unchunked,target=/ var/ tree,rw=true \
140- - -mount=type=volume,target=/ var/ ostree \
141- - -mount=type=bind,src=" $tmp" ,target=/ workspace \
142- - -security-opt=label=disable \
143- - -user 0:0 \
144- - -env TREE=/ var/ tree \
145- - -env INIT_REPO=1 \
146- - -env REPO=/ var/ ostree/ repo \
147- - -env PREV_REF=" ghcr.io/${repo_organization}/${target_image}:latest" \
148- - -env OUT_NAME=" ${target_image}" \
149- - -env OUT_REF=" oci-archive:/workspace/image.tar" \
150- - -env SKIP_COMPRESSION=1 \
151- - -env LABELS=" $GENERATED_LABELS" \
152- - -env RESET_TIMESTAMP=" $RESET_TIMESTAMP" \
153- - -name rechunk \
154- ghcr.io/ hhd-dev/ rechunk:latest \
155- sh -c ' /sources/rechunk/1_prune.sh && /sources/rechunk/2_create.sh && touch $OUT_NAME.changelog.txt && /sources/rechunk/3_chunk.sh'
156- podman rmi -f " ${target_image}:unchunked"
157- chunked_img=" $(podman image import -c LABEL=containers.bootc=1 --message imported " ${tmp}/ image.tar" )"
158- podman tag " $chunked_img" " ${target_image}:latest"
159122 test -n " $GENERATED_TAGS" && for tag in $GENERATED_TAGS; do
160- podman tag " $chunked_img " " ${target_image}:${tag}"
161- done
123+ podman tag " ${target_image}:${tag} " " ${target_image}:${tag}"
124+ done || :
162125
163126# Command: _rootful_load_image
164127# Description: This script checks if the current user is root or running under sudo. If not, it attempts to resolve the image tag using podman inspect.
0 commit comments