From 40144b4bc3802683b3d839e051e09fcd8180acb1 Mon Sep 17 00:00:00 2001 From: Wes Hayutin Date: Tue, 31 Jan 2017 15:13:19 -0500 Subject: [PATCH] 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 --- scripts/mirror-server/mirror-server.pp | 19 +++++++++++++-- scripts/mirror-server/promote.sh | 32 +++++++++++++++++--------- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/scripts/mirror-server/mirror-server.pp b/scripts/mirror-server/mirror-server.pp index 494d8605f..6452ec46e 100644 --- a/scripts/mirror-server/mirror-server.pp +++ b/scripts/mirror-server/mirror-server.pp @@ -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" } diff --git a/scripts/mirror-server/promote.sh b/scripts/mirror-server/promote.sh index d3289b215..e72c675de 100755 --- a/scripts/mirror-server/promote.sh +++ b/scripts/mirror-server/promote.sh @@ -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 \ No newline at end of file +find . -type d -empty -delete + +popd