From c8b517c67d5601b97465f5d37a6fb3c46baa07aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Wed, 11 Oct 2017 11:37:19 +0200 Subject: [PATCH 1/2] Deploy after build stage and notify GitHub. Move test deployment so that it happens right after the "Build nano" stage and notify GitHub status API with custom context. --- Jenkinsfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 036ee15d7..992146201 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,6 +74,16 @@ node('lisk-nano') { } } + stage ('Deploy') { + try { + sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/lisk-nano/$BRANCH_NAME/ && rsync" $WORKSPACE/app/dist/ jenkins@master-01:/var/www/test/lisk-nano/$BRANCH_NAME/' + githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "https://${HUDSON_URL}/test/lisk-nano/${BRANCH_NAME}" + } catch (err) { + echo "Error: ${err}" + fail('Stopping build: deploy failed') + } + } + stage ('Run Unit Tests') { try { ansiColor('xterm') { @@ -111,15 +121,6 @@ node('lisk-nano') { fail('Stopping build: end-to-end test suite failed') } } - - stage ('Deploy') { - try { - sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/lisk-nano/$BRANCH_NAME/ && rsync" $WORKSPACE/app/dist/ jenkins@master-01:/var/www/test/lisk-nano/$BRANCH_NAME/' - } catch (err) { - echo "Error: ${err}" - fail('Stopping build: deploy failed') - } - } } catch(err) { echo "Error: ${err}" } finally { From d61f534815130a3c3f0168e07141581f0a3f1e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Wed, 11 Oct 2017 13:11:57 +0200 Subject: [PATCH 2/2] Fix targetUrl: $HUDSON_URL contains protocol --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 992146201..5e0a12499 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,7 +77,7 @@ node('lisk-nano') { stage ('Deploy') { try { sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/lisk-nano/$BRANCH_NAME/ && rsync" $WORKSPACE/app/dist/ jenkins@master-01:/var/www/test/lisk-nano/$BRANCH_NAME/' - githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "https://${HUDSON_URL}/test/lisk-nano/${BRANCH_NAME}" + githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/lisk-nano/${BRANCH_NAME}" } catch (err) { echo "Error: ${err}" fail('Stopping build: deploy failed')