From e0d08307938916e059cd5f129aa53d19a387aabf Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 13:46:35 +0100 Subject: [PATCH 01/14] ci: refs #6695 comment out test stages in Jenkinsfile --- Jenkinsfile | 101 ++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8efc2f880..6f7f18b57 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,58 +80,59 @@ pipeline { } steps { sh 'pnpm install --prefer-offline' + echo CHANGE_TARGET } } - stage('Test') { - when { - expression { !PROTECTED_BRANCH } - } - environment { - NODE_ENV = '' - CI = 'true' - TZ = 'Europe/Madrid' - } - parallel { - stage('Unit') { - steps { - sh 'pnpm run test:unit:ci' - } - post { - always { - junit( - testResults: 'junit/vitest.xml', - allowEmptyResults: true - ) - } - } - } - stage('E2E') { - environment { - CREDENTIALS = credentials('docker-registry') - COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" - COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - } - steps { - script { - 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") { - sh 'cypress run --browser chromium' - } - } - } - post { - always { - sh "docker-compose ${env.COMPOSE_PARAMS} down" - junit( - testResults: 'junit/e2e.xml', - allowEmptyResults: true - ) - } - } - } - } - } + // stage('Test') { + // when { + // expression { !PROTECTED_BRANCH } + // } + // environment { + // NODE_ENV = '' + // CI = 'true' + // TZ = 'Europe/Madrid' + // } + // parallel { + // stage('Unit') { + // steps { + // sh 'pnpm run test:unit:ci' + // } + // post { + // always { + // junit( + // testResults: 'junit/vitest.xml', + // allowEmptyResults: true + // ) + // } + // } + // } + // stage('E2E') { + // environment { + // CREDENTIALS = credentials('docker-registry') + // COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" + // COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + // } + // steps { + // script { + // 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") { + // sh 'cypress run --browser chromium' + // } + // } + // } + // post { + // always { + // sh "docker-compose ${env.COMPOSE_PARAMS} down" + // junit( + // testResults: 'junit/e2e.xml', + // allowEmptyResults: true + // ) + // } + // } + // } + // } + // } stage('Build') { when { expression { PROTECTED_BRANCH } -- 2.40.1 From 64549603caeadb77dede55688c52e43cd5a494dd Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 13:54:37 +0100 Subject: [PATCH 02/14] ci: refs #6695 update docker-compose to use dynamic image tags --- Jenkinsfile | 101 ++++++++++++++++---------------- test/cypress/docker-compose.yml | 4 +- 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6f7f18b57..8efc2f880 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,59 +80,58 @@ pipeline { } steps { sh 'pnpm install --prefer-offline' - echo CHANGE_TARGET } } - // stage('Test') { - // when { - // expression { !PROTECTED_BRANCH } - // } - // environment { - // NODE_ENV = '' - // CI = 'true' - // TZ = 'Europe/Madrid' - // } - // parallel { - // stage('Unit') { - // steps { - // sh 'pnpm run test:unit:ci' - // } - // post { - // always { - // junit( - // testResults: 'junit/vitest.xml', - // allowEmptyResults: true - // ) - // } - // } - // } - // stage('E2E') { - // environment { - // CREDENTIALS = credentials('docker-registry') - // COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" - // COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - // } - // steps { - // script { - // 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") { - // sh 'cypress run --browser chromium' - // } - // } - // } - // post { - // always { - // sh "docker-compose ${env.COMPOSE_PARAMS} down" - // junit( - // testResults: 'junit/e2e.xml', - // allowEmptyResults: true - // ) - // } - // } - // } - // } - // } + stage('Test') { + when { + expression { !PROTECTED_BRANCH } + } + environment { + NODE_ENV = '' + CI = 'true' + TZ = 'Europe/Madrid' + } + parallel { + stage('Unit') { + steps { + sh 'pnpm run test:unit:ci' + } + post { + always { + junit( + testResults: 'junit/vitest.xml', + allowEmptyResults: true + ) + } + } + } + stage('E2E') { + environment { + CREDENTIALS = credentials('docker-registry') + COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" + COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + } + steps { + script { + 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") { + sh 'cypress run --browser chromium' + } + } + } + post { + always { + sh "docker-compose ${env.COMPOSE_PARAMS} down" + junit( + testResults: 'junit/e2e.xml', + allowEmptyResults: true + ) + } + } + } + } + } stage('Build') { when { expression { PROTECTED_BRANCH } diff --git a/test/cypress/docker-compose.yml b/test/cypress/docker-compose.yml index 9d51ee345..bf22c5877 100644 --- a/test/cypress/docker-compose.yml +++ b/test/cypress/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: back: - image: registry.verdnatura.es/salix-back:dev + image: 'registry.verdnatura.es/salix-back:${CHANGE_TARGET:-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:${CHANGE_TARGET:-dev}' -- 2.40.1 From 39b7cfbe4e79bee9fe57f766f19a84eb9ff30268 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 14:26:26 +0100 Subject: [PATCH 03/14] ci: refs #6695 update docker-compose to use dynamic image tags --- Jenkinsfile | 21 +++++++++++---------- test/cypress/docker-compose.yml | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8efc2f880..8abb84672 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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" + + 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 @@ -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' diff --git a/test/cypress/docker-compose.yml b/test/cypress/docker-compose.yml index bf22c5877..5b0303e07 100644 --- a/test/cypress/docker-compose.yml +++ b/test/cypress/docker-compose.yml @@ -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}' -- 2.40.1 From 1018a0aa905cb01f6b7467e9df604f0f277b94ce Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 14:49:32 +0100 Subject: [PATCH 04/14] ci: refs #6695 remove unnecessary echo statements from Jenkinsfile --- Jenkinsfile | 105 +++++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 54 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8abb84672..2f3012f8d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,14 +20,11 @@ node { PROTECTED_BRANCH = GIT_PROTECTED_BRANCH + ['main','beta'] TARGET_BRANCH = GIT_PROTECTED_BRANCH.find { it == env.CHANGE_TARGET } ?: "dev" + echo TARGET_BRANCH 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 - echo "NODE_NAME: ${env.NODE_NAME}" - echo "WORKSPACE: ${env.WORKSPACE}" - configFileProvider([ configFile(fileId: 'salix-front.properties', variable: 'PROPS_FILE') @@ -83,56 +80,56 @@ pipeline { sh 'pnpm install --prefer-offline' } } - stage('Test') { - when { - expression { !IS_PROTECTED_BRANCH } - } - environment { - NODE_ENV = '' - CI = 'true' - TZ = 'Europe/Madrid' - } - parallel { - stage('Unit') { - steps { - sh 'pnpm run test:unit:ci' - } - post { - always { - junit( - testResults: 'junit/vitest.xml', - allowEmptyResults: true - ) - } - } - } - stage('E2E') { - environment { - CREDENTIALS = credentials('docker-registry') - COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" - COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - } - steps { - script { - 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") { - sh 'cypress run --browser chromium' - } - } - } - post { - always { - sh "docker-compose ${env.COMPOSE_PARAMS} down" - junit( - testResults: 'junit/e2e.xml', - allowEmptyResults: true - ) - } - } - } - } - } + // stage('Test') { + // when { + // expression { !IS_PROTECTED_BRANCH } + // } + // environment { + // NODE_ENV = '' + // CI = 'true' + // TZ = 'Europe/Madrid' + // } + // parallel { + // stage('Unit') { + // steps { + // sh 'pnpm run test:unit:ci' + // } + // post { + // always { + // junit( + // testResults: 'junit/vitest.xml', + // allowEmptyResults: true + // ) + // } + // } + // } + // stage('E2E') { + // environment { + // CREDENTIALS = credentials('docker-registry') + // COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" + // COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + // } + // steps { + // script { + // 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") { + // sh 'cypress run --browser chromium' + // } + // } + // } + // post { + // always { + // sh "docker-compose ${env.COMPOSE_PARAMS} down" + // junit( + // testResults: 'junit/e2e.xml', + // allowEmptyResults: true + // ) + // } + // } + // } + // } + // } stage('Build') { when { expression { IS_PROTECTED_BRANCH } -- 2.40.1 From 05994ba1dc23abba33a1360022871030aae4331b Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 14:52:12 +0100 Subject: [PATCH 05/14] ci: refs #6695 remove unnecessary echo statements from Jenkinsfile --- Jenkinsfile | 101 ++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2f3012f8d..07c6a9bd8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,6 @@ node { PROTECTED_BRANCH = GIT_PROTECTED_BRANCH + ['main','beta'] TARGET_BRANCH = GIT_PROTECTED_BRANCH.find { it == env.CHANGE_TARGET } ?: "dev" - echo TARGET_BRANCH IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME) IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME) @@ -80,56 +79,56 @@ pipeline { sh 'pnpm install --prefer-offline' } } - // stage('Test') { - // when { - // expression { !IS_PROTECTED_BRANCH } - // } - // environment { - // NODE_ENV = '' - // CI = 'true' - // TZ = 'Europe/Madrid' - // } - // parallel { - // stage('Unit') { - // steps { - // sh 'pnpm run test:unit:ci' - // } - // post { - // always { - // junit( - // testResults: 'junit/vitest.xml', - // allowEmptyResults: true - // ) - // } - // } - // } - // stage('E2E') { - // environment { - // CREDENTIALS = credentials('docker-registry') - // COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" - // COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - // } - // steps { - // script { - // 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") { - // sh 'cypress run --browser chromium' - // } - // } - // } - // post { - // always { - // sh "docker-compose ${env.COMPOSE_PARAMS} down" - // junit( - // testResults: 'junit/e2e.xml', - // allowEmptyResults: true - // ) - // } - // } - // } - // } - // } + stage('Test') { + when { + expression { !IS_PROTECTED_BRANCH } + } + environment { + NODE_ENV = '' + CI = 'true' + TZ = 'Europe/Madrid' + } + parallel { + stage('Unit') { + steps { + sh 'pnpm run test:unit:ci' + } + post { + always { + junit( + testResults: 'junit/vitest.xml', + allowEmptyResults: true + ) + } + } + } + stage('E2E') { + environment { + CREDENTIALS = credentials('docker-registry') + COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" + COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + } + steps { + script { + 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") { + sh 'cypress run --browser chromium' + } + } + } + post { + always { + sh "docker-compose ${env.COMPOSE_PARAMS} down -v" + junit( + testResults: 'junit/e2e.xml', + allowEmptyResults: true + ) + } + } + } + } + } stage('Build') { when { expression { IS_PROTECTED_BRANCH } -- 2.40.1 From 6f688c337ea90b74d2df541d2904986a4a8ea6fb Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 15:07:01 +0100 Subject: [PATCH 06/14] ci: refs #6695 update Jenkinsfile to include 'main' and 'beta' in protected branches --- Jenkinsfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07c6a9bd8..977f19ac2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,18 +12,23 @@ def BRANCH_ENV = [ node { stage('Setup') { env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev' - GIT_PROTECTED_BRANCH = [ + PROTECTED_BRANCH = [ 'dev', 'test', 'master', + 'main', + 'beta' ] - PROTECTED_BRANCH = GIT_PROTECTED_BRANCH + ['main','beta'] - TARGET_BRANCH = GIT_PROTECTED_BRANCH.find { it == env.CHANGE_TARGET } ?: "dev" + TARGET_BRANCH = PROTECTED_BRANCH.find { it == env.CHANGE_TARGET } ?: "dev" 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 + echo "NODE_NAME: ${env.NODE_NAME}" + echo "WORKSPACE: ${env.WORKSPACE}" + configFileProvider([ configFile(fileId: 'salix-front.properties', variable: 'PROPS_FILE') -- 2.40.1 From b2ae8c5714468e2eb4c3aa716e356f19e8c0a874 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 15:12:15 +0100 Subject: [PATCH 07/14] ci: refs #6695 update Jenkinsfile to improve TARGET_BRANCH assignment logic --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 977f19ac2..76aa2227f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,8 +20,8 @@ node { 'beta' ] - TARGET_BRANCH = PROTECTED_BRANCH.find { it == env.CHANGE_TARGET } ?: "dev" - + TARGET_BRANCH = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : "dev" + echo "TARGET_BRANCH" TARGET_BRANCH IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME) IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME) -- 2.40.1 From ddbae9a13daa3fb15affc3b77be84353884489aa Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 15:14:16 +0100 Subject: [PATCH 08/14] ci: refs #6695 update Jenkinsfile to improve TARGET_BRANCH assignment logic --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 76aa2227f..5927c4b80 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { ] TARGET_BRANCH = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : "dev" - echo "TARGET_BRANCH" TARGET_BRANCH + echo TARGET_BRANCH IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME) IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME) -- 2.40.1 From 9d5e04a8aec9999407d654d998dfbfb608b6342d Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 15:15:52 +0100 Subject: [PATCH 09/14] ci: refs #6695 update Jenkinsfile to remove echo statement for TARGET_BRANCH --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5927c4b80..c38317328 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { ] TARGET_BRANCH = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : "dev" - echo TARGET_BRANCH + IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME) IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME) -- 2.40.1 From d09b753a6679fa78863de4da644bf95af36846f1 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 24 Feb 2025 07:08:28 +0100 Subject: [PATCH 10/14] ci: refs #6695 update Jenkinsfile and docker-compose.yml to use COMPOSE_TAG for branch targeting --- Jenkinsfile | 3 +-- test/cypress/docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c38317328..963b96a40 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,8 +20,6 @@ node { 'beta' ] - TARGET_BRANCH = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : "dev" - IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME) IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME) @@ -112,6 +110,7 @@ pipeline { CREDENTIALS = credentials('docker-registry') COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' } steps { script { diff --git a/test/cypress/docker-compose.yml b/test/cypress/docker-compose.yml index 5b0303e07..8d70c5248 100644 --- a/test/cypress/docker-compose.yml +++ b/test/cypress/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: back: - image: 'registry.verdnatura.es/salix-back:${TARGET_BRANCH:-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:${TARGET_BRANCH:-dev}' + image: 'registry.verdnatura.es/salix-db:${COMPOSE_TAG:-dev}' -- 2.40.1 From cf30dff90556d7d5122553d172b09327e9cb7332 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 24 Feb 2025 07:23:45 +0100 Subject: [PATCH 11/14] ci: refs #6695 update Jenkinsfile to use double quotes for COMPOSE_TAG assignment --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 963b96a40..90b788ec8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,7 +110,7 @@ pipeline { CREDENTIALS = credentials('docker-registry') COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' + COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : "dev" } steps { script { -- 2.40.1 From e1d91a0b1999de58b0feb98db4dd8339a45b0445 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 24 Feb 2025 07:24:37 +0100 Subject: [PATCH 12/14] ci: refs #6695 update Jenkinsfile to use single quotes for COMPOSE_TAG assignment --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 90b788ec8..3563bedd8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,10 +110,10 @@ pipeline { CREDENTIALS = credentials('docker-registry') COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : "dev" } steps { script { + COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' 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") { -- 2.40.1 From ca2e8e89df0eeaeeb7ff65a00617ab7e9632ddf4 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 24 Feb 2025 09:32:36 +0100 Subject: [PATCH 13/14] ci: refs #6695 update Jenkinsfile to assign COMPOSE_TAG within the pipeline block --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3563bedd8..b82981af4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,10 +110,10 @@ pipeline { CREDENTIALS = credentials('docker-registry') COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' } steps { script { - COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' 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") { @@ -138,7 +138,6 @@ pipeline { expression { IS_PROTECTED_BRANCH } } environment { - CREDENTIALS = credentials('docker-registry') VERSION = readFile 'VERSION.txt' } steps { -- 2.40.1 From bb4a919c10f182584c9f6daf20cacd62804d2f64 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 24 Feb 2025 09:34:30 +0100 Subject: [PATCH 14/14] ci: refs #6695 update Jenkinsfile to assign COMPOSE_TAG within the pipeline block --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b82981af4..8e22a87da 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,10 +110,10 @@ pipeline { CREDENTIALS = credentials('docker-registry') COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' } steps { script { + env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' 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") { -- 2.40.1