From f6607f65339c0ed0c4b53bc3da4ca6f4f138acd8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 22:37:43 +0100 Subject: [PATCH 01/15] build: refs #6706 hook test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b9e169b2..8f1ada293 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,13 +9,13 @@ pipeline { options { disableConcurrentBuilds() } - tools { - nodejs 'node-v20' - } environment { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } + tools { + nodejs 'node-v20' + } stages { stage('Checkout') { steps { -- 2.40.1 From 825ee767971db03ac8a1d5c601a7bf9459071e87 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 23:08:00 +0100 Subject: [PATCH 02/15] build: refs #6706 hook test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f1ada293..2b9e169b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,13 +9,13 @@ pipeline { options { disableConcurrentBuilds() } + tools { + nodejs 'node-v20' + } environment { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } - tools { - nodejs 'node-v20' - } stages { stage('Checkout') { steps { -- 2.40.1 From 222292648885b850689f8810720ab7195f4759f7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 23:13:40 +0100 Subject: [PATCH 03/15] build: refs #6706 hook test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b9e169b2..8f1ada293 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,13 +9,13 @@ pipeline { options { disableConcurrentBuilds() } - tools { - nodejs 'node-v20' - } environment { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } + tools { + nodejs 'node-v20' + } stages { stage('Checkout') { steps { -- 2.40.1 From bd1ac5f41e30ac718961711b24a780ed1f94f836 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 23:25:42 +0100 Subject: [PATCH 04/15] build: refs #6706 hook test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f1ada293..2b9e169b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,13 +9,13 @@ pipeline { options { disableConcurrentBuilds() } + tools { + nodejs 'node-v20' + } environment { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } - tools { - nodejs 'node-v20' - } stages { stage('Checkout') { steps { -- 2.40.1 From b091e2467c4a2873ef191219edbddda4b0bb2f49 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 09:36:22 +0100 Subject: [PATCH 05/15] build: refs #6706 hook test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b9e169b2..8f1ada293 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,13 +9,13 @@ pipeline { options { disableConcurrentBuilds() } - tools { - nodejs 'node-v20' - } environment { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } + tools { + nodejs 'node-v20' + } stages { stage('Checkout') { steps { -- 2.40.1 From 603d8e3d9218470d0eea899280f8afca28694e92 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 14:07:42 +0100 Subject: [PATCH 06/15] build: refs #6706 hook test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3123de092..e6235f0eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,13 +9,13 @@ pipeline { options { disableConcurrentBuilds() } + tools { + nodejs 'node-v20' + } environment { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } - tools { - nodejs 'node-v20' - } stages { stage('Checkout') { steps { -- 2.40.1 From aba88c812e7b4c70e7c41396ebe9a17ad445584b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 21:35:28 +0100 Subject: [PATCH 07/15] build: refs #6706 Jenkinsfile globals --- Jenkinsfile | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e6235f0eb..74fd68f09 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,28 @@ #!/usr/bin/env groovy -def PROTECTED_BRANCH -def FROM_GIT -def RUN_TESTS +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 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 { agent any @@ -21,22 +41,8 @@ pipeline { steps { script { // Uncomment to enable debugging - //env.DEBUG = 'strong-remoting:http-context,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 - } + // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference + //env.DEBUG = 'strong-remoting:shared-method' def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version @@ -45,15 +51,6 @@ pipeline { script: 'git log -1 --pretty=%B ${GIT_COMMIT}', returnStdout: true ).trim() - - PROTECTED_BRANCH = [ - 'dev', - 'test', - 'master' - ].contains(env.BRANCH_NAME) - - FROM_GIT = JOB_NAME.startsWith('gitea/') - RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT } setEnv() } -- 2.40.1 From 056ddbd9aeae536e234abc747d93057f3c58a185 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 21:49:42 +0100 Subject: [PATCH 08/15] build: refs #6706 Jenkinsfile test --- Jenkinsfile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 74fd68f09..7e10b96a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,6 @@ #!/usr/bin/env groovy 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 @@ -13,6 +9,9 @@ switch (env.BRANCH_NAME) { env.NODE_ENV = 'production' env.BACK_REPLICAS = 4 break + default: + env.NODE_ENV = 'dev' + env.BACK_REPLICAS = 1 } def PROTECTED_BRANCH = [ @@ -67,7 +66,7 @@ pipeline { } stage('Frontend') { when { - expression { return FROM_GIT } + expression { FROM_GIT } } steps { sh 'npm install --no-audit --prefer-offline --prefix=front' @@ -75,7 +74,7 @@ pipeline { } stage('Print') { when { - expression { return FROM_GIT } + expression { FROM_GIT } } steps { sh 'npm install --no-audit --prefer-offline --prefix=print' @@ -85,7 +84,7 @@ pipeline { } stage('Test') { when { - expression { return RUN_TESTS } + expression { RUN_TESTS } } environment { NODE_ENV = "" @@ -106,7 +105,7 @@ pipeline { } stage('Build') { when { - expression { return PROTECTED_BRANCH && FROM_GIT } + expression { PROTECTED_BRANCH && FROM_GIT } } environment { CREDENTIALS = credentials('docker-registry') @@ -116,9 +115,14 @@ pipeline { dockerBuild() } } + stage('Output') { + steps { + echo "${env.NODE_ENV}" + } + } stage('Deploy') { when { - expression { return PROTECTED_BRANCH } + expression { PROTECTED_BRANCH } } parallel { stage('Database') { @@ -136,7 +140,7 @@ pipeline { } stage('Docker') { when { - expression { return FROM_GIT } + expression { FROM_GIT } } environment { DOCKER_HOST = "${env.SWARM_HOST}" -- 2.40.1 From 2180045848436528968082660570ebc5a457aac4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 22:04:49 +0100 Subject: [PATCH 09/15] build: refs #6706 Jenkinsfile test --- Jenkinsfile | 77 ++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7e10b96a9..c9444537c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,28 +1,45 @@ #!/usr/bin/env groovy -switch (env.BRANCH_NAME) { - case 'test': - env.NODE_ENV = 'test' - env.BACK_REPLICAS = 2 - break - case 'master': - env.NODE_ENV = 'production' - env.BACK_REPLICAS = 4 - break - default: - env.NODE_ENV = 'dev' - env.BACK_REPLICAS = 1 +{ + switch (env.BRANCH_NAME) { + case 'test': + env.NODE_ENV = 'test' + env.BACK_REPLICAS = 2 + break + case 'master': + env.NODE_ENV = 'production' + env.BACK_REPLICAS = 4 + break + default: + env.NODE_ENV = 'dev' + env.BACK_REPLICAS = 1 + } + + 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 + + + // Uncomment to enable debugging + // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference + //env.DEBUG = 'strong-remoting:shared-method' + + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + + env.GIT_COMMIT_MSG = sh( + script: 'git log -1 --pretty=%B ${GIT_COMMIT}', + returnStdout: true + ).trim() + + setEnv() } -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 { agent any options { @@ -36,24 +53,6 @@ pipeline { STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { - stage('Checkout') { - steps { - script { - // Uncomment to enable debugging - // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference - //env.DEBUG = 'strong-remoting:shared-method' - - def packageJson = readJSON file: 'package.json' - env.VERSION = packageJson.version - - env.GIT_COMMIT_MSG = sh( - script: 'git log -1 --pretty=%B ${GIT_COMMIT}', - returnStdout: true - ).trim() - } - setEnv() - } - } stage('Install') { environment { NODE_ENV = "" -- 2.40.1 From 76785b99b16bc686a83d2cc0476c48280213cf2c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 22:06:30 +0100 Subject: [PATCH 10/15] build: refs #6706 Jenkinsfile test --- Jenkinsfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c9444537c..d2fb6cbaa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,10 @@ #!/usr/bin/env groovy -{ +def PROTECTED_BRANCH +def FROM_GIT +def RUN_TESTS + +before: { switch (env.BRANCH_NAME) { case 'test': env.NODE_ENV = 'test' @@ -15,15 +19,14 @@ env.BACK_REPLICAS = 1 } - def PROTECTED_BRANCH = [ + PROTECTED_BRANCH = [ 'dev', 'test', 'master' ].contains(env.BRANCH_NAME) - def FROM_GIT = env.JOB_NAME.startsWith('gitea/') - def RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT - + FROM_GIT = env.JOB_NAME.startsWith('gitea/') + RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT // Uncomment to enable debugging // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference -- 2.40.1 From 3356691124a1878199bae163626d75b340932f04 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 22:12:01 +0100 Subject: [PATCH 11/15] build: refs #6706 Jenkinsfile test --- Jenkinsfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d2fb6cbaa..2aba146de 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,8 +32,6 @@ before: { // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference //env.DEBUG = 'strong-remoting:shared-method' - def packageJson = readJSON file: 'package.json' - env.VERSION = packageJson.version env.GIT_COMMIT_MSG = sh( script: 'git log -1 --pretty=%B ${GIT_COMMIT}', @@ -56,6 +54,14 @@ pipeline { STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { + stage('Checkout') { + steps { + script { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + } + } + } stage('Install') { environment { NODE_ENV = "" -- 2.40.1 From 6a27b752e22693c2a496841ec77c1b83d6808449 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 22:13:36 +0100 Subject: [PATCH 12/15] build: refs #6706 Jenkinsfile test --- Jenkinsfile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2aba146de..af616498b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ def PROTECTED_BRANCH def FROM_GIT def RUN_TESTS -before: { +pre: { switch (env.BRANCH_NAME) { case 'test': env.NODE_ENV = 'test' @@ -31,14 +31,17 @@ before: { // Uncomment to enable debugging // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference //env.DEBUG = 'strong-remoting:shared-method' +} +pipeline { + stage('Setup') { + env.GIT_COMMIT_MSG = sh( + script: 'git log -1 --pretty=%B ${GIT_COMMIT}', + returnStdout: true + ).trim() - env.GIT_COMMIT_MSG = sh( - script: 'git log -1 --pretty=%B ${GIT_COMMIT}', - returnStdout: true - ).trim() - - setEnv() + setEnv() + } } pipeline { -- 2.40.1 From eb32b6daa2c1d4b3b587d64daeebbd3d6d636f4f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 22:19:00 +0100 Subject: [PATCH 13/15] build: refs #6706 Jenkinsfile fixes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index af616498b..1a0505246 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pre: { //env.DEBUG = 'strong-remoting:shared-method' } -pipeline { +node { stage('Setup') { env.GIT_COMMIT_MSG = sh( script: 'git log -1 --pretty=%B ${GIT_COMMIT}', -- 2.40.1 From d7b15d32215d5d3dd5f8ffa1e00b002c07498a68 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 22:23:58 +0100 Subject: [PATCH 14/15] build: refs #6706 Jenkinsfile fixes --- Jenkinsfile | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1a0505246..252b1a1f3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,9 +32,11 @@ pre: { // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference //env.DEBUG = 'strong-remoting:shared-method' } - node { stage('Setup') { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + env.GIT_COMMIT_MSG = sh( script: 'git log -1 --pretty=%B ${GIT_COMMIT}', returnStdout: true @@ -43,7 +45,6 @@ node { setEnv() } } - pipeline { agent any options { @@ -57,14 +58,6 @@ pipeline { STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { - stage('Checkout') { - steps { - script { - def packageJson = readJSON file: 'package.json' - env.VERSION = packageJson.version - } - } - } stage('Install') { environment { NODE_ENV = "" @@ -128,7 +121,7 @@ pipeline { } stage('Output') { steps { - echo "${env.NODE_ENV}" + echo "${env.VERSION}" } } stage('Deploy') { -- 2.40.1 From c35bbc3c9daea37b0569527cd9915c893608b4e0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 1 Feb 2024 23:19:06 +0100 Subject: [PATCH 15/15] build: refs #6706 Jenkinsfile fixes --- Jenkinsfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 252b1a1f3..4914f8f1c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -119,11 +119,6 @@ pipeline { dockerBuild() } } - stage('Output') { - steps { - echo "${env.VERSION}" - } - } stage('Deploy') { when { expression { PROTECTED_BRANCH } -- 2.40.1