This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/Jenkinsfile_update in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 9b6a682fc8a6d0a205e66b6c34126670da952a23 Author: Sebastian Rühl <sru...@apache.org> AuthorDate: Thu Feb 22 12:25:36 2018 +0100 migrate to declarative jenkins pipeline --- Jenkinsfile | 88 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9d02cc8..0738d62 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,60 +18,62 @@ * limitations under the License. * */ -// TODO: migrate to declarative pipeline if possible (https://jenkins.io/doc/book/pipeline/jenkinsfile/) -node('ubuntu && !H33') { - - currentBuild.result = "SUCCESS" - - echo 'Building Branch: ' + env.BRANCH_NAME - - // Setup the required environment variables. - def mvnHome = "${tool 'Maven 3 (latest)'}" - env.JAVA_HOME="${tool 'JDK 1.8 (latest)'}" - env.PATH="${env.JAVA_HOME}/bin:${env.PATH}" +pipeline { + agent { + node { + label 'ubuntu && !H33' + } + } - // Make sure the feature branches don't change the SNAPSHOTS in Nexus. - def mavenGoal = "install" - def mavenLocalRepo = "" - if(env.BRANCH_NAME == 'master') { - mavenGoal = "deploy sonar:sonar" - } else { - mavenLocalRepo = "-Dmaven.repo.local=.repository" + environment { + CC = 'clang' + MVN_HOME = "${tool 'Maven 3 (latest)'}" + JAVA_HOME = "${tool 'JDK 1.8 (latest)'}" + PATH = "${env.JAVA_HOME}/bin:${env.PATH}" } - try { - stage ('Cleanup') { - echo 'Cleaning up the workspace' - deleteDir() + stages { + stage('Initialization') { + steps { + echo 'Building Branch: ' + env.BRANCH_NAME + } } - stage ('Checkout') { - echo 'Checking out branch ' + env.BRANCH_NAME - checkout scm + stage('Cleanup') { + steps { + echo 'Cleaning up the workspace' + deleteDir() + } } - stage ('Build') { - echo 'Building' - sh "${mvnHome}/bin/mvn -Pjenkins-build ${mavenLocalRepo} clean ${mavenGoal} site:site" + stage('Checkout') { + steps { + echo 'Checking out branch ' + env.BRANCH_NAME + checkout scm + } } - stage ('Stage Site') { - echo 'Staging Site' - sh "${mvnHome}/bin/mvn -Pjenkins-build ${mavenLocalRepo} site:stage" + stage('Build') { + steps { + // Make sure the feature branches don't change the SNAPSHOTS in Nexus. + def mavenGoal = "install" + def mavenLocalRepo = "" + if (env.BRANCH_NAME == 'master') { + mavenGoal = "deploy sonar:sonar" + } else { + mavenLocalRepo = "-Dmaven.repo.local=.repository" + } + echo 'Building' + sh "${MVN_HOME}/bin/mvn -Pjenkins-build ${mavenLocalRepo} clean ${mavenGoal} site:site" + } } - } - + stage('Stage Site') { + steps { + echo 'Staging Site' + sh "${MVN_HOME}/bin/mvn -Pjenkins-build ${mavenLocalRepo} site:stage" + } + } - catch (err) { - currentBuild.result = "FAILURE" -/* mail body: "project build error is here: ${env.BUILD_URL}" , - from: 'x...@yyyy.com', - replyTo: 'd...@plc4x.apache.org', - subject: 'Autobuild for Branch ' env.BRANCH_NAME - to: 'commits@plc4x.apache.org' -*/ - throw err } - } \ No newline at end of file -- To stop receiving notification emails like this one, please contact sru...@apache.org.