X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fhost%2Fstart_build;h=f7ada68a35ebc54fa7598703fefa7c87af86248e;hb=021b307297a6ab8dfe9ee3af03154989bcd9e0e8;hp=41ea06842130e17cb600f051d86bf581cf8ab8a2;hpb=ee04b4563003e33e11163adbbaa39e5c7091d82f;p=osm%2Fdevops.git diff --git a/jenkins/host/start_build b/jenkins/host/start_build index 41ea0684..f7ada68a 100755 --- a/jenkins/host/start_build +++ b/jenkins/host/start_build @@ -30,29 +30,37 @@ export OSM_MDG=$1 shift OSM_load_config +if [ "$1" = "--build-container" ]; then + shift + [ $# -lt 1 ] && FATAL "missing container name with option --build-container" + export OSM_BUILD_CONTAINER=$1 + shift +fi + if ! container_exists $OSM_BUILD_CONTAINER; then CONTAINER_OPTS="" [[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.privileged=true" [[ "$OSM_BUILD_CONTAINER_ALLOW_NESTED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.nesting=true" + [[ "$OSM_BUILD_CONTAINER_ALLOW_DOCKER" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -p docker -p default" create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER $CONTAINER_OPTS 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 tar make sudo else - container_exec $OSM_BUILD_CONTAINER apt -y install git realpath make sudo + container_exec $OSM_BUILD_CONTAINER apt-get -y install git realpath make sudo + fi + 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 - 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 - if [ ${OSM_USE_LOCAL_DEVOPS:-false} ]; then - container_push_devops $OSM_BUILD_CONTAINER - else - container_exec $OSM_BUILD_CONTAINER git -C devops pull - fi + 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 $*