diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/d-i_build.sh | 27 | ||||
-rwxr-xr-x | bin/jenkins_master_wrapper.sh | 2 | ||||
-rwxr-xr-x | bin/jenkins_node_wrapper.sh | 2 | ||||
-rwxr-xr-x | bin/lvc.sh | 8 |
4 files changed, 23 insertions, 16 deletions
diff --git a/bin/d-i_build.sh b/bin/d-i_build.sh index e2af277d..e076a70d 100755 --- a/bin/d-i_build.sh +++ b/bin/d-i_build.sh @@ -46,23 +46,26 @@ replace_origin_pu() { iso_target() { UI=$1 ; shift - echo "${ISO_DIR}/mini-${UI}$(replace_origin_pu "-" $PU_GIT_BRANCH).iso" + BRANCH=$1 ; shift + echo "${ISO_DIR}/mini-${UI}${BRANCH}.iso" } preserve_artifacts() { # # Check is we're in a pu/* branch, and if so save the udebs # - if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $GIT_BRANCH) ; then - mkdir -p $PU_BRANCH_DIR - cp ${RESULT_DIR}/*.udeb $PU_BRANCH_DIR + if udeb_dir=$(replace_origin_pu "/srv/udebs/" $GIT_BRANCH) ; then + mkdir -p $udeb_dir + cp ${RESULT_DIR}/*.udeb $udeb_dir + # this is put into env.txt below, so that the variable(s) can be injected into the jenkins environment + ENV_TO_INJECT="OUR_BRANCH=$GIT_BRANCH" fi # # Alternatively, if we built an images tarball and were triggered by a pu/ branch # IMAGETAR=${RESULT_DIR}/debian-installer-images_*.tar.gz - if [ -f $IMAGETAR -a "$PU_GIT_BRANCH" ] ; then + if [ -f $IMAGETAR -a "$TRIGGERING_BRANCH" ] ; then [ -d ${ISO_DIR} ] || mkdir ${ISO_DIR} echo "untaring the .iso images from $IMAGETAR:" @@ -70,8 +73,9 @@ preserve_artifacts() { echo "sha256sum of .iso images:" sha256sum installer-*/*/images/netboot/gtk/mini.iso installer-*/*/images/netboot/mini.iso echo "move them into place..." - mv -f installer-*/*/images/netboot/gtk/mini.iso $(iso_target gtk) - mv -f installer-*/*/images/netboot/mini.iso $(iso_target text) + BRANCH=$(replace_origin_pu "-" $TRIGGERING_BRANCH) + mv -f installer-*/*/images/netboot/gtk/mini.iso $(iso_target gtk $BRANCH) + mv -f installer-*/*/images/netboot/mini.iso $(iso_target text $BRANCH) echo "and see if they are there (listing creation time):" ls -ltrc $ISO_DIR @@ -126,11 +130,11 @@ pdebuild_package() { NUM_CPU=1 fi # - # if we got a valid PU_GIT_BRANCH passed in as a parameter from the triggering job + # if we got a valid TRIGGERING_BRANCH passed in as a parameter from the triggering job # then grab the generated udebs. FIXME -- we need to work work out a way of cleaning up old branches # - if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $PU_GIT_BRANCH) ; then - cp $PU_BRANCH_DIR/* build/localudebs + if udeb_dir=$(replace_origin_pu "/srv/udebs/" $TRIGGERING_BRANCH) ; then + cp $udeb_dir/* build/localudebs fi pdebuild --use-pdebuild-internal --debbuildopts "-j$NUM_CPU -b" --buildresult ${RESULT_DIR} -- --http-proxy $http_proxy # cleanup @@ -152,3 +156,6 @@ else echo do something else ; exit 1 fi clean_workspace + +# write out the environment variable(s) for injection into jenkins job +echo "$ENV_TO_INJECT" > env.txt diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh index 2c81b682..7aefb747 100755 --- a/bin/jenkins_master_wrapper.sh +++ b/bin/jenkins_master_wrapper.sh @@ -25,7 +25,7 @@ get_node_ssh_port $NODE_NAME case $JOB_NAME in rebootstrap_*) PARAMS="$JOB_NAME $@" ;; - lvc_*) PARAMS="$JOB_NAME $EXECUTOR_NUMBER PU_GIT_BRANCH=${PU_GIT_BRANCH:-} $@" + lvc_*) PARAMS="$JOB_NAME $EXECUTOR_NUMBER TRIGGERING_BRANCH=${TRIGGERING_BRANCH:-} $@" export ;; *) PARAMS="$JOB_NAME" diff --git a/bin/jenkins_node_wrapper.sh b/bin/jenkins_node_wrapper.sh index e3807c95..86d95bda 100755 --- a/bin/jenkins_node_wrapper.sh +++ b/bin/jenkins_node_wrapper.sh @@ -75,7 +75,7 @@ elif [[ "$*" =~ lvc_.* ]] ; then echo debug end export JOB_NAME=$1 ; shift export EXECUTOR_NUMBER=$1 ; shift - export PU_GIT_BRANCH=${1#*=} ; shift + export TRIGGERING_BRANCH=${1#*=} ; shift export WORKSPACE=~jenkins/jobs/$JOB_NAME/workspace COMMAND="/srv/jenkins/bin/lvc.sh $@" exec $COMMAND; croak "Exec failed"; @@ -18,9 +18,9 @@ replace_origin_pu() { echo "${PREFIX}pu_${BRANCH#origin/pu/}" } -# if $URL is set to "use_PU_GIT_BRANCH" then use the contents of $PU_GIT_BRANCH to work out the locally built ISO name -if [ "use_PU_GIT_BRANCH" = "$URL" ] ; then - if PU_ISO="$(replace_origin_pu "/srv/d-i/isos/mini-gtk-" $PU_GIT_BRANCH).iso" ; then +# if $URL is set to "use_TRIGGERING_BRANCH" then use the contents of $TRIGGERING_BRANCH to work out the locally built ISO name +if [ "use_TRIGGERING_BRANCH" = "$URL" ] ; then + if PU_ISO="$(replace_origin_pu "/srv/d-i/isos/mini-gtk-" $TRIGGERING_BRANCH).iso" ; then [ -f "$PU_ISO" ] || { echo "looks like we're meant to be testing '$PU_ISO', but it's missing" exit 1 @@ -28,7 +28,7 @@ if [ "use_PU_GIT_BRANCH" = "$URL" ] ; then URL=$PU_ISO echo "using locally built ISO image: URL='$URL'" else - echo "URL='$URL' but PU_GIT_BRANCH='$PU_GIT_BRANCH' -- aborting" + echo "URL='$URL' but TRIGGERING_BRANCH='$TRIGGERING_BRANCH' -- aborting" exit 1 fi fi |