refs #6915 test_master24_8 #2067

Merged
alexm merged 561 commits from test_master24_8 into master 2024-02-22 07:31:34 +00:00
1 changed files with 50 additions and 50 deletions
Showing only changes of commit 04976bb6ad - Show all commits

100
Jenkinsfile vendored
View File

@ -4,60 +4,60 @@ def PROTECTED_BRANCH
def FROM_GIT
def RUN_TESTS
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
}
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !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'
}
node {
stage('Setup') {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
env.GIT_COMMIT_MSG = sh(
script: 'git log -1 --pretty=%B ${GIT_COMMIT}',
returnStdout: true
).trim()
setEnv()
}
}
pipeline {
agent any
options {
disableConcurrentBuilds()
}
tools {
nodejs 'node-v20'
}
environment {
PROJECT_NAME = 'salix'
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
}
tools {
nodejs 'node-v20'
}
stages {
stage('Checkout') {
steps {
script {
// Uncomment to enable debugging
//env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method'
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
break
case 'master':
env.NODE_ENV = 'production'
env.BACK_REPLICAS = 4
break
}
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
env.GIT_COMMIT_MSG = sh(
script: 'git log -1 --pretty=%B ${GIT_COMMIT}',
returnStdout: true
).trim()
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
}
setEnv()
}
}
stage('Install') {
environment {
NODE_ENV = ""
@ -70,7 +70,7 @@ pipeline {
}
stage('Frontend') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
steps {
sh 'npm install --no-audit --prefer-offline --prefix=front'
@ -78,7 +78,7 @@ pipeline {
}
stage('Print') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
steps {
sh 'npm install --no-audit --prefer-offline --prefix=print'
@ -88,7 +88,7 @@ pipeline {
}
stage('Test') {
when {
expression { return RUN_TESTS }
expression { RUN_TESTS }
}
environment {
NODE_ENV = ""
@ -109,7 +109,7 @@ pipeline {
}
stage('Build') {
when {
expression { return PROTECTED_BRANCH && FROM_GIT }
expression { PROTECTED_BRANCH && FROM_GIT }
}
environment {
CREDENTIALS = credentials('docker-registry')
@ -121,7 +121,7 @@ pipeline {
}
stage('Deploy') {
when {
expression { return PROTECTED_BRANCH }
expression { PROTECTED_BRANCH }
}
parallel {
stage('Database') {
@ -139,7 +139,7 @@ pipeline {
}
stage('Docker') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
environment {
DOCKER_HOST = "${env.SWARM_HOST}"