diff options
author | Dan Radez <dradez@redhat.com> | 2016-04-15 11:49:27 -0400 |
---|---|---|
committer | Dan Radez <dradez@redhat.com> | 2016-04-20 15:11:52 -0400 |
commit | 2930fff5e8484dbd53e70f64e7e60daf6430471a (patch) | |
tree | b427dee4524e12b97c368ff04980e4f23794af2b | |
parent | 047708d62a425567a1bc7e86eaca2a8e88ebd703 (diff) |
Adding GS clenaup for Apex
Change-Id: I8dec946c5434a120f2529db7db8dea126e62e41d
Signed-off-by: Dan Radez <dradez@redhat.com>
-rw-r--r-- | jjb/apex/apex.yml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index b48e81e8c..91f76b5cf 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -628,6 +628,30 @@ failure-threshold: 'never' unstable-threshold: 'FAILURE' +- job-template: + name: 'apex-gs-clean-{stream}' + + # Job template for clean + # + # Required Variables: + # stream: branch with - in place of / (eg. stable) + node: '{slave}' + + disabled: false + + parameters: + - project-parameter: + project: '{project}' + - apex-parameter: + gs-pathname: '{gs-pathname}' + + builders: + - 'apex-gs-clean' + + triggers: + - 'apex-gs-clean-{stream}' + + ######################## # parameter macros ######################## @@ -780,6 +804,30 @@ echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)" - builder: + name: 'apex-gs-cleanup' + builders: + - shell: | + #!/bin/bash + set -o errexit + set -o nounset + set -o pipefail + + # log info to console + echo "Cleaning Google Storage" + echo "-----------------------" + echo + + thirty_days_ago=$(date -d "30 days ago" +"%Y%m%d") + + for i in $(gsutil ls gs://$GS_URL/*201?*); do + filedate=$(date -d "$(echo $i | grep -Eo 201[0-9]-?[0-9][0-9]-?[0-9][0-9])" +"%Y%m%d") + if [ $filedate -lt $thirty_days_ago ]; then + # gsutil indicates what it is removing so no need for output here + gsutil rm $i + fi + done + +- builder: name: 'apex-deploy-virtual' builders: - shell: | @@ -990,3 +1038,7 @@ name: 'apex-brahmaputra' triggers: - timed: '0 3 * * *' +- trigger: + name: 'apex-gs-clean-{stream}' + triggers: + - timed: '0 2 * * *' |