diff options
Diffstat (limited to 'tcwg-cleanup-stale-results.yaml.in')
-rw-r--r-- | tcwg-cleanup-stale-results.yaml.in | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/tcwg-cleanup-stale-results.yaml.in b/tcwg-cleanup-stale-results.yaml.in new file mode 100644 index 0000000000..4ba3db60ae --- /dev/null +++ b/tcwg-cleanup-stale-results.yaml.in @@ -0,0 +1,85 @@ +#include tcwg/default.yaml.inc + +- job: + name: tcwg-cleanup-stale-results + project-type: freestyle + defaults: global + properties: + - default-properties + parameters: + - choice: + name: cleanup_gc + choices: + - 'true' + - 'dryrun' + - 'false' + description: 'Cleanup the git repositories' + - choice: + name: cleanup_annex + choices: + - 'dryrun' + - 'true' + - 'false' + description: 'Cleanup the annex results files' + - bool: + name: verbose + default: 'false' + description: 'Whether to be verbose' + disabled: false + node: tcwg-bkp-01 + concurrent: false + display-name: 'TCWG CCC Cleanup stale results' + workspace: workspace/tcwg-cleanup-stale-results + triggers: + - timed: '@daily' + scm: + - jenkins-scripts-master + wrappers: + - timeout: + timeout: 600 + - timestamps + - build-name: + name: '#${BUILD_NUMBER}' + builders: + - shell: | + #!/bin/bash + set -ex + + rm -rf artifacts + mkdir artifacts + + ./jenkins-scripts/tcwg-cleanup-stale-results.sh \ + --cleanup_gc $cleanup_gc \ + --cleanup_annex $cleanup_annex \ + --verbose $verbose + + if [ x"$(cat list_annex.exist_but_not_referenced.txt | wc -l)" != x"0" ]; then + ( + if [ "$cleanup_annex" = "dryrun" ]; then + echo "# Cleanup-stale-results was run in DRYRUN mode." + echo "# Please double check and run this script manually." + else + echo "# Cleanup-stale-results executed the following" + fi + echo "#" + echo "# List of missing results :" + sed -e 's|^|# |' list_annex.referenced_but_not_exist.txt + echo "#" + echo "# List of useless results :" + sed -e 's|^|rm -f |' list_annex.exist_but_not_referenced.txt + echo "" + ) > artifacts/email-body.txt + exit 1 + fi + + publishers: + - archive: + artifacts: 'artifacts/**' + latest-only: false + - email-ext: + recipients: 'maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org' + content-type: text + body: | + ${FILE,path="artifacts/email-body.txt"} + failure: true + aborted: true |