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 53135cfd1b..d7283479b1 100644 --- a/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml +++ b/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml @@ -286,9 +286,16 @@ spec: # Setting new namespace to run buildah - 2^32-2 echo 'root:1:4294967294' | tee -a /etc/subuid >>/etc/subgid + build_args=("$@") + mapfile -t BUILD_ARGS < <(printf -- "--build-arg=%s\n" "${build_args[@]}") + + BASE_IMAGES=$( + dockerfile-json "${BUILD_ARGS[@]}" "$dockerfile_path" | + jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName' + ) + BUILDAH_ARGS=() - BASE_IMAGES=$(dockerfile-json "$dockerfile_path" | jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName') if [ "${HERMETIC}" == "true" ]; then BUILDAH_ARGS+=("--pull=never") UNSHARE_ARGS="--net" @@ -306,9 +313,7 @@ spec: BUILDAH_ARGS+=("--build-arg-file=$(pwd)/$SOURCE_CODE_DIR/${BUILD_ARGS_FILE}") fi - for build_arg in "$@"; do - BUILDAH_ARGS+=("--build-arg=$build_arg") - done + BUILDAH_ARGS+=("${BUILD_ARGS[@]}") if [ -n "${ADD_CAPABILITIES}" ]; then BUILDAH_ARGS+=("--cap-add=${ADD_CAPABILITIES}") 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 4c07aba43a..2030eec7af 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 @@ -321,9 +321,16 @@ spec: # Setting new namespace to run buildah - 2^32-2 echo 'root:1:4294967294' | tee -a /etc/subuid >>/etc/subgid + build_args=("$@") + mapfile -t BUILD_ARGS < <(printf -- "--build-arg=%s\n" "${build_args[@]}") + + BASE_IMAGES=$( + dockerfile-json "${BUILD_ARGS[@]}" "$dockerfile_path" | + jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName' + ) + BUILDAH_ARGS=() - BASE_IMAGES=$(dockerfile-json "$dockerfile_path" | jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName') if [ "${HERMETIC}" == "true" ]; then BUILDAH_ARGS+=("--pull=never") UNSHARE_ARGS="--net" @@ -341,9 +348,7 @@ spec: BUILDAH_ARGS+=("--build-arg-file=$(pwd)/$SOURCE_CODE_DIR/${BUILD_ARGS_FILE}") fi - for build_arg in "$@"; do - BUILDAH_ARGS+=("--build-arg=$build_arg") - done + BUILDAH_ARGS+=("${BUILD_ARGS[@]}") if [ -n "${ADD_CAPABILITIES}" ]; then BUILDAH_ARGS+=("--cap-add=${ADD_CAPABILITIES}") diff --git a/task/buildah-remote/0.2/buildah-remote.yaml b/task/buildah-remote/0.2/buildah-remote.yaml index 3f0bcdb549..93bc04fc0c 100644 --- a/task/buildah-remote/0.2/buildah-remote.yaml +++ b/task/buildah-remote/0.2/buildah-remote.yaml @@ -303,9 +303,16 @@ spec: # Setting new namespace to run buildah - 2^32-2 echo 'root:1:4294967294' | tee -a /etc/subuid >> /etc/subgid + build_args=("$@") + mapfile -t BUILD_ARGS < <(printf -- "--build-arg=%s\n" "${build_args[@]}") + + BASE_IMAGES=$( + dockerfile-json "${BUILD_ARGS[@]}" "$dockerfile_path" | + jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName' + ) + BUILDAH_ARGS=() - BASE_IMAGES=$(dockerfile-json "$dockerfile_path" | jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName') if [ "${HERMETIC}" == "true" ]; then BUILDAH_ARGS+=("--pull=never") UNSHARE_ARGS="--net" @@ -323,9 +330,7 @@ spec: BUILDAH_ARGS+=("--build-arg-file=$(pwd)/$SOURCE_CODE_DIR/${BUILD_ARGS_FILE}") fi - for build_arg in "$@"; do - BUILDAH_ARGS+=("--build-arg=$build_arg") - done + BUILDAH_ARGS+=("${BUILD_ARGS[@]}") if [ -n "${ADD_CAPABILITIES}" ]; then BUILDAH_ARGS+=("--cap-add=${ADD_CAPABILITIES}")