Skip to content
Snippets Groups Projects
Commit 72213365 authored by Marek Sterzik's avatar Marek Sterzik
Browse files

initial commit of the reg tool (listing part)

parent db986ea6
No related merge requests found
Pipeline #7937 passed with stage
in 2 minutes and 3 seconds
#!/bin/bash
prod_tag="prod-running"
declare -A digests
i=0
while read tag; do
digest="`regctl image digest "$1:$tag"`"
if [ -z "$digest" ]; then
digest="standalone-$tag"
fi
sp=" "
if [ -z "${digests[$digest]}" ]; then
sp="$i "
((i++))
fi
digests["$digest"]="${digests[$digest]}$sp$tag"
done < <(regctl tag list "$1" | semversort -r -L)
for val in "${digests[@]}"; do
echo "$val"
done | sort -n -t" " | sed 's/^[0-9]\+ //' | while read line; do
line_out=""
running_out=""
prod=""
for tag in $line; do
if [ "$tag" = "$prod_tag" ]; then
prod=1
else
sp=""
if [ -n "$line_out" ]; then
sp=" "
fi
line_out="$line_out$sp$tag"
fi
done
if [ -z "$line_out" ]; then
line_out="?"
fi
if [ -t 1 -a -n "$prod" ]; then
echo -ne '\033[0;32m'
echo -n "$line_out"
echo -ne '\033[0m'
else
echo -n "$line_out"
fi
if [ -n "$prod" ]; then
if [ -t 1 ]; then
echo -e ' [\033[0;31mR\033[0m]'
else
echo ' [R]'
fi
else
echo
fi
done
#for digest in "${!digests[@]}"; do
# echo "$digest ${digests[$digest]}"
#done
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment