build: refs #6706 Jenkinsfile test
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Juan Ferrer 2024-02-01 21:49:42 +01:00
parent aba88c812e
commit 056ddbd9ae
1 changed files with 14 additions and 10 deletions

24
Jenkinsfile vendored
View File

@ -1,10 +1,6 @@
#!/usr/bin/env groovy
switch (env.BRANCH_NAME) {
case 'dev':
env.NODE_ENV = 'dev'
env.BACK_REPLICAS = 1
break
case 'test':
env.NODE_ENV = 'test'
env.BACK_REPLICAS = 2
@ -13,6 +9,9 @@ switch (env.BRANCH_NAME) {
env.NODE_ENV = 'production'
env.BACK_REPLICAS = 4
break
default:
env.NODE_ENV = 'dev'
env.BACK_REPLICAS = 1
}
def PROTECTED_BRANCH = [
@ -67,7 +66,7 @@ pipeline {
}
stage('Frontend') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
steps {
sh 'npm install --no-audit --prefer-offline --prefix=front'
@ -75,7 +74,7 @@ pipeline {
}
stage('Print') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
steps {
sh 'npm install --no-audit --prefer-offline --prefix=print'
@ -85,7 +84,7 @@ pipeline {
}
stage('Test') {
when {
expression { return RUN_TESTS }
expression { RUN_TESTS }
}
environment {
NODE_ENV = ""
@ -106,7 +105,7 @@ pipeline {
}
stage('Build') {
when {
expression { return PROTECTED_BRANCH && FROM_GIT }
expression { PROTECTED_BRANCH && FROM_GIT }
}
environment {
CREDENTIALS = credentials('docker-registry')
@ -116,9 +115,14 @@ pipeline {
dockerBuild()
}
}
stage('Output') {
steps {
echo "${env.NODE_ENV}"
}
}
stage('Deploy') {
when {
expression { return PROTECTED_BRANCH }
expression { PROTECTED_BRANCH }
}
parallel {
stage('Database') {
@ -136,7 +140,7 @@ pipeline {
}
stage('Docker') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
environment {
DOCKER_HOST = "${env.SWARM_HOST}"