aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Alfonsi <laurent.alfonsi@linaro.org>2024-03-18 12:20:14 +0100
committerLaurent Alfonsi <laurent.alfonsi@linaro.org>2024-04-03 15:52:20 +0200
commitdc29c432f0e76280d1db36d96a2ef1163f26cf7f (patch)
tree596a99ab5a3d70f28514976c11df6b350b4b0fb0
parent27de95f9ebe85581dea770777972080e086d8398 (diff)
tcwg-cleanup-stale-results.yaml: dryrun mode on
The project is run in dryrun mode. Sends an email with the results to delete. This has to be manually double check and executed. Also use tcwg/default.yaml.inc to avoid duplication to avoid duplications. Change-Id: I6f9a86a30e2fd36085c562e9dadf8818753f3c0c
-rw-r--r--tcwg-cleanup-stale-results.yaml97
-rw-r--r--tcwg-cleanup-stale-results.yaml.in84
-rw-r--r--tcwg-cleanup-stale-results/tcwg-cleanup-stale-results.def0
3 files changed, 156 insertions, 25 deletions
diff --git a/tcwg-cleanup-stale-results.yaml b/tcwg-cleanup-stale-results.yaml
index d069a8846f..2fda65c40a 100644
--- a/tcwg-cleanup-stale-results.yaml
+++ b/tcwg-cleanup-stale-results.yaml
@@ -1,21 +1,44 @@
+# Auto generated by ./tcwg/generate-yamlfiles.sh from tcwg-cleanup-stale-results.yaml.in and tcwg-cleanup-stale-results/tcwg-cleanup-stale-results.def. Do not edit.
+#BEGIN: tcwg/default.yaml.inc
+# -*- mode: Yaml -*-
+
+- property:
+ name: default-properties
+ properties:
+ - authorization:
+ anonymous:
+ - job-read
+ - job-extended-read
+ everyone-flat:
+ - job-build
+ - job-cancel
+ - build-discarder:
+ days-to-keep: 30
+
+- scm:
+ name: jenkins-scripts
+ scm:
+ - git:
+ url: https://git.linaro.org/toolchain/jenkins-scripts.git
+ refspec: +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*
+ branches:
+ - $scripts_branch
+ basedir: jenkins-scripts
+ skip-tag: true
+ reference-repo: /home/tcwg-buildslave/snapshots-ref/jenkins-scripts.git
+ wipe-workspace: false
+ clean:
+ before: true
+ prune: true
+
+#END: tcwg/default.yaml.inc
+
- job:
name: tcwg-cleanup-stale-results
project-type: freestyle
defaults: global
properties:
- - authorization:
- anonymous:
- - job-read
- - job-extended-read
- everyone-flat:
- - job-build
- - job-cancel
- - build-discarder:
- days-to-keep: 30
- num-to-keep: 100
- - throttle:
- max-per-node: 1
- option: project
+ - default-properties
parameters:
- bool:
name: cleanup_gc
@@ -27,13 +50,13 @@
description: 'Cleanup the annex results files'
- bool:
name: dryrun
- default: 'false'
+ default: 'true'
description: 'dryrun mode'
- bool:
name: verbose
default: 'false'
description: 'Whether to be verbose'
- disabled: true
+ disabled: false
node: tcwg-bmk-bkp-01
concurrent: false
display-name: 'TCWG CCC Cleanup stale results'
@@ -41,14 +64,7 @@
triggers:
- timed: '@weekly'
scm:
- - git:
- url: https://git.linaro.org/toolchain/jenkins-scripts.git
- refspec: +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*
- branches:
- - origin/master
- skip-tag: true
- shallow-clone: true
- wipe-workspace: true
+ - jenkins-scripts
wrappers:
- timeout:
timeout: 600
@@ -59,13 +75,44 @@
- 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 \
--dryrun $dryrun \
--verbose $verbose
+
+ if [ x"$(cat list_annex.exist_but_not_referenced.txt | wc -l)" != x"0" ]; then
+ (
+ if $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: tcwg-validation@linaro.org
- aborted: true
+ recipients: 'maxim.kuvyrkov@linaro.org, laurent.alfonsi@linaro.org'
content-type: text
+ body: |
+ ${FILE,path="artifacts/email-body.txt"}
+ failure: true
+ aborted: true
+# checksum: a96cd1068639c25804ef07b44a491b6c
diff --git a/tcwg-cleanup-stale-results.yaml.in b/tcwg-cleanup-stale-results.yaml.in
new file mode 100644
index 0000000000..1b0bfe4215
--- /dev/null
+++ b/tcwg-cleanup-stale-results.yaml.in
@@ -0,0 +1,84 @@
+#include tcwg/default.yaml.inc
+
+- job:
+ name: tcwg-cleanup-stale-results
+ project-type: freestyle
+ defaults: global
+ properties:
+ - default-properties
+ parameters:
+ - bool:
+ name: cleanup_gc
+ default: 'true'
+ description: 'Cleanup the git repositories'
+ - bool:
+ name: cleanup_annex
+ default: 'true'
+ description: 'Cleanup the annex results files'
+ - bool:
+ name: dryrun
+ default: 'true'
+ description: 'dryrun mode'
+ - bool:
+ name: verbose
+ default: 'false'
+ description: 'Whether to be verbose'
+ disabled: false
+ node: tcwg-bmk-bkp-01
+ concurrent: false
+ display-name: 'TCWG CCC Cleanup stale results'
+ workspace: workspace/tcwg-cleanup-stale-results
+ triggers:
+ - timed: '@weekly'
+ scm:
+ - jenkins-scripts
+ 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 \
+ --dryrun $dryrun \
+ --verbose $verbose
+
+ if [ x"$(cat list_annex.exist_but_not_referenced.txt | wc -l)" != x"0" ]; then
+ (
+ if $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
diff --git a/tcwg-cleanup-stale-results/tcwg-cleanup-stale-results.def b/tcwg-cleanup-stale-results/tcwg-cleanup-stale-results.def
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tcwg-cleanup-stale-results/tcwg-cleanup-stale-results.def