Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • miguel.prada/gitlab_templates
  • tecnalia_robotics-public/gitlab_templates
2 results
Show changes
#!/bin/bash
# From a given list of labels, check which of them are already defined in the provided docker image; if any of the labels
# is not defined, a new image with the same name is generated with the label(s) added.
# Labels already defined are not modified.
if [ "$#" -ne 1 ]; then
echo "Usage: $0 IMAGE_NAME"
exit 1
fi
image_name="$1"
# list of labels to be enforced
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
echo "Error: image does not exist"
exit 0
fi
# check if every label is defined
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]}"
# add missing label to the arguments to be provided to `docker build`
label_args+=" --label $label=\"${enforced_labels[$label]}\""
fi
done
# generate new image
if [ -n "${label_args+x}" ]; then
run_command="echo \"FROM $image_name\" | docker build $label_args -t $image_name -"
eval "$run_command"
fi
include: ci-templates/auto-rules/no-default.yml
variables:
BUILD_MELODIC: 1
BUILD_NOETIC: 1
include: ci-templates/core.yml
industrial_ci_melodic:
extends: .industrial_ci
variables:
ROS_DISTRO: melodic
industrial_ci_noetic:
extends: .industrial_ci
variables:
ROS_DISTRO: noetic
......@@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:kinetic
FROM tecnalia-robotics-docker.artifact.tecnalia.dev/flexbotics-base-devel:kinetic
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
......