1 Commits

Author SHA1 Message Date
7471fb58a8 ci(tests): some updates to the scripts to make them work better on macos (#324)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-03-20 16:51:50 +02:00
2 changed files with 100 additions and 25 deletions

View File

@ -60,8 +60,19 @@ def pull_modify_push_image(logger, registry, image_name, tag, cosign_password,
metafile = '{}_{}_metadata.json'.format(image_name, tag) metafile = '{}_{}_metadata.json'.format(image_name, tag)
metafile = os.path.join(meta_dir_name, metafile) metafile = os.path.join(meta_dir_name, metafile)
cmd = [image_update_script_path, "-r", registry, "-i", image_name, "-t", tag, "-c", cosign_password, cmd = [image_update_script_path, "-r", registry, "-i", image_name, "-t", tag, "-f", metafile]
"-f", metafile, "-m", multiarch, "-u", username, "-p", password, "--data-dir", data_dir]
if data_dir:
cmd.extend(["--data-dir", data_dir])
if username:
cmd.extend(["-u", username, "-p", password])
if cosign_password:
cmd.extend(["-c", cosign_password])
if multiarch:
cmd.extend(["-m", multiarch])
if debug: if debug:
cmd.append("-d") cmd.append("-d")

View File

@ -11,27 +11,91 @@ username=""
debug=0 debug=0
data_dir=$(pwd) data_dir=$(pwd)
options=$(getopt -o dr:i:t:u:p:c:m:f: -l debug,registry:,image:,tag:,username:,password:,cosign-password:,multiarch:,file:,data-dir: -- "$@") while (( "$#" )); do
if [ $? -ne 0 ]; then case $1 in
usage $0 -r|--registry)
exit 0 if [ -z "$2" ]; then
fi echo "Option registry requires an argument"
exit 1
eval set -- "$options" fi
while :; do registry=$2;
case "$1" in shift 2
-r|--registry) registry=$2; shift 2;; ;;
-i|--image) image=$2; shift 2;; -i|--image)
-t|--tag) tag=$2; shift 2;; if [ -z "$2" ]; then
-u|--username) username=$2; shift 2;; echo "Option image requires an argument"
-p|--password) username=$2; shift 2;; exit 1
-c|--cosign-password) cosign_password=$2; shift 2;; fi
-m|--multiarch) multiarch=$2; shift 2;; image=$2
-f|--file) metafile=$2; shift 2;; shift 2
--data-dir) data_dir=$2; shift 2;; ;;
-d|--debug) debug=1; shift 1;; -t|--tag)
--) shift 1; break;; if [ -z "$2" ]; then
*) usage $0; exit 1;; echo "Option tag requires an argument"
exit 1
fi
tag=$2
shift 2
;;
-u|--username)
if [ -z "$2" ]; then
echo "Option username requires an argument"
exit 1
fi
username=$2
shift 2
;;
-p|--password)
if [ -z "$2" ]; then
echo "Option password requires an argument"
exit 1
fi
password=$2
shift 2
;;
-c|--cosign-password)
if [ -z "$2" ]; then
echo "Option cosign-password requires an argument"
exit 1
fi
cosign_password=$2
shift 2
;;
-m|--multiarch)
if [ -z "$2" ]; then
echo "Option multiarch requires an argument"
exit 1
fi
multiarch=$2
shift 2
;;
-f|--file)
if [ -z "$2" ]; then
echo "Option metafile requires an argument"
exit 1
fi
metafile=$2
shift 2
;;
--data-dir)
if [ -z "$2" ]; then
echo "Option data-dir requires an argument"
exit 1
fi
data_dir=$2
shift 2
;;
-d|--debug)
debug=1
shift 1
;;
--)
shift 1
break
;;
*)
break
;;
esac esac
done done
@ -90,8 +154,8 @@ license="$(cat ${docker_docs_dir}/${image}/license.md)"
vendor="$(cat ${docker_docs_dir}/${image}/maintainer.md)" vendor="$(cat ${docker_docs_dir}/${image}/maintainer.md)"
logo=$(base64 -w 0 ${docker_docs_dir}/${image}/logo.png) logo=$(base64 -w 0 ${docker_docs_dir}/${image}/logo.png)
echo ${repo} echo ${repo}
sed -i "s|%%GITHUB-REPO%%|${repo}|g" ${docker_docs_dir}/${image}/maintainer.md sed -i.bak "s|%%GITHUB-REPO%%|${repo}|g" ${docker_docs_dir}/${image}/maintainer.md; rm ${docker_docs_dir}/${image}/maintainer.md.bak
sed -i "s|%%IMAGE%%|${image}|g" ${docker_docs_dir}/${image}/content.md sed -i.bak "s|%%IMAGE%%|${image}|g" ${docker_docs_dir}/${image}/content.md; rm ${docker_docs_dir}/${image}/content.md.bak
doc=$(cat ${docker_docs_dir}/${image}/content.md) doc=$(cat ${docker_docs_dir}/${image}/content.md)
local_image_ref_skopeo=oci:${images_dir}:${image}-${tag} local_image_ref_skopeo=oci:${images_dir}:${image}-${tag}