Tinkerbell.Sandbox/deploy/compose/registry/upload.sh
Jacob Weinstock 9b1cf3b509 Add vagrant-libvirt:
This gets the refactored sandbox back on par with
the existing sandbox for vagrant-libvirt functionality.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-08-09 08:04:21 -06:00

21 lines
692 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck disable=SC2001,SC2155,SC2046
set -xo pipefail
main() {
local reg_user="$1"
local reg_pw="$2"
local reg_url="$3"
local images_file="$4"
# this confusing IFS= and the || is to capture the last line of the file if there is no newline at the end
while IFS= read -r img || [ -n "${img}" ]; do
# file is expected to have src and dst images delimited by a space
local src_img="$(echo "${img}" | cut -d' ' -f1)"
local dst_img="$(echo "${img}" | cut -d' ' -f2)"
skopeo copy --all --dest-tls-verify=false --dest-creds="${reg_user}":"${reg_pw}" docker://"${src_img}" docker://"${reg_url}"/"${dst_img}"
done <"${images_file}"
}
main "$1" "$2" "$3" "$4"