Jenkinsfile refactor

This commit is contained in:
Juan Ferrer 2019-01-11 13:06:15 +01:00
parent 776aa089df
commit c5b3c5d191
1 changed files with 13 additions and 13 deletions

26
Jenkinsfile vendored
View File

@ -3,18 +3,6 @@
def buildError
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;
}
def registry = 'registry.verdnatura.es'
env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-');
env.TAG = env.BRANCH_NAME
@ -28,6 +16,18 @@ try {
break;
}
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
@ -51,7 +51,7 @@ try {
usernameVariable: 'USER',
passwordVariable: 'PASSWORD')
]) {
sh "docker login --username \"${env.USER}\" --password \"${env.PASSWORD}\" ${registry}"
sh "docker login --username \$USER --password \$PASSWORD ${registry}"
}
sh "docker-compose build --parallel"