From 029482eda36ecbbcd60f3edd7bcae67e2aeec807 Mon Sep 17 00:00:00 2001 From: Vince Rose Date: Thu, 15 Aug 2024 10:41:54 -0700 Subject: [PATCH 1/2] send --verbose to other commands. fix for gnu xargs --- oci/private/push.sh.tpl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/oci/private/push.sh.tpl b/oci/private/push.sh.tpl index 610c657b..c1caa542 100644 --- a/oci/private/push.sh.tpl +++ b/oci/private/push.sh.tpl @@ -8,6 +8,8 @@ readonly TAGS_FILE="{{tags}}" readonly FIXED_ARGS=({{fixed_args}}) readonly REPOSITORY_FILE="{{repository_file}}" +VERBOSE="" + REPOSITORY="" if [ -f $REPOSITORY_FILE ] ; then REPOSITORY=$(tr -d '\n' < "$REPOSITORY_FILE") @@ -24,6 +26,9 @@ ARGS=() while (( $# > 0 )); do case $1 in + (-v|--verbose) + VERBOSE="--verbose" + shift;; (-t|--tag) TAGS+=( "$2" ) shift @@ -47,13 +52,13 @@ done DIGEST=$("${JQ}" -r '.manifests[0].digest' "${IMAGE_DIR}/index.json") REFS=$(mktemp) -"${CRANE}" push "${IMAGE_DIR}" "${REPOSITORY}@${DIGEST}" "${ARGS[@]+"${ARGS[@]}"}" --image-refs "${REFS}" +"${CRANE}" push ${VERBOSE} "${IMAGE_DIR}" "${REPOSITORY}@${DIGEST}" "${ARGS[@]+"${ARGS[@]}"}" --image-refs "${REFS}" for tag in "${TAGS[@]+"${TAGS[@]}"}" do - "${CRANE}" tag $(cat "${REFS}") "${tag}" + "${CRANE}" tag ${VERBOSE} $(cat "${REFS}") "${tag}" done if [[ -e "${TAGS_FILE:-}" ]]; then - cat "${TAGS_FILE}" | xargs -n1 "${CRANE}" tag $(cat "${REFS}") + cat "${TAGS_FILE}" | xargs -rn1 "${CRANE}" tag ${VERBOSE} $(cat "${REFS}") fi From b8dedae3bef898f862be7fb0b06651b3b9003b66 Mon Sep 17 00:00:00 2001 From: Vincent Rose Date: Thu, 15 Aug 2024 12:09:03 -0700 Subject: [PATCH 2/2] Update push.sh.tpl --- oci/private/push.sh.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oci/private/push.sh.tpl b/oci/private/push.sh.tpl index c1caa542..0d175a3e 100644 --- a/oci/private/push.sh.tpl +++ b/oci/private/push.sh.tpl @@ -60,5 +60,5 @@ do done if [[ -e "${TAGS_FILE:-}" ]]; then - cat "${TAGS_FILE}" | xargs -rn1 "${CRANE}" tag ${VERBOSE} $(cat "${REFS}") + cat "${TAGS_FILE}" | xargs --no-run-if-empty -n1 "${CRANE}" tag ${VERBOSE} $(cat "${REFS}") fi