ci: refs#6706 Jenkinsfile fixes

This commit is contained in:
Juan Ferrer 2024-02-06 10:20:04 +01:00
parent 3c140266f4
commit b3e658f9aa
1 changed files with 59 additions and 47 deletions

106
Jenkinsfile vendored
View File

@ -5,34 +5,36 @@ def FROM_GIT
def RUN_TESTS
def RUN_BUILD
pre: {
switch (env.BRANCH_NAME) {
case 'test':
env.NODE_ENV = 'test'
env.BACK_REPLICAS = 2
break
case 'master':
env.NODE_ENV = 'production'
env.BACK_REPLICAS = 4
break
default:
env.NODE_ENV = 'dev'
env.BACK_REPLICAS = 1
node {
stage('Setup') {
switch (env.BRANCH_NAME) {
case 'test':
env.NODE_ENV = 'test'
env.BACK_REPLICAS = 2
break
case 'master':
env.NODE_ENV = 'production'
env.BACK_REPLICAS = 4
break
default:
env.NODE_ENV = 'dev'
env.BACK_REPLICAS = 1
}
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
// Uncomment to enable debugging
// https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference
//env.DEBUG = 'strong-remoting:shared-method'
}
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
// Uncomment to enable debugging
// https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference
//env.DEBUG = 'strong-remoting:shared-method'
}
pipeline {
agent any
@ -47,29 +49,47 @@ pipeline {
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
}
stages {
stage('Install') {
environment {
NODE_ENV = ''
}
parallel {
stage('Back') {
steps {
sh 'pnpm install --prefer-offline'
}
}
stage('Print') {
when {
expression { FROM_GIT }
}
steps {
sh 'pnpm install --prefer-offline --prefix=print'
}
}
stage('Front') {
when {
expression { FROM_GIT }
}
steps {
sh 'pnpm install --prefer-offline --prefix=front'
}
}
}
}
stage('Stack') {
environment {
NODE_ENV = ""
TZ = 'Europe/Madrid'
}
parallel {
stage('Back') {
stages {
stage('Install') {
environment {
NODE_ENV = ""
}
steps {
sh 'pnpm install --prefer-offline'
sh 'pnpm install --prefer-offline --prefix=print'
}
}
stage('Test') {
when {
expression { RUN_TESTS }
}
environment {
NODE_ENV = ""
NODE_ENV = ''
}
steps {
sh 'npm run test:back:ci'
@ -106,20 +126,12 @@ pipeline {
expression { FROM_GIT }
}
stages {
stage('Install') {
environment {
NODE_ENV = ""
}
steps {
sh 'pnpm install --prefer-offline --prefix=front'
}
}
stage('Test') {
when {
expression { RUN_TESTS }
}
environment {
NODE_ENV = ""
NODE_ENV = ''
}
steps {
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=10'