diff --git a/.gitignore b/.gitignore index ff207ee5..459f2c90 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ __pycache__/ _temp/ _deps/ _release_tarballs/ +_docker_playground # osmocom-nightly-packages.sh nightly-3g_* diff --git a/scripts/common.sh b/scripts/common.sh index 2cf31a5c..bf24fc4c 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -27,6 +27,8 @@ OSMO_RELEASE_REPOS=" osmocom-bb " +OSMO_BRANCH_DOCKER_PLAYGROUND="${OSMO_BRANCH_DOCKER_PLAYGROUND:-master}" + # Print commit of HEAD for an Osmocom git repository, e.g.: # "f90496f577e78944ce8db1aa5b900477c1e479b0" # $1: repository @@ -96,3 +98,27 @@ osmo_source_subdir() { ;; esac } + +# Build docker images from docker-playground.git. +# $1...$n: docker image names (e.g. "debian-stretch-build") +docker_images_require() { + local oldpwd="$PWD" + + # Get docker-plaground.git + if [ -d "_docker_playground" ]; then + git -C _docker_playground fetch + else + git clone https://git.osmocom.org/docker-playground/ _docker_playground + fi + cd _docker_playground + git checkout "$OSMO_BRANCH_DOCKER_PLAYGROUND" + git reset --hard "origin/$OSMO_BRANCH_DOCKER_PLAYGROUND" + + # jenkins-common.sh expects to run from a subdir in docker-playground.git + cd "$1" + + # Subshell: run docker_images_require from jenkins-common.sh, pass all arguments + (. ../jenkins-common.sh; docker_images_require "$@") + + cd "$oldpwd" +}