From 9d86753b9535e92c8730107fe0643ac51dca7e05 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 12 Oct 2016 10:24:40 +0200
Subject: [PATCH] [Jenkins] Fixed deploy-job and formatted
 BuildDiscarderProperty.

---
 Jenkinsfile                        |  8 +++++++-
 scripts/jenkins/clang.groovy       |  8 ++++++++
 scripts/jenkins/coverage.groovy    |  9 +++++++--
 scripts/jenkins/deploy-post.groovy |  7 +++++--
 scripts/jenkins/deploy.groovy      | 10 +++++++---
 5 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 7d544222a43..10ce12b72ec 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -38,4 +38,10 @@ node('master') {
     }
 }
 
-properties ([[$class: 'org.jenkinsci.plugins.workflow.job.properties.BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '25']]])
+properties([[
+    $class: 'org.jenkinsci.plugins.workflow.job.properties.BuildDiscarderProperty',
+    strategy: [$class: 'LogRotator',
+    artifactDaysToKeepStr: '',
+    artifactNumToKeepStr: '5',
+    daysToKeepStr: '',
+    numToKeepStr: '25']]])
diff --git a/scripts/jenkins/clang.groovy b/scripts/jenkins/clang.groovy
index e3267fdc50b..a9060b38e91 100644
--- a/scripts/jenkins/clang.groovy
+++ b/scripts/jenkins/clang.groovy
@@ -37,3 +37,11 @@ node('docker') {
         'ogs/scripts/jenkins/clang-log-parser.rules')
     post.cleanup()
 }
+
+properties([[
+    $class: 'org.jenkinsci.plugins.workflow.job.properties.BuildDiscarderProperty',
+    strategy: [$class: 'LogRotator',
+    artifactDaysToKeepStr: '',
+    artifactNumToKeepStr: '5',
+    daysToKeepStr: '',
+    numToKeepStr: '25']]])
diff --git a/scripts/jenkins/coverage.groovy b/scripts/jenkins/coverage.groovy
index e3341cce7e6..7086b147396 100644
--- a/scripts/jenkins/coverage.groovy
+++ b/scripts/jenkins/coverage.groovy
@@ -25,5 +25,10 @@ def build(buildDir, cmakeOptions, target) {
     sh "cd ${buildDir} && make -j \$(nproc) ${target}"
 }
 
-properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator',
-    artifactDaysToKeepStr: '', artifactNumToKeepStr: '1', daysToKeepStr: '', numToKeepStr: '5']]])
+properties([[
+    $class: 'org.jenkinsci.plugins.workflow.job.properties.BuildDiscarderProperty',
+    strategy: [$class: 'LogRotator',
+    artifactDaysToKeepStr: '',
+    artifactNumToKeepStr: '1',
+    daysToKeepStr: '',
+    numToKeepStr: '5']]])
diff --git a/scripts/jenkins/deploy-post.groovy b/scripts/jenkins/deploy-post.groovy
index 06b976b966a..72092dcaee9 100644
--- a/scripts/jenkins/deploy-post.groovy
+++ b/scripts/jenkins/deploy-post.groovy
@@ -14,7 +14,10 @@ node('master') {
             'Content-Type', value: 'Application/json']]])
 }
 
-properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator',
+properties([[
+    $class: 'org.jenkinsci.plugins.workflow.job.properties.BuildDiscarderProperty',
+    strategy: [$class: 'LogRotator',
     artifactDaysToKeepStr: '',
     artifactNumToKeepStr: '5',
-    daysToKeepStr: '', numToKeepStr: '10']]])
+    daysToKeepStr: '',
+    numToKeepStr: '10']]])
diff --git a/scripts/jenkins/deploy.groovy b/scripts/jenkins/deploy.groovy
index 0fc87d5f62a..70255fbba9e 100644
--- a/scripts/jenkins/deploy.groovy
+++ b/scripts/jenkins/deploy.groovy
@@ -3,13 +3,17 @@
 node('master') {
     stage 'Deploy to S3'
     deleteDir()
-    step([$class: 'CopyArtifact', fingerprintArtifacts: true, flatten: true,
-        projectName: 'OGS-6/ufz/master'])
+    step([$class: 'CopyArtifact',
+        fingerprintArtifacts: true, flatten: true,
+        projectName: 'OGS-6/ufz/master',
+        selector: [$class: 'LastCompletedBuildSelector']])
     s3upload('*')
     build job: 'OGS-6/Deploy-Post', wait: false
 }
 
-properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator',
+properties([[
+    $class: 'org.jenkinsci.plugins.workflow.job.properties.BuildDiscarderProperty',
+    strategy: [$class: 'LogRotator',
     artifactDaysToKeepStr: '',
     artifactNumToKeepStr: '5',
     daysToKeepStr: '',
-- 
GitLab