From 28168130aea1cc25ada69ebba416b5c8a9b11dff Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 11:40:13 +0100 Subject: [PATCH 1/7] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a1341dc985..a49405cdc7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,16 @@ node { stage('Setup') { env.NODE_ENV = 'dev' + PROTECTED_BRANCH = [ + 'dev', + 'test', + 'master' + ].contains(env.BRANCH_NAME) + + FROM_GIT = env.JOB_NAME.startsWith('gitea/') + RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT + RUN_BUILD = PROTECTED_BRANCH && FROM_GIT + configFileProvider([ configFile(fileId: 'salix.properties', variable: 'PROPS_FILE') @@ -28,21 +38,10 @@ node { } } - PROTECTED_BRANCH = [ - 'dev', - 'test', - 'master' - ].contains(env.BRANCH_NAME) - - FROM_GIT = env.JOB_NAME.startsWith('gitea/') - RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT - RUN_BUILD = PROTECTED_BRANCH && FROM_GIT - // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables echo "Node: ${NODE_NAME}" echo "Workspace: ${WORKSPACE}" echo "Debug: ${env.DEBUG}" - echo "Replicas: ${env.BACK_REPLICAS}" } } pipeline { From 19080e348af53374ba03090a0bb4664ac552e5bd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 12:11:03 +0100 Subject: [PATCH 2/7] ci: refs#6706 Jenkinsfile print properties --- Jenkinsfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a49405cdc7..20baa8ace1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,12 +19,17 @@ node { RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT RUN_BUILD = PROTECTED_BRANCH && FROM_GIT + // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables + echo "Node: ${env.NODE_NAME}" + echo "Workspace: ${env.WORKSPACE}" + configFileProvider([ configFile(fileId: 'salix.properties', variable: 'PROPS_FILE') ]) { def props = readProperties file: PROPS_FILE - env.DEBUG = props.DEBUG + props.each { key, value -> env[key] = value } + props.each { key, value -> println "${key}: ${value}" } } if (PROTECTED_BRANCH) { @@ -33,15 +38,10 @@ node { variable: 'BRANCH_PROPS_FILE') ]) { def props = readProperties file: BRANCH_PROPS_FILE - env.BACK_REPLICAS = props.BACK_REPLICAS - env.NODE_ENV = props.NODE_ENV + props.each { key, value -> env[key] = value } + props.each { key, value -> println "${key}: ${value}" } } } - - // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables - echo "Node: ${NODE_NAME}" - echo "Workspace: ${WORKSPACE}" - echo "Debug: ${env.DEBUG}" } } pipeline { From 5c48d8c6b97a2347a95118a1ee1b56a44aa81e32 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 12:12:09 +0100 Subject: [PATCH 3/7] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 20baa8ace1..a0442422c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,6 @@ node { ]) { def props = readProperties file: PROPS_FILE props.each { key, value -> env[key] = value } - props.each { key, value -> println "${key}: ${value}" } } if (PROTECTED_BRANCH) { @@ -39,7 +38,6 @@ node { ]) { def props = readProperties file: BRANCH_PROPS_FILE props.each { key, value -> env[key] = value } - props.each { key, value -> println "${key}: ${value}" } } } } From 4067108258f94893f05c7add66e56bbf3f8a3e92 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 12:14:00 +0100 Subject: [PATCH 4/7] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0442422c6..a8091121ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,16 +19,12 @@ node { RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT RUN_BUILD = PROTECTED_BRANCH && FROM_GIT - // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables - echo "Node: ${env.NODE_NAME}" - echo "Workspace: ${env.WORKSPACE}" - configFileProvider([ configFile(fileId: 'salix.properties', variable: 'PROPS_FILE') ]) { def props = readProperties file: PROPS_FILE - props.each { key, value -> env[key] = value } + env.DEBUG = props.DEBUG } if (PROTECTED_BRANCH) { @@ -37,9 +33,15 @@ node { variable: 'BRANCH_PROPS_FILE') ]) { def props = readProperties file: BRANCH_PROPS_FILE - props.each { key, value -> env[key] = value } + env.BACK_REPLICAS = props.BACK_REPLICAS + env.NODE_ENV = props.NODE_ENV } } + + // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables + echo "Node: ${env.NODE_NAME}" + echo "Workspace: ${env.WORKSPACE}" + echo "Debug: ${env.DEBUG}" } } pipeline { From 4c123247d81029641ae2363742613b7ae2ab00ed Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 12:16:49 +0100 Subject: [PATCH 5/7] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a8091121ad..4f6504f3ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,12 +19,18 @@ node { RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT RUN_BUILD = PROTECTED_BRANCH && FROM_GIT + // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables + echo "Node: ${env.NODE_NAME}" + echo "Workspace: ${env.WORKSPACE}" + echo "Debug: ${env.DEBUG}" + configFileProvider([ configFile(fileId: 'salix.properties', variable: 'PROPS_FILE') ]) { def props = readProperties file: PROPS_FILE - env.DEBUG = props.DEBUG + props.each {key, value -> env.put(key, value) } + props.each {key, value -> echo "${key}: ${value}" } } if (PROTECTED_BRANCH) { @@ -33,15 +39,10 @@ node { variable: 'BRANCH_PROPS_FILE') ]) { def props = readProperties file: BRANCH_PROPS_FILE - env.BACK_REPLICAS = props.BACK_REPLICAS - env.NODE_ENV = props.NODE_ENV + props.each {key, value -> env.put(key, value) } + props.each {key, value -> echo "${key}: ${value}" } } } - - // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables - echo "Node: ${env.NODE_NAME}" - echo "Workspace: ${env.WORKSPACE}" - echo "Debug: ${env.DEBUG}" } } pipeline { From 9c2ec2b8dd33564346760032b2669bcc92952083 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 12:17:45 +0100 Subject: [PATCH 6/7] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4f6504f3ae..80db9b344b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ node { variable: 'PROPS_FILE') ]) { def props = readProperties file: PROPS_FILE - props.each {key, value -> env.put(key, value) } + props.each {key, value -> env."${key}" = value } props.each {key, value -> echo "${key}: ${value}" } } @@ -39,7 +39,7 @@ node { variable: 'BRANCH_PROPS_FILE') ]) { def props = readProperties file: BRANCH_PROPS_FILE - props.each {key, value -> env.put(key, value) } + props.each {key, value -> env."${key}" = value } props.each {key, value -> echo "${key}: ${value}" } } } From f909c648a7e644895c0d9b98ba0b6c845419f6a6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 12:21:06 +0100 Subject: [PATCH 7/7] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 80db9b344b..56e33f4aeb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,9 +20,8 @@ node { RUN_BUILD = PROTECTED_BRANCH && FROM_GIT // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables - echo "Node: ${env.NODE_NAME}" - echo "Workspace: ${env.WORKSPACE}" - echo "Debug: ${env.DEBUG}" + echo "NODE_NAME: ${env.NODE_NAME}" + echo "WORKSPACE: ${env.WORKSPACE}" configFileProvider([ configFile(fileId: 'salix.properties',