Skip to content
Snippets Groups Projects
Verified Commit e3e965be authored by Sheogorath's avatar Sheogorath :european_castle:
Browse files

fix(shell-tools): Fix broken call of bash function with xargs

This patch fixes the xargs call of `pushImageOrManifest` which can't
work since xargs isn't aware of bash functions. As a result it tries to
call a non existing binary/script/program outside of the script.

This patch solves this problem by moving the function into its own
script and puts it into the `libexec` directory.
parent 5b253f46
No related branches found
No related tags found
No related merge requests found
Pipeline #11600 failed
......@@ -26,14 +26,6 @@ printUsage() {
exit 1
}
pushImageOrManifest() {
if podman manifest inspect "$1"; then
$CONTAINER_CMD manifest push --all --format v2s2 "$1" "docker://$1"
else
$CONTAINER_CMD push "$1"
fi
}
CONTAINER_CMD=podman
if ! command -v "$CONTAINER_CMD" >/dev/null 2>&1; then
......@@ -74,4 +66,4 @@ if [ "$CONTAINER_IMAGE_NAME" = "invalid" ]; then
fi
# shellcheck disable=SC2086
$CONTAINER_CMD images --format "{{.Repository}}:{{.Tag}}" "$CONTAINER_IMAGE_NAME" | grep "$CONTAINER_IMAGE_NAME" | xargs -L 1 pushImageOrManifest
$CONTAINER_CMD images --format "{{.Repository}}:{{.Tag}}" "$CONTAINER_IMAGE_NAME" | grep "$CONTAINER_IMAGE_NAME" | xargs -L 1 /usr/local/libexec/pushImageOrManifest.sh
......@@ -6,11 +6,14 @@ cp "$BASENAME"/./bin/tagging.sh /usr/local/bin/si-tagging
cp "$BASENAME"/./bin/push.sh /usr/local/bin/si-push
cp "$BASENAME"/./bin/pull.sh /usr/local/bin/si-pull
cp "$BASENAME"/./bin/fix-dockerfile.sh /usr/local/bin/si-fix
cp "$BASENAME"/./libexec/pushImageOrManifest.sh /usr/local/libexec/pushImageOrManifest.sh
chown root:root /usr/local/bin/si-tagging
chown root:root /usr/local/bin/si-push
chown root:root /usr/local/bin/si-pull
chown root:root /usr/local/bin/si-fix
chown root:root /usr/local/libexec/pushImageOrManifest.sh
chmod 0755 /usr/local/bin/si-tagging
chmod 0755 /usr/local/bin/si-push
chmod 0755 /usr/local/bin/si-pull
chmod 0755 /usr/local/bin/si-fix
chmod 0755 /usr/local/libexec/pushImageOrManifest.sh
#!/bin/bash
set -o pipefail
set -u
set -e
if podman manifest inspect "$1"; then
podman manifest push --all --format v2s2 "$1" "docker://$1"
else
podman push "$1"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment