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 11 additions and 11 deletions

18
Jenkinsfile vendored
View File

@ -12,18 +12,18 @@ def BRANCH_ENV = [
node {
stage('Setup') {
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
PROTECTED_BRANCH = [
'dev',
'test',
'master',
'main',
'beta'
].contains(env.BRANCH_NAME)
]
alexm marked this conversation as resolved
Review

contains mes simple, comilles simples en 'dev'

contains mes simple, comilles simples en 'dev'
IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME)
Outdated
Review

COMPOSE_TAG , defineixla en el stage E2E

COMPOSE_TAG , defineixla en el stage E2E
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
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
Outdated
Review

Mantinles, es per a depurar

Mantinles, es per a depurar
@ -36,7 +36,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 +63,7 @@ pipeline {
stages {
stage('Version') {
when {
expression { PROTECTED_BRANCH }
expression { IS_PROTECTED_BRANCH }
}
steps {
script {
@ -84,7 +84,7 @@ pipeline {
}
stage('Test') {
when {
expression { !PROTECTED_BRANCH }
expression { !IS_PROTECTED_BRANCH }
}
environment {
NODE_ENV = ''
@ -113,6 +113,7 @@ pipeline {
}
steps {
script {
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
Outdated
Review

Ficala en environment, si no no l'agafara

Ficala en environment, si no no l'agafara
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
@ -134,10 +135,9 @@ pipeline {
}
stage('Build') {
when {
expression { PROTECTED_BRANCH }
expression { IS_PROTECTED_BRANCH }
}
environment {
CREDENTIALS = credentials('docker-registry')
VERSION = readFile 'VERSION.txt'
}
steps {
@ -156,7 +156,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:dev
image: 'registry.verdnatura.es/salix-back:${COMPOSE_TAG:-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:dev
image: 'registry.verdnatura.es/salix-db:${COMPOSE_TAG:-dev}'