aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/common.sh
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-07-01 15:45:10 +0200
committerOliver Smith <osmith@sysmocom.de>2019-07-02 13:14:59 +0200
commite6aff494a6a3d8a9d99e66d3083858e906ec06b1 (patch)
tree32a20aa2ef36a8ad4e69a5b7c9d56b83192ad45b /scripts/common.sh
parent0a389c40830296f49b64e6ad4603035b072be0e7 (diff)
common.sh: add docker_images_require
Clone docker-playground.git, source its jenkins-common.sh and run docker_images_require from there. This will make it possible to run osmocom-release-tarballs.sh in a docker container, for which the Dockerfile is stored in docker-playground.git. Related: OS#3870 Change-Id: Ic4519ccb6978793054869862f8ca0e21d9cf5be4
Diffstat (limited to 'scripts/common.sh')
-rw-r--r--scripts/common.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/common.sh b/scripts/common.sh
index 2cf31a5..bf24fc4 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"
+}