-
Notifications
You must be signed in to change notification settings - Fork 12
Build age range condition
Damian Szczepanik edited this page Dec 30, 2019
·
3 revisions
This page presents example how to use BuildAgeRange condition:
- delete artifacts for builds which were built yesterday or the day before yesterday
pipeline {
agent any
options {
buildDiscarder(
BuildHistoryManager([
[
conditions: [
BuildAgeRange(minDaysAge: 1, maxDaysAge: 2),
actions: [ DeleteArtifacts() ]
]
])
)
}
stages {
stage('Demo') {
steps {
echo "Hello!"
}
}
}
}Following presents build history before and after running above configuration. Numbers refer to Jenkins job number.
| Before | After | Reason |
|---|---|---|
[ 80]today |
[ 80] |
None rule matched. |
[ 76]today |
[ 76] |
None rule matched. |
[ 75]yesterday |
Matched by first rule. Artifacts have been removed. |
|
[ 73]2 days old |
Matched by first rule. Artifacts have been removed. |
|
[ 71]3 days old |
[ 71] |
None rule matched. |