update promotion scripts for stable branches

Updates to the scripts to signal to the ci.centos job
that a promotion can occur for branch.  This is done
in the same fashion that has been working for master.

Change-Id: I5c83b2986b32f6e483199b59b822b8cec96edf7f
This commit is contained in:
Wes Hayutin 2017-01-31 15:13:19 -05:00 committed by Sagi Shnaidman
parent f977b3f3bc
commit 40144b4bc3
2 changed files with 38 additions and 13 deletions

View File

@ -52,7 +52,22 @@ cron {"refresh-server":
minute => "*/30"
}
cron {"promote":
command => "timeout 10m /opt/stack/tripleo-ci/scripts/mirror-server/promote.sh current-tripleo periodic-tripleo-ci-centos-7-ovb-ha periodic-tripleo-ci-centos-7-ovb-nonha &>/var/log/last_promotion.log",
cron {"promote-master":
command => "timeout 10m /opt/stack/tripleo-ci/scripts/mirror-server/promote.sh master current-tripleo tripleo-dlrn-promote periodic-tripleo-ci-centos-7-ovb-ha periodic-tripleo-ci-centos-7-ovb-nonha &>/var/log/last_master_promotion.log",
minute => "40"
}
cron {"promote-ocata":
command => "timeout 10m /opt/stack/tripleo-ci/scripts/mirror-server/promote.sh ocata current-tripleo-ocata tripleo-dlrn-promote-ocata periodic-tripleo-ci-centos-7-ovb-ha-ocata &>/var/log/last_ocata_promotion.log",
minute => "40"
}
cron {"promote-newton":
command => "timeout 10m /opt/stack/tripleo-ci/scripts/mirror-server/promote.sh newton current-tripleo-newton tripleo-dlrn-promote-newton periodic-tripleo-ci-centos-7-ovb-ha-newton &>/var/log/last_newton_promotion.log",
minute => "40"
}
cron {"promote-mitaka":
command => "timeout 10m /opt/stack/tripleo-ci/scripts/mirror-server/promote.sh mitaka current-tripleo-mitaka tripleo-dlrn-promote-mitaka periodic-tripleo-ci-centos-7-ovb-ha-mitaka &>/var/log/last_mitaka_promotion.log",
minute => "40"
}

View File

@ -1,23 +1,30 @@
#!/bin/bash -ex
#!/bin/bash
set -ex
# Here be the promote script
# 1. Find all metadata files newer then the one currently promoted
# 2. If any of them have all the jobs reported back that we're interested in then promote it
# o Bumb current-tripleo on the dlrn server
# o Bump current-tripleo on this server
# ./promote.sh linkname jobname [jobname] ...
# ./promote.sh release linkname promote-jobname test-jobname [test-jobname] ...
# Yes this doesn't attempt to remove anything, that will be a exercise for later
RELEASE=$1
LINKNAME=$2
PROMOTE_JOBNAME=$3
BASEDIR=/var/www/html/builds
CURRENT=$BASEDIR/$1
CURRENT_META=$BASEDIR/current-tripleo/metadata.txt
JOB_URL=https://ci.centos.org/job/tripleo-dlrn-promote/buildWithParameters
BASEDIR=/var/www/html/builds-$RELEASE
CURRENT=$BASEDIR/$LINKNAME
CURRENT_META=$CURRENT/metadata.txt
JOB_URL=https://ci.centos.org/job/$PROMOTE_JOBNAME/buildWithParameters
shift
shift
shift
# Working with relative paths is easier as we need to set relative links on the dlrn server
cd $BASEDIR
pushd $BASEDIR
mkdir -p $CURRENT
if [ -f $CURRENT_META ] ; then
DIRS2TEST=$(find . -newer $CURRENT_META -name metadata.txt | xargs --no-run-if-empty ls -t)
@ -46,9 +53,12 @@ for DIR in $DIRS2TEST ; do
break
done
# Remove any files older then 1 day that arn't the current-tripleo pin
find */*/* -type f -name metadata.txt -mtime +0 -not -samefile current-tripleo/metadata.txt | \
# Remove any files older then 1 day that arn't one of the current pins
find */*/* -type f -name metadata.txt -mtime +0 \
-not -samefile $LINKNAME/metadata.txt | \
xargs --no-run-if-empty dirname | \
xargs --no-run-if-empty -t rm -rf
# Remove all empty nested directories
find . -type d -empty -delete
find . -type d -empty -delete
popd