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