@@ -64,6 +64,13 @@ inputs:
6464 Example: `ublue-os`
6565 required : false
6666 default : ${{ github.repository_owner }}
67+ chunkah :
68+ description : |
69+ Uses Chunkah to rechunk the image, allowing for smaller images and smaller updates.
70+
71+ This will increase the build-time and take up more space during build-time.
72+ required : false
73+ default : " false"
6774 build_chunked_oci :
6875 description : |
6976 Uses `rpm-ostree compose build-chunked-oci` to rechunk the image, allowing for smaller images and smaller updates.
@@ -138,6 +145,7 @@ runs:
138145 - name : Validate inputs
139146 shell : bash
140147 env :
148+ INPUT_CHUNKAH : ${{ inputs.chunkah }}
141149 INPUT_BUILD_CHUNKED_OCI : ${{ inputs.build_chunked_oci }}
142150 INPUT_RECHUNK : ${{ inputs.rechunk }}
143151 INPUT_RECHUNK_CLEAR_PLAN : ${{ inputs.rechunk_clear_plan }}
@@ -332,37 +340,66 @@ runs:
332340 BB_CACHE_LAYERS : ${{ inputs.use_cache }}
333341 BB_RETRY_PUSH_COUNT : ${{ inputs.retry_push_count }}
334342 BB_SQUASH : ${{ inputs.squash }}
343+ BB_BUILD_CHUNKAH : ${{ inputs.chunkah }}
335344 BB_BUILD_CHUNKED_OCI : ${{ inputs.build_chunked_oci }}
336- BB_BUILD_CHUNKED_OCI_MAX_LAYERS : ${{ inputs.max_layers }}
345+ BB_BUILD_MAX_LAYERS : ${{ inputs.max_layers }}
337346 BB_BUILD_REMOVE_BASE_IMAGE : " true"
338- BB_RECHUNK : ${{ inputs.rechunk }}
347+ BB_BUILD_RECHUNK : ${{ inputs.rechunk }}
339348 BB_BUILD_RECHUNK_CLEAR_PLAN : ${{ inputs.rechunk_clear_plan }}
340349 RECIPE_PATH : ${{ steps.build_vars.outputs.recipe_path }}
341350 RUST_LOG_STYLE : always
342351 CLICOLOR_FORCE : " 1"
343352 BUILD_OPTS : ${{ inputs.build_opts }}
344353 run : |
345354 read -r -a BUILD_OPTS <<< "${BUILD_OPTS}"
346- if [ "${BB_SQUASH}" = "true" ]; then
355+
356+ boolean_variables=(
357+ BB_BUILD_PUSH
358+ BB_SQUASH
359+ BB_BUILD_CHUNKAH
360+ BB_BUILD_CHUNKED_OCI
361+ BB_BUILD_REMOVE_BASE_IMAGE
362+ BB_BUILD_RECHUNK
363+ BB_BUILD_RECHUNK_CLEAR_PLAN
364+ BB_CACHE_LAYERS
365+ )
366+ # Normalize boolean values to unset or 'true'. Unsetting falsey values
367+ # is necessary due to this issue with clap's parsing:
368+ # https://github.com/clap-rs/clap/issues/5591
369+ for bool_var in "${boolean_variables[@]}"; do
370+ case "${!bool_var,,}" in
371+ ''|0|false|no|off)
372+ unset "${bool_var}"
373+ ;;
374+ 1|true|yes|on)
375+ IFS= read -r "${bool_var}" <<< 'true'
376+ ;;
377+ *)
378+ echo "Invalid value '${!bool_var}' for variable '${bool_var}'"
379+ exit 1
380+ ;;
381+ esac
382+ done
383+
384+ if [[ "${BB_SQUASH-}" == 'true' ]]; then
347385 BUILD_OPTS+=("--build-driver" "podman" "--squash")
348386 fi
349387
350- if [ "${BB_BUILD_CHUNKED_OCI }" = "false" ]; then
351- unset BB_BUILD_CHUNKED_OCI_MAX_LAYERS
388+ if [[ -z "${BB_BUILD_CHUNKAH- }" && -z "${BB_BUILD_CHUNKED_OCI-}" ] ]; then
389+ unset BB_BUILD_MAX_LAYERS
352390 unset BB_BUILD_REMOVE_BASE_IMAGE
353391 fi
354392
355393 RUN_SUDO=""
356- if [ "${BB_RECHUNK }" = " true" ]; then
394+ if [[ "${BB_BUILD_RECHUNK- }" = ' true' ] ]; then
357395 RUN_SUDO=1
358- BUILD_OPTS+=("--rechunk")
359396 fi
360397
361- if [ "${BB_RETRY_PUSH_COUNT}" != '0' ]; then
398+ if [[ "${BB_RETRY_PUSH_COUNT}" != '0' ] ]; then
362399 BUILD_OPTS+=("--retry-push" "--retry-count" "${BB_RETRY_PUSH_COUNT}")
363400 fi
364401
365- if [ -n "$RUN_SUDO" ]; then
402+ if [[ -n "${ RUN_SUDO}" ] ]; then
366403 sudo -E bluebuild build -v "${BUILD_OPTS[@]}" "${RECIPE_PATH}"
367404 else
368405 bluebuild build -v "${BUILD_OPTS[@]}" "${RECIPE_PATH}"
0 commit comments