diff options
-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 * * *' |