From: Jeremy Mordkoff Date: Thu, 21 Jul 2016 20:32:25 +0000 (-0400) Subject: added an option to reuse the devops workspace from the host inside the container... X-Git-Tag: v1.0.0~37 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=5cf3216e0e02cb159f906b76e682c038c006aaa9;p=osm%2Fdevops.git added an option to reuse the devops workspace from the host inside the container. This makes testing and debugging devsops scripts possible without pushing the change to a repository Signed-off-by: Jeremy Mordkoff --- diff --git a/jenkins/common/container b/jenkins/common/container index 3c09d7f2..5c0ef959 100644 --- a/jenkins/common/container +++ b/jenkins/common/container @@ -73,3 +73,14 @@ wait_container_up() { done FATAL "container $1 did not start" } +container_push_tree() { + # create a tarball locally, pipe it into the container and unpack it there + [ $# -eq 3 ] || FATAL "args are container dir_from dir_to (dir_to MUST exist)" + tar -C "$2" -c . -f - | container_exec $1 tar -C "$3" -x -f - +} + +container_push_devops() { + [ $# -eq 1 ] || FATAL "arg is container name got $# args - $*" + container_exec "$1" mkdir -p /root/devops + container_push_tree "$1" "$(dirname $OSM_JENKINS)" "/root/devops" +} diff --git a/jenkins/host/start_build b/jenkins/host/start_build index 06ce3a6e..dd697999 100755 --- a/jenkins/host/start_build +++ b/jenkins/host/start_build @@ -36,13 +36,21 @@ if ! container_exists $OSM_BUILD_CONTAINER; then wait_container_up $OSM_BUILD_CONTAINER RE="fedora|fc[0-9]" if [[ $OSM_BASE_IMAGE =~ $RE ]]; then - container_exec $OSM_BUILD_CONTAINER yum -y install git + container_exec $OSM_BUILD_CONTAINER yum -y install git tar else container_exec $OSM_BUILD_CONTAINER apt -y install git realpath fi - container_exec $OSM_BUILD_CONTAINER git clone ${OSM_GIT_URL}/devops + if [ ${OSM_USE_LOCAL_DEVOPS:-false} ]; then + container_push_devops $OSM_BUILD_CONTAINER + else + container_exec $OSM_BUILD_CONTAINER git clone ${OSM_GIT_URL}/devops + fi else - container_exec $OSM_BUILD_CONTAINER git -C devops pull + if [ ${OSM_USE_LOCAL_DEVOPS:-false} ]; then + container_push_devops $OSM_BUILD_CONTAINER + else + container_exec $OSM_BUILD_CONTAINER git -C devops pull + fi fi container_exec $OSM_BUILD_CONTAINER ./devops/jenkins/$OSM_MDG/start_build diff --git a/jenkins/riftware/start_build b/jenkins/riftware/start_build index a7826abe..0f314778 100755 --- a/jenkins/riftware/start_build +++ b/jenkins/riftware/start_build @@ -33,7 +33,7 @@ else git clone $OSM_GIT_URL/riftware cd riftware INFO "install pre-requisites" - bash ./scripts/vm_image/mkvmimg --container --modes build + bash ./scripts/vm_image/mkcontainer --modes build fi INFO "no build script yet"