From 5f14e79bfac9dc5e5f2d31d08398357236a9ec8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Tue, 26 Sep 2017 15:00:45 +0200 Subject: [PATCH 1/2] Simplify Jenkinsfile Remove locking and milestone; use declarative pipeline syntax. --- Jenkinsfile | 56 ++++++++++++++++------------------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 68f0bab2c..d2b9056e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,54 +12,32 @@ * Removal or modification of this copyright notice is prohibited. * */ -node('lisk-js-01'){ - lock(resource: "lisk-js-01", inversePrecedence: true) { - stage ('Prepare Workspace') { - deleteDir() - checkout scm +pipeline { + agent { node { label 'lisk-js' } } + stages { + stage('Prepare workspace') { + steps { + deleteDir() + checkout scm + } } - - stage ('Build Dependencies') { - try { - sh '''#!/bin/bash - # Install Deps + stage('Install dependencies') { + steps { + sh ''' npm install --verbose cp ~/.coveralls.yml . ''' - } catch (err) { - currentBuild.result = 'FAILURE' - error('Stopping build, installation failed') } } - - stage ('Run Eslint') { - try { - sh '''#!/bin/bash - # Run Tests - grunt eslint-ci - ''' - } catch (err) { - currentBuild.result = 'FAILURE' - error('Stopping build, tests failed') + stage('Run lint') { + steps{ + sh 'grunt eslint-ci' } } - - stage ('Run tests') { - try { - sh '''#!/bin/bash - # Run Tests - npm run jenkins - ''' - } catch (err) { - currentBuild.result = 'FAILURE' - error('Stopping build, tests failed') + stage('Run tests') { + steps { + sh 'npm run jenkins' } } - - stage ('Set milestone') { - milestone 1 - deleteDir() - currentBuild.result = 'SUCCESS' - } } } From 925b0ddf693c56c9b17a61bf6868b30b49b23196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Wed, 27 Sep 2017 10:40:28 +0200 Subject: [PATCH 2/2] Add cleanup stage. Call deleteDir() after a sucessful build to preserve space. --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d2b9056e4..346265024 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,5 +39,10 @@ pipeline { sh 'npm run jenkins' } } + stage('Cleanup') { + steps { + deleteDir() + } + } } }