docker_images_require: add symlink code path

Make development easier by skipping fetch, checkout and reset --hard if
_docker_playground is a symlink. Document _docker_playground in
README.adoc and explain how to set up the symlink.

Change-Id: If6209ff71488d39e590f5f8506b9d73ad0314846
This commit is contained in:
Oliver Smith 2020-01-14 14:43:00 +01:00
parent 51e91cd9bb
commit d0418d0f92
2 changed files with 27 additions and 10 deletions

View File

@ -12,3 +12,14 @@ for more information about deployment.
scripts: used by jenkins jobs. Various osmo*/contrib/jenkins.sh scripts assume
osmo-ci to be checked out in the build slave user's home, i.e. using a PATH of
$HOME/osmo-ci/scripts.
_docker_playground: Clone of docker-playground.git, so the scripts can build
required docker images. This dir gets created on demand by scripts/common.sh,
and automatically fetched and reset to "origin/master" (override with
$OSMO_BRANCH_DOCKER_PLAYGROUND). The fetch and reset gets skipped if
_docker_playground is a symlink. For development, set it up as follows:
$ git clone https://git.osmocom.org/docker-playground
$ git clone https://git.osmocom.org/osmo-ci
$ cd osmo-ci
$ ln -s ../docker-playground _docker_playground

View File

@ -117,18 +117,24 @@ osmo_source_subdir() {
docker_images_require() {
local oldpwd="$PWD"
# Get docker-plaground.git
if [ -d "_docker_playground" ]; then
git -C _docker_playground fetch
if [ -L "_docker_playground" ]; then
echo "NOTE: _docker_playground is a symlink, skipping fetch, checkout, reset"
cd "_docker_playground/$1"
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"
# 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
# jenkins-common.sh expects to run from a subdir in docker-playground.git
cd "$1"
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"
fi
# Subshell: run docker_images_require from jenkins-common.sh, pass all arguments
(. ../jenkins-common.sh; docker_images_require "$@")