diff --git a/Jenkinsfile b/Jenkinsfile index 0cd57ca0c..7010fa0e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,13 +1,25 @@ #!/usr/bin/env groovy try { + switch (env.BRANCH_NAME) { + case 'master': + env.NODE_ENV = 'production' + break; + case 'test': + env.NODE_ENV = 'test' + break; + case 'dev': + env.NODE_ENV = 'development' + break; + } + node { stage ('Checkout') { checkout scm } stage ('Install') { nodejs('node-lts') { - sh "npm install --no-audit" + sh "env NODE_ENV= npm install --no-audit" sh "gulp install" } } @@ -18,18 +30,6 @@ try { } stage ('Deploy') { withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) { - switch (env.BRANCH_NAME) { - case 'master': - env.NODE_ENV = 'production' - break; - case 'test': - env.NODE_ENV = 'test' - break; - case 'dev': - env.NODE_ENV = 'development' - break; - } - switch (env.BRANCH_NAME) { case 'master': env.PORT = 5000 @@ -53,7 +53,7 @@ try { } } - mail to: 'salix@verdnatura.es', subject: 'Pipeline', "Pipeline success: ${env.JOB_NAME}" + mail(to: 'salix@verdnatura.es', subject: 'Pipeline', "Pipeline success: ${env.JOB_NAME}") } catch(e) { - mail to: 'salix@verdnatura.es', subject: 'Pipeline', "Pipeline failed: ${env.JOB_NAME}" + mail(to: 'salix@verdnatura.es', subject: 'Pipeline', "Pipeline failed: ${env.JOB_NAME}") }