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

This commit is contained in:
Juan Ferrer 2024-02-01 21:35:28 +01:00
parent 603d8e3d92
commit aba88c812e
1 changed files with 25 additions and 28 deletions

53
Jenkinsfile vendored
View File

@ -1,8 +1,28 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
def PROTECTED_BRANCH switch (env.BRANCH_NAME) {
def FROM_GIT case 'dev':
def RUN_TESTS 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 PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
def FROM_GIT = env.JOB_NAME.startsWith('gitea/')
def RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
pipeline { pipeline {
agent any agent any
@ -21,22 +41,8 @@ pipeline {
steps { steps {
script { script {
// Uncomment to enable debugging // Uncomment to enable debugging
//env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method' // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference
//env.DEBUG = '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' def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version env.VERSION = packageJson.version
@ -45,15 +51,6 @@ pipeline {
script: 'git log -1 --pretty=%B ${GIT_COMMIT}', script: 'git log -1 --pretty=%B ${GIT_COMMIT}',
returnStdout: true returnStdout: true
).trim() ).trim()
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
} }
setEnv() setEnv()
} }