From 061efaf6e647d7b23d18765e932713d2503f8663 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sat, 30 May 2020 08:11:47 +0200 Subject: [PATCH] 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 --- jenkins-common.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jenkins-common.sh b/jenkins-common.sh index 01f23d01..ea03d52c 100644 --- a/jenkins-common.sh +++ b/jenkins-common.sh @@ -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