Skip to content
Snippets Groups Projects
Commit 5ffba0f4 authored by Jon Azpiazu's avatar Jon Azpiazu
Browse files

Fix shellcheck complains

parent 4c1a0784
No related branches found
No related tags found
1 merge request!73Resolve "Force `ddeploy` options (e.g. image retention)"
Pipeline #60022 passed
......@@ -9,20 +9,20 @@ image_name="$1"
declare -A enforced_labels=( ["com.jfrog.artifactory.retention.maxCount"]="10" ["com.jfrog.artifactory.retention.maxDays"]="7")
if ! docker inspect --type=image "$1" > /dev/null ; then
if ! docker inspect --type=image "$1" > /dev/null ; then
echo "Error: image does not exist"
exit 0
fi
for label in "${!enforced_labels[@]}" ; do
if ! docker inspect -f "{{json .Config.Labels }}" "$image_name" | jq -e '.['\"$label\"']' > /dev/null ; then
echo "Key not found"
for label in "${!enforced_labels[@]}" ; do
if ! docker inspect -f "{{json .Config.Labels }}" "$image_name" | jq -e '.['\""$label"\"']' > /dev/null ; then
echo "Key not found"
echo "$label = ${enforced_labels[$label]}"
label_args+=" --label $label=\"${enforced_labels[$label]}\""
fi
fi
done
if [ -v label_args ]; then
if [ -n "${label_args+x}" ]; then
run_command="echo \"FROM $image_name\" | docker build $label_args -t $image_name -"
eval "$run_command"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment