docker_images_require: build depends too

Add a function to automatically resolve the most common dependencies,
osmo-* need debian-stretch-build and ttcn3-* need debian-stretch-titan.
Do this in a shell function in jenkins-common.sh, so we can extend it in
the next patch with distribution specific dependencies (osmo-*-centos8
needs centos8-build).

Related: OS#4564
Change-Id: I98760c6dc3206529c0e267338c9f6f8e1d5be33a
This commit is contained in:
Oliver Smith 2020-05-30 08:11:47 +02:00
parent 95bb9e5cb0
commit 061efaf6e6
1 changed files with 14 additions and 0 deletions

View File

@ -2,12 +2,26 @@ docker_image_exists() {
test -n "$(docker images -q "$REPO_USER/$1")"
}
docker_depends() {
case "$1" in
osmo-*) echo "debian-stretch-build" ;;
ttcn3-*) echo "debian-stretch-titan" ;;
esac
}
docker_images_require() {
local i
local from_line
local pull_arg
local depends
for i in $@; do
# Build dependencies first
depends="$(docker_depends "$i")"
if [ -n "$depends" ]; then
docker_images_require $depends
fi
# Trigger image build (cache will be used when up-to-date)
if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then
# Pull upstream base images