ci: refs #6695 use TARGET_BRANCH #1466

Merged
alexm merged 27 commits from 6695-fix_CHANGE_TARGET into dev 2025-02-27 08:22:36 +00:00
2 changed files with 13 additions and 12 deletions
Showing only changes of commit 39b7cfbe4e - Show all commits

21
Jenkinsfile vendored
View File

@ -12,15 +12,16 @@ def BRANCH_ENV = [
node {
stage('Setup') {
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
PROTECTED_BRANCH = [
GIT_PROTECTED_BRANCH = [
'dev',
'test',
'master',
'main',
'beta'
].contains(env.BRANCH_NAME)
]
PROTECTED_BRANCH = GIT_PROTECTED_BRANCH + ['main','beta']
TARGET_BRANCH = GIT_PROTECTED_BRANCH.find { it == env.CHANGE_TARGET } ?: "dev"
alexm marked this conversation as resolved
Review

contains mes simple, comilles simples en 'dev'

contains mes simple, comilles simples en 'dev'
Outdated
Review

COMPOSE_TAG , defineixla en el stage E2E

COMPOSE_TAG , defineixla en el stage E2E
IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME)
IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME)
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
alexm marked this conversation as resolved Outdated
Outdated
Review

Ns si estava de antes

Ns si estava de antes
@ -36,7 +37,7 @@ node {
props.each {key, value -> echo "${key}: ${value}" }
}
if (PROTECTED_BRANCH) {
if (IS_PROTECTED_BRANCH) {
configFileProvider([
configFile(fileId: "salix-front.branch.${env.BRANCH_NAME}",
variable: 'BRANCH_PROPS_FILE')
@ -63,7 +64,7 @@ pipeline {
stages {
stage('Version') {
when {
expression { PROTECTED_BRANCH }
expression { IS_PROTECTED_BRANCH }
}
steps {
script {
@ -84,7 +85,7 @@ pipeline {
}
stage('Test') {
when {
expression { !PROTECTED_BRANCH }
expression { !IS_PROTECTED_BRANCH }
}
environment {
NODE_ENV = ''
@ -134,7 +135,7 @@ pipeline {
}
stage('Build') {
when {
expression { PROTECTED_BRANCH }
expression { IS_PROTECTED_BRANCH }
}
environment {
CREDENTIALS = credentials('docker-registry')
@ -156,7 +157,7 @@ pipeline {
}
stage('Deploy') {
when {
expression { PROTECTED_BRANCH }
expression { IS_PROTECTED_BRANCH }
}
environment {
VERSION = readFile 'VERSION.txt'

View File

@ -1,7 +1,7 @@
version: '3.7'
services:
back:
image: 'registry.verdnatura.es/salix-back:${CHANGE_TARGET:-dev}'
image: 'registry.verdnatura.es/salix-back:${TARGET_BRANCH:-dev}'
volumes:
- ./test/cypress/storage:/salix/storage
- ./test/cypress/back/datasources.json:/salix/loopback/server/datasources.json
@ -18,4 +18,4 @@ services:
- TZ
dns_search: .
db:
image: 'registry.verdnatura.es/salix-db:${CHANGE_TARGET:-dev}'
image: 'registry.verdnatura.es/salix-db:${TARGET_BRANCH:-dev}'