From a3442d488739b204d70df27277bb086c17e7f1dc Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 29 Jan 2024 15:47:46 +0100 Subject: [PATCH 01/29] fix: refs #6276 fixtures --- db/dump/fixtures.before.sql | 7 ++++--- e2e/paths/05-ticket/02_expeditions_and_log.spec.js | 2 +- e2e/paths/13-supplier/02_basic_data.spec.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 6a58b60f5..0f608d19d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -6,9 +6,10 @@ */ SET foreign_key_checks = 0; --- CREATE ROLE 'salix'; --- GRANT 'salix' TO 'root'@'%'; --- SET DEFAULT ROLE 'salix' FOR 'root'@'%'; +DROP ROLE 'salix'; +CREATE ROLE 'salix'; +GRANT 'salix' TO 'root'@'%'; +SET DEFAULT ROLE 'salix' FOR 'root'@'%'; CREATE SCHEMA IF NOT EXISTS `vn2008`; CREATE SCHEMA IF NOT EXISTS `tmp`; diff --git a/e2e/paths/05-ticket/02_expeditions_and_log.spec.js b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js index b97576940..4e8005043 100644 --- a/e2e/paths/05-ticket/02_expeditions_and_log.spec.js +++ b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js @@ -27,6 +27,6 @@ describe('Ticket expeditions and log path', () => { const result = await page .countElement(selectors.ticketExpedition.expeditionRow); - expect(result).toEqual(4); + expect(result).toEqual(6); }); }); diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js index 72ea6d890..582e2fb62 100644 --- a/e2e/paths/13-supplier/02_basic_data.spec.js +++ b/e2e/paths/13-supplier/02_basic_data.spec.js @@ -44,7 +44,7 @@ describe('Supplier basic data path', () => { it('should check the isSerious checkbox is now unchecked', async() => { const result = await page.checkboxState(selectors.supplierBasicData.isSerious); - expect(result).toBe('unchecked'); + expect(result).toBe('checked'); }); it('should check the isActive checkbox is now unchecked', async() => { From 8ea1600f4ac561e4e6e93ca1aacd0d954bd7427d Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 30 Jan 2024 08:11:21 +0100 Subject: [PATCH 02/29] fix: refs #6276 test title --- e2e/paths/13-supplier/02_basic_data.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js index 582e2fb62..79a9898ca 100644 --- a/e2e/paths/13-supplier/02_basic_data.spec.js +++ b/e2e/paths/13-supplier/02_basic_data.spec.js @@ -41,7 +41,7 @@ describe('Supplier basic data path', () => { expect(result).toEqual('Plants Nick SL'); }); - it('should check the isSerious checkbox is now unchecked', async() => { + it('should check the isSerious checkbox is now checked', async() => { const result = await page.checkboxState(selectors.supplierBasicData.isSerious); expect(result).toBe('checked'); From c80c8a567887a114c28ea2cb7e303fb80c68eb18 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 30 Jan 2024 10:00:35 +0100 Subject: [PATCH 03/29] fix: refs #5483 No apply changes of db in dev --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index c8a0579d7..c65b01d47 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -101,6 +101,7 @@ pipeline { } stage('Database') { when { anyOf { + branch 'dev' branch 'test' branch 'master' }} From c1726f93904ad909fb1b9c8c89eae228c58db492 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 10:23:32 +0100 Subject: [PATCH 04/29] fix: refs #5483 Remove DB container when back tests end --- back/tests.js | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/back/tests.js b/back/tests.js index a9cdeb338..c4c477090 100644 --- a/back/tests.js +++ b/back/tests.js @@ -1,9 +1,10 @@ +/* eslint-disable no-console */ const path = require('path'); const Myt = require('@verdnatura/myt/myt'); const Run = require('@verdnatura/myt/myt-run'); let dataSources = require('../loopback/server/datasources.json'); -let myt; +let server; process.on('warning', warning => { console.log(warning.name); @@ -11,26 +12,33 @@ process.on('warning', warning => { console.log(warning.stack); }); -process.on('SIGUSR2', async() => { - if (myt) await myt.deinit(); -}); +process.on('SIGUSR2', rmServer); +process.on('exit', rmServer); -process.on('exit', async function() { - if (myt) await myt.deinit(); -}); +async function rmServer() { + if (!server) return; + await server.rm(); + server = null; +} async function test() { + console.log('Building and running DB container.'); + const isCI = process.argv[2] === 'ci'; - myt = new Myt(); + const myt = new Myt(); await myt.init({ workspace: path.join(__dirname, '..'), random: true, ci: isCI, - tmpfs: true, + tmpfs: process.platform == 'linux', network: isCI ? 'jenkins' : null }); - const {dbConfig} = await myt.run(Run); + server = await myt.run(Run); + await myt.deinit(); + const {dbConfig} = server; + + console.log('Initializing backend.'); dataSources = JSON.parse(JSON.stringify(dataSources)); Object.assign(dataSources.vn, { @@ -47,6 +55,8 @@ async function test() { // FIXME: Workaround to wait for loopback to be ready await app.models.Application.status(); + console.log('Running tests.'); + const Jasmine = require('jasmine'); const jasmine = new Jasmine(); @@ -82,9 +92,13 @@ async function test() { }); await jasmine.execute(); + + console.log('Stopping.'); + if (app) await app.disconnect(); - if (myt) await myt.deinit(); - console.log('App disconnected & container removed'); + await rmServer(); + + console.log('Tests ended.\n'); } test(); From 56ac47dc16aaadd8cc44d3ef56f2d1da534243d4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 18:52:31 +0100 Subject: [PATCH 05/29] build: refs #5483 send rocket message, skip steps when run source isn't git --- Jenkinsfile | 57 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c65b01d47..51ae7de43 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { } environment { PROJECT_NAME = 'salix' - STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" + STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { stage('Checkout') { @@ -22,6 +22,9 @@ pipeline { env.BACK_REPLICAS = 2 break } + + if (env.JOB_NAME.startsWith('gitea/') + env.RUN_SOURCE = 'git' } configFileProvider([ @@ -46,10 +49,13 @@ pipeline { } } stage('Test') { - when { not { anyOf { - branch 'test' - branch 'master' - }}} + when { + environment name: 'RUN_SOURCE', value: 'git' + not { anyOf { + branch 'test' + branch 'master' + }} + } environment { NODE_ENV = "" TZ = 'Europe/Madrid' @@ -72,10 +78,13 @@ pipeline { } } stage('Build') { - when { anyOf { - branch 'test' - branch 'master' - }} + when { + environment name: 'RUN_SOURCE', value: 'git' + anyOf { + branch 'test' + branch 'master' + } + } environment { CREDENTIALS = credentials('docker-registry') } @@ -88,10 +97,13 @@ pipeline { } } stage('Deploy') { - when { anyOf { - branch 'test' - branch 'master' - }} + when { + environment name: 'RUN_SOURCE', value: 'git' + anyOf { + branch 'test' + branch 'master' + } + } environment { DOCKER_HOST = "${env.SWARM_HOST}" } @@ -120,6 +132,25 @@ pipeline { } } post { + success { + script { + if (env.RUN_SOURCE == 'git' + && ['master', 'test'].contains(env.BRANCH_NAME)) { + String message = env.GIT_COMMIT_MSG + int index = message.indexOf('\n') + if (index != -1) + message = message.substring(0, index) + + rocketSend( + channel: 'vn-database', + message: "*DB version uploaded:* ${message}" + +"\n$COMMITTER_EMAIL ($BRANCH_NAME)" + +"\n$GIT_URL/commit/$GIT_COMMIT", + rawMessage: true + ) + } + } + } always { script { if (!['master', 'test'].contains(env.BRANCH_NAME)) { From 79f509ca46bdf65dc90598e45d2f6d785c1f1575 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 18:54:41 +0100 Subject: [PATCH 06/29] fix: refs #5483 Jenkinsfile code fix --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 51ae7de43..88e677121 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,7 +23,7 @@ pipeline { break } - if (env.JOB_NAME.startsWith('gitea/') + if (env.JOB_NAME.startsWith('gitea/')) env.RUN_SOURCE = 'git' } From 12af7579298090f17b9d8ae46a987f1d7319fcf3 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:01:14 +0100 Subject: [PATCH 07/29] refs #5483 Jenkinsfile fix --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 88e677121..181e0b02e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -119,7 +119,7 @@ pipeline { }} steps { configFileProvider([ - configFile(fileId: "config.${NODE_ENV}.ini", + configFile(fileId: "config.${env.NODE_ENV}.ini", variable: 'MYSQL_CONFIG') ]) { sh 'mkdir -p db/remotes' From 624f61465ae0500ec5f05c538872e527bc1c695e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:05:55 +0100 Subject: [PATCH 08/29] fix: refs #5483 Jenkinsfile fixes --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 181e0b02e..5552ccdc6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,6 +21,9 @@ pipeline { env.NODE_ENV = 'test' env.BACK_REPLICAS = 2 break + case 'dev': + env.NODE_ENV = 'dev' + break } if (env.JOB_NAME.startsWith('gitea/')) From 17c9054155386f75d829422c9249562b95bff800 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:30:26 +0100 Subject: [PATCH 09/29] fix: refs #5483 Jenkinsfile fixes --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5552ccdc6..713a63c52 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -156,7 +156,8 @@ pipeline { } always { script { - if (!['master', 'test'].contains(env.BRANCH_NAME)) { + if (env.RUN_SOURCE == 'git' + && !['master', 'test'].contains(env.BRANCH_NAME)) { try { junit 'junitresults.xml' junit 'junit.xml' From 095d6b4140a22c5ac4447182e10fc5b374107a50 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:35:23 +0100 Subject: [PATCH 10/29] fix: refs #5483 Unused code removed --- Jenkinsfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 713a63c52..37f1abc9e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,14 +29,6 @@ pipeline { if (env.JOB_NAME.startsWith('gitea/')) env.RUN_SOURCE = 'git' } - - configFileProvider([ - configFile(fileId: "salix.groovy", - variable: 'GROOVY_FILE') - ]) { - load env.GROOVY_FILE - } - setEnv() } } From 84961dda4952041fd791875820bf0088eb5fe301 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:41:09 +0100 Subject: [PATCH 11/29] build: refs #5483 test workers increased to 6, test rocket notification --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 37f1abc9e..20b64de0d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,7 +59,7 @@ pipeline { stage('Frontend') { steps { nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=4' + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6' } } } @@ -130,7 +130,7 @@ pipeline { success { script { if (env.RUN_SOURCE == 'git' - && ['master', 'test'].contains(env.BRANCH_NAME)) { + && ['master', 'test', 'dev'].contains(env.BRANCH_NAME)) { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) From 3e0ebc0f26388544ed6fd821f5c1c83cbe096ca7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:45:37 +0100 Subject: [PATCH 12/29] fix: refs #5483 Jenkinsfile rocketchat fixes --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 20b64de0d..11fcbb752 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,6 +26,11 @@ pipeline { break } + env.GIT_COMMIT_MSG = sh( + script: 'git log -1 --pretty=%B ${GIT_COMMIT}', + returnStdout: true + ).trim() + if (env.JOB_NAME.startsWith('gitea/')) env.RUN_SOURCE = 'git' } From 1a64126655dcff9cdd1185b089fe59cac7f3356f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 19:51:30 +0100 Subject: [PATCH 13/29] build: refs #5483 Jenkinsfile parallel deploy --- Jenkinsfile | 64 ++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11fcbb752..8767a1150 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -97,36 +97,40 @@ pipeline { } } stage('Deploy') { - when { - environment name: 'RUN_SOURCE', value: 'git' - anyOf { - branch 'test' - branch 'master' + parallel { + stage('Docker') { + when { + environment name: 'RUN_SOURCE', value: 'git' + anyOf { + branch 'test' + branch 'master' + } + } + environment { + DOCKER_HOST = "${env.SWARM_HOST}" + } + steps { + sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" + } } - } - environment { - DOCKER_HOST = "${env.SWARM_HOST}" - } - steps { - sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" - } - } - stage('Database') { - when { anyOf { - branch 'dev' - branch 'test' - branch 'master' - }} - steps { - configFileProvider([ - configFile(fileId: "config.${env.NODE_ENV}.ini", - variable: 'MYSQL_CONFIG') - ]) { - sh 'mkdir -p db/remotes' - sh 'cp "$MYSQL_CONFIG" db/remotes/$NODE_ENV.ini' - } - nodejs('node-v20') { - sh 'npx myt push $NODE_ENV --force --commit' + stage('Database') { + when { anyOf { + branch 'dev' + branch 'test' + branch 'master' + }} + steps { + configFileProvider([ + configFile(fileId: "config.${env.NODE_ENV}.ini", + variable: 'MYSQL_CONFIG') + ]) { + sh 'mkdir -p db/remotes' + sh 'cp "$MYSQL_CONFIG" db/remotes/$NODE_ENV.ini' + } + nodejs('node-v20') { + sh 'npx myt push $NODE_ENV --force --commit' + } + } } } } @@ -135,7 +139,7 @@ pipeline { success { script { if (env.RUN_SOURCE == 'git' - && ['master', 'test', 'dev'].contains(env.BRANCH_NAME)) { + && ['master', 'test'].contains(env.BRANCH_NAME)) { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) From 7d2b5fbedaad169197ae132f4151ce736eaf50b7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 20:04:32 +0100 Subject: [PATCH 14/29] build: refs #5483 Parallel install, code reorder --- Jenkinsfile | 69 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8767a1150..3ffa98394 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,10 +41,27 @@ pipeline { environment { NODE_ENV = "" } - steps { - nodejs('node-v20') { - sh 'npm install --no-audit --prefer-offline' - sh 'gulp install --ci' + parallel { + stage('Backend') { + steps { + nodejs('node-v20') { + sh 'npm install --no-audit --prefer-offline' + } + } + } + stage('Frontend') { + steps { + nodejs('node-v20') { + sh 'npm install --no-audit --prefer-offline --prefix=front' + } + } + } + stage('Print') { + steps { + nodejs('node-v20') { + sh 'npm install --no-audit --prefer-offline --prefix=print' + } + } } } } @@ -61,13 +78,6 @@ pipeline { TZ = 'Europe/Madrid' } parallel { - stage('Frontend') { - steps { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6' - } - } - } stage('Backend') { steps { nodejs('node-v20') { @@ -75,6 +85,13 @@ pipeline { } } } + stage('Frontend') { + steps { + nodejs('node-v20') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6' + } + } + } } } stage('Build') { @@ -98,21 +115,6 @@ pipeline { } stage('Deploy') { parallel { - stage('Docker') { - when { - environment name: 'RUN_SOURCE', value: 'git' - anyOf { - branch 'test' - branch 'master' - } - } - environment { - DOCKER_HOST = "${env.SWARM_HOST}" - } - steps { - sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" - } - } stage('Database') { when { anyOf { branch 'dev' @@ -132,6 +134,21 @@ pipeline { } } } + stage('Docker') { + when { + environment name: 'RUN_SOURCE', value: 'git' + anyOf { + branch 'test' + branch 'master' + } + } + environment { + DOCKER_HOST = "${env.SWARM_HOST}" + } + steps { + sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" + } + } } } } From 027f7d2c1dc8e44711ee802a7e5ed1b1e3780613 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 20:41:24 +0100 Subject: [PATCH 15/29] build: refs #5483 dev deploy, tag image with version --- Jenkinsfile | 46 ++++++++++++++++++++++++++++++---------------- docker-compose.yml | 8 ++++++-- package.json | 2 +- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ffa98394..a73047b31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,24 +8,41 @@ pipeline { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } + parameters { + booleanParam( + name: 'PROTECTED_BRANCH', + defaultValue: false, + description: 'Whether branch is a protected branch' + ) + } stages { stage('Checkout') { steps { script { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + switch (env.BRANCH_NAME) { - case 'master': - env.NODE_ENV = 'production' - env.BACK_REPLICAS = 4 + case 'dev': + env.NODE_ENV = 'dev' + env.BACK_REPLICAS = 1 break case 'test': env.NODE_ENV = 'test' env.BACK_REPLICAS = 2 break - case 'dev': - env.NODE_ENV = 'dev' + case 'master': + env.NODE_ENV = 'production' + env.BACK_REPLICAS = 4 break } + params.PROTECTED_BRANCH = [ + 'dev', + 'test', + 'master' + ].contains(env.BRANCH_NAME) + env.GIT_COMMIT_MSG = sh( script: 'git log -1 --pretty=%B ${GIT_COMMIT}', returnStdout: true @@ -69,6 +86,7 @@ pipeline { when { environment name: 'RUN_SOURCE', value: 'git' not { anyOf { + branch 'dev' branch 'test' branch 'master' }} @@ -98,6 +116,7 @@ pipeline { when { environment name: 'RUN_SOURCE', value: 'git' anyOf { + branch 'dev' branch 'test' branch 'master' } @@ -114,13 +133,13 @@ pipeline { } } stage('Deploy') { + when { anyOf { + branch 'dev' + branch 'test' + branch 'master' + }} parallel { stage('Database') { - when { anyOf { - branch 'dev' - branch 'test' - branch 'master' - }} steps { configFileProvider([ configFile(fileId: "config.${env.NODE_ENV}.ini", @@ -137,10 +156,6 @@ pipeline { stage('Docker') { when { environment name: 'RUN_SOURCE', value: 'git' - anyOf { - branch 'test' - branch 'master' - } } environment { DOCKER_HOST = "${env.SWARM_HOST}" @@ -155,8 +170,7 @@ pipeline { post { success { script { - if (env.RUN_SOURCE == 'git' - && ['master', 'test'].contains(env.BRANCH_NAME)) { + if (env.RUN_SOURCE == 'git' && env.BRANCH_NAME == 'master') { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) diff --git a/docker-compose.yml b/docker-compose.yml index 0d2db1a63..32bcb1777 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,9 @@ version: '3.7' services: front: - image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?} + image: registry.verdnatura.es/salix-front:${VERSION:?} + tags: + - ${BRANCH_NAME:?} build: context: . dockerfile: front/Dockerfile @@ -16,7 +18,9 @@ services: limits: memory: 1G back: - image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?} + image: registry.verdnatura.es/salix-back:${VERSION:?} + tags: + - ${BRANCH_NAME:?} build: . ports: - 3000 diff --git a/package.json b/package.json index 3f3a3ad8e..041bd39df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.06.01", + "version": "24.6.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 29634e16e5bed2651c9a4e741ef0a06cca79fa53 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 20:44:33 +0100 Subject: [PATCH 16/29] fix: refs #5483 Jenkinsfile fix --- Jenkinsfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a73047b31..f4d429765 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,13 +8,6 @@ pipeline { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } - parameters { - booleanParam( - name: 'PROTECTED_BRANCH', - defaultValue: false, - description: 'Whether branch is a protected branch' - ) - } stages { stage('Checkout') { steps { @@ -37,7 +30,7 @@ pipeline { break } - params.PROTECTED_BRANCH = [ + env.PROTECTED_BRANCH = [ 'dev', 'test', 'master' From 76545cd1accfc8caca5ccd40bcf599f51d7c9c64 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 20:58:15 +0100 Subject: [PATCH 17/29] fix: refs #5483 Jenkinsfile & compose fixes --- Jenkinsfile | 56 +++++++++++++++------------------------------- docker-compose.yml | 4 ++-- 2 files changed, 20 insertions(+), 40 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f4d429765..1f99f2115 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,9 +12,6 @@ pipeline { stage('Checkout') { steps { script { - def packageJson = readJSON file: 'package.json' - env.VERSION = packageJson.version - switch (env.BRANCH_NAME) { case 'dev': env.NODE_ENV = 'dev' @@ -30,6 +27,11 @@ pipeline { break } + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + + env.FROM_GIT = env.JOB_NAME.startsWith('gitea/') + env.PROTECTED_BRANCH = [ 'dev', 'test', @@ -40,9 +42,6 @@ pipeline { script: 'git log -1 --pretty=%B ${GIT_COMMIT}', returnStdout: true ).trim() - - if (env.JOB_NAME.startsWith('gitea/')) - env.RUN_SOURCE = 'git' } setEnv() } @@ -77,12 +76,8 @@ pipeline { } stage('Test') { when { - environment name: 'RUN_SOURCE', value: 'git' - not { anyOf { - branch 'dev' - branch 'test' - branch 'master' - }} + expression { return env.FROM_GIT } + expression { return !env.PROTECTED_BRANCH } } environment { NODE_ENV = "" @@ -107,12 +102,8 @@ pipeline { } stage('Build') { when { - environment name: 'RUN_SOURCE', value: 'git' - anyOf { - branch 'dev' - branch 'test' - branch 'master' - } + expression { return env.FROM_GIT } + expression { return env.PROTECTED_BRANCH } } environment { CREDENTIALS = credentials('docker-registry') @@ -126,11 +117,9 @@ pipeline { } } stage('Deploy') { - when { anyOf { - branch 'dev' - branch 'test' - branch 'master' - }} + when { + expression { return env.PROTECTED_BRANCH } + } parallel { stage('Database') { steps { @@ -148,7 +137,7 @@ pipeline { } stage('Docker') { when { - environment name: 'RUN_SOURCE', value: 'git' + expression { return env.FROM_GIT } } environment { DOCKER_HOST = "${env.SWARM_HOST}" @@ -163,7 +152,7 @@ pipeline { post { success { script { - if (env.RUN_SOURCE == 'git' && env.BRANCH_NAME == 'master') { + if (env.FROM_GIT && env.BRANCH_NAME == 'master') { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) @@ -179,10 +168,12 @@ pipeline { } } } + unsuccessful { + sendEmail() + } always { script { - if (env.RUN_SOURCE == 'git' - && !['master', 'test'].contains(env.BRANCH_NAME)) { + if (env.FROM_GIT && !env.PROTECTED_BRANCH) { try { junit 'junitresults.xml' junit 'junit.xml' @@ -190,17 +181,6 @@ pipeline { echo e.toString() } } - - if (!env.COMMITTER_EMAIL || currentBuild.currentResult == 'SUCCESS') return; - try { - mail( - to: env.COMMITTER_EMAIL, - subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}", - body: "Check status at ${env.BUILD_URL}" - ) - } catch (e) { - echo e.toString() - } } } } diff --git a/docker-compose.yml b/docker-compose.yml index 32bcb1777..6bcf30e2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: front: image: registry.verdnatura.es/salix-front:${VERSION:?} tags: - - ${BRANCH_NAME:?} + - "${BRANCH_NAME:?}" build: context: . dockerfile: front/Dockerfile @@ -20,7 +20,7 @@ services: back: image: registry.verdnatura.es/salix-back:${VERSION:?} tags: - - ${BRANCH_NAME:?} + - "${BRANCH_NAME:?}" build: . ports: - 3000 From 4251f29a1773394b3ecbb348deb9b7df68ce4df6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 21:05:59 +0100 Subject: [PATCH 18/29] fix: refs #5483 compose fixes --- docker-compose.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6bcf30e2d..222e753d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,6 @@ version: '3.7' services: front: image: registry.verdnatura.es/salix-front:${VERSION:?} - tags: - - "${BRANCH_NAME:?}" build: context: . dockerfile: front/Dockerfile @@ -19,8 +17,6 @@ services: memory: 1G back: image: registry.verdnatura.es/salix-back:${VERSION:?} - tags: - - "${BRANCH_NAME:?}" build: . ports: - 3000 From 4d065a2f797ee249412ffbc80f2ec7f2e8f4ccd4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 21:37:20 +0100 Subject: [PATCH 19/29] fix: refs #5483 Jenkinsfile fixes, global nodejs tool --- Jenkinsfile | 70 ++++++++++++++++++++++------------------------------- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1f99f2115..4688e5283 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,9 @@ pipeline { PROJECT_NAME = 'salix' STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } + tools { + nodejs 'node-v20' + } stages { stage('Checkout') { steps { @@ -30,8 +33,6 @@ pipeline { def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version - env.FROM_GIT = env.JOB_NAME.startsWith('gitea/') - env.PROTECTED_BRANCH = [ 'dev', 'test', @@ -42,6 +43,9 @@ pipeline { script: 'git log -1 --pretty=%B ${GIT_COMMIT}', returnStdout: true ).trim() + + env.FROM_GIT = env.JOB_NAME.startsWith('gitea/') + env.RUN_TESTS = !env.PROTECTED_BRANCH && env.FROM_GIT } setEnv() } @@ -53,31 +57,24 @@ pipeline { parallel { stage('Backend') { steps { - nodejs('node-v20') { - sh 'npm install --no-audit --prefer-offline' - } + sh 'npm install --no-audit --prefer-offline' } } stage('Frontend') { steps { - nodejs('node-v20') { - sh 'npm install --no-audit --prefer-offline --prefix=front' - } + sh 'npm install --no-audit --prefer-offline --prefix=front' } } stage('Print') { steps { - nodejs('node-v20') { - sh 'npm install --no-audit --prefer-offline --prefix=print' - } + sh 'npm install --no-audit --prefer-offline --prefix=print' } } } } stage('Test') { when { - expression { return env.FROM_GIT } - expression { return !env.PROTECTED_BRANCH } + expression { return env.RUN_TESTS } } environment { NODE_ENV = "" @@ -86,33 +83,25 @@ pipeline { parallel { stage('Backend') { steps { - nodejs('node-v20') { - sh 'npm run test:back:ci' - } + sh 'npm run test:back:ci' } } stage('Frontend') { steps { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6' - } + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6' } } } } stage('Build') { when { - expression { return env.FROM_GIT } - expression { return env.PROTECTED_BRANCH } + expression { return env.PROTECTED_BRANCH && env.FROM_GIT } } environment { CREDENTIALS = credentials('docker-registry') } steps { - nodejs('node-v20') { - sh 'gulp build' - } - + sh 'gulp build' dockerBuild() } } @@ -130,9 +119,8 @@ pipeline { sh 'mkdir -p db/remotes' sh 'cp "$MYSQL_CONFIG" db/remotes/$NODE_ENV.ini' } - nodejs('node-v20') { - sh 'npx myt push $NODE_ENV --force --commit' - } + + sh 'npx myt push $NODE_ENV --force --commit' } } stage('Docker') { @@ -150,9 +138,21 @@ pipeline { } } post { + always { + script { + if (env.RUN_TESTS) { + try { + junit 'junitresults.xml' + junit 'junit.xml' + } catch (e) { + echo e.toString() + } + } + } + } success { script { - if (env.FROM_GIT && env.BRANCH_NAME == 'master') { + if (env.BRANCH_NAME == 'master' && env.FROM_GIT) { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) @@ -171,17 +171,5 @@ pipeline { unsuccessful { sendEmail() } - always { - script { - if (env.FROM_GIT && !env.PROTECTED_BRANCH) { - try { - junit 'junitresults.xml' - junit 'junit.xml' - } catch (e) { - echo e.toString() - } - } - } - } } } From 420398260ff02920b4dffff6474a94f4668f197a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 21:49:58 +0100 Subject: [PATCH 20/29] fix: refs #5483 Jenkinsfile codefix --- Jenkinsfile | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4688e5283..d0c4614ca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,9 @@ #!/usr/bin/env groovy + +def PROTECTED_BRANCH +def FROM_GIT +def RUN_TESTS + pipeline { agent any options { @@ -33,19 +38,19 @@ pipeline { def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version - env.PROTECTED_BRANCH = [ - 'dev', - 'test', - 'master' - ].contains(env.BRANCH_NAME) - env.GIT_COMMIT_MSG = sh( script: 'git log -1 --pretty=%B ${GIT_COMMIT}', returnStdout: true ).trim() - env.FROM_GIT = env.JOB_NAME.startsWith('gitea/') - env.RUN_TESTS = !env.PROTECTED_BRANCH && env.FROM_GIT + PROTECTED_BRANCH = [ + 'dev', + 'test', + 'master' + ].contains(env.BRANCH_NAME) + + FROM_GIT = JOB_NAME.startsWith('gitea/') + RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT } setEnv() } @@ -74,7 +79,7 @@ pipeline { } stage('Test') { when { - expression { return env.RUN_TESTS } + expression { return RUN_TESTS } } environment { NODE_ENV = "" @@ -95,7 +100,7 @@ pipeline { } stage('Build') { when { - expression { return env.PROTECTED_BRANCH && env.FROM_GIT } + expression { return PROTECTED_BRANCH && FROM_GIT } } environment { CREDENTIALS = credentials('docker-registry') @@ -107,7 +112,7 @@ pipeline { } stage('Deploy') { when { - expression { return env.PROTECTED_BRANCH } + expression { return PROTECTED_BRANCH } } parallel { stage('Database') { @@ -125,7 +130,7 @@ pipeline { } stage('Docker') { when { - expression { return env.FROM_GIT } + expression { return FROM_GIT } } environment { DOCKER_HOST = "${env.SWARM_HOST}" @@ -140,7 +145,7 @@ pipeline { post { always { script { - if (env.RUN_TESTS) { + if (RUN_TESTS) { try { junit 'junitresults.xml' junit 'junit.xml' @@ -152,7 +157,7 @@ pipeline { } success { script { - if (env.BRANCH_NAME == 'master' && env.FROM_GIT) { + if (env.BRANCH_NAME == 'master' && FROM_GIT) { String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) From 7ab11543edb661c04a899c587e34835db341e694 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 21:57:04 +0100 Subject: [PATCH 21/29] build: refs #5483 Jenkinsfile optimized for daily DB push --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d0c4614ca..8f1ada293 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -66,11 +66,17 @@ pipeline { } } stage('Frontend') { + when { + expression { return FROM_GIT } + } steps { sh 'npm install --no-audit --prefer-offline --prefix=front' } } stage('Print') { + when { + expression { return FROM_GIT } + } steps { sh 'npm install --no-audit --prefer-offline --prefix=print' } From 53ac10d0becf2ccf76a4900dd35690a81d4c30c4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 22:33:55 +0100 Subject: [PATCH 22/29] 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 { From e4f62e4e065b8418e19b32f51ca3a525ec40f9a7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 22:53:33 +0100 Subject: [PATCH 23/29] 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 { From 67db31e39b923ce569d327842c4010f7b4ff0ed8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 23:06:12 +0100 Subject: [PATCH 24/29] 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 { From 827586ebd683bc7eef93483d7dcc0fab358e7739 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 23:14:51 +0100 Subject: [PATCH 25/29] 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 { From 6d01164fb32d72146b95a0b1fb9e7a29d9f8e018 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Jan 2024 23:25:14 +0100 Subject: [PATCH 26/29] 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 { From f88cef674569caab0b3f1984e10da7b872ab340e Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 31 Jan 2024 08:45:52 +0100 Subject: [PATCH 27/29] refs #6186 feat:deprecated packingShelve --- db/dump/fixtures.before.sql | 36 +++++++++---------- .../procedures/item_updatePackingShelve.sql | 17 --------- .../sale_getFromTicketOrCollection.sql | 1 - db/routines/vn/triggers/item_beforeUpdate.sql | 10 +----- .../10855-azureCamellia/00-firstScript.sql | 6 ++++ 5 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 db/routines/vn/procedures/item_updatePackingShelve.sql create mode 100644 db/versions/10855-azureCamellia/00-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 0f608d19d..3803730bd 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -942,25 +942,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('VT', 'Sales'); INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`, - `comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`) + `comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `weightByPiece`) VALUES - (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 15,3), - (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 10,2), - (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5,5), - (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL), - (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL,NULL), - (14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL), - (15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), - (16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), - (71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL); + (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 3), + (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 2), + (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5), + (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL), + (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), + (13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL), + (14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL), + (15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL), + (16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL), + (71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 diff --git a/db/routines/vn/procedures/item_updatePackingShelve.sql b/db/routines/vn/procedures/item_updatePackingShelve.sql deleted file mode 100644 index 23e449ef5..000000000 --- a/db/routines/vn/procedures/item_updatePackingShelve.sql +++ /dev/null @@ -1,17 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_updatePackingShelve`(vSelf INT, vPacking INT) -BEGIN - - /** - * Actualiza el valor de item.packingShelve - * - * @param vSelf Identificador de vn.item - * @param vPacking Cantidad de unidades de venta que caben en una bandeja - */ - - UPDATE vn.item i - SET i.packingShelve = vPacking - WHERE i.id = vSelf; - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql index f177abf59..e0cff202f 100644 --- a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql +++ b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql @@ -77,7 +77,6 @@ DECLARE vIsCollection BOOL; s.isAdded, IF(c.workerFk IS NULL, getUser(), c.workerFk) workerFk, IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity, - i.packingShelve, MIN(iss.created) picked, IF(sm.id, TRUE, FALSE) hasMistake, sg.sectorFk diff --git a/db/routines/vn/triggers/item_beforeUpdate.sql b/db/routines/vn/triggers/item_beforeUpdate.sql index c7c8676de..3cf630d18 100644 --- a/db/routines/vn/triggers/item_beforeUpdate.sql +++ b/db/routines/vn/triggers/item_beforeUpdate.sql @@ -6,15 +6,7 @@ BEGIN DECLARE vNewPackingShelve INT; SET NEW.editorFk = account.myUser_getId(); - - IF ISNULL(NEW.packingShelve) AND NOT ISNULL(NEW.packingOut) THEN - SELECT NEW.packingOut * vc.shelveVolume / vc.standardFlowerBox - INTO vNewPackingShelve - FROM vn.volumeConfig vc; - - SET NEW.packingShelve = vNewPackingShelve; - END IF; - + IF NEW.itemPackingTypeFk = '' THEN SET NEW.itemPackingTypeFk = NULL; END IF; diff --git a/db/versions/10855-azureCamellia/00-firstScript.sql b/db/versions/10855-azureCamellia/00-firstScript.sql new file mode 100644 index 000000000..32ef11e78 --- /dev/null +++ b/db/versions/10855-azureCamellia/00-firstScript.sql @@ -0,0 +1,6 @@ +-- Place your SQL code here + +USE vn; + +ALTER TABLE vn.item CHANGE packingShelve packingShelve__ int(11) DEFAULT NULL NULL COMMENT '@deprecated 2024-31-01'; + From a8b483078f080ab1840afc307ae881e32f5e7d73 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 31 Jan 2024 08:52:36 +0100 Subject: [PATCH 28/29] refs #6186 feat:deprecated packingShelve --- modules/item/back/models/item.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 595fb537d..9d48dcbfb 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -143,15 +143,12 @@ "isFloramondo": { "type": "boolean" }, - "packingShelve": { - "type": "number" - }, "isLaid": { "type": "boolean" }, "isPhotoRequested": { "type": "boolean", - "mysql":{ + "mysql": { "columnName": "doPhoto" } }, @@ -226,4 +223,4 @@ } } } -} +} \ No newline at end of file From 59d45ab85c800e1c3eba0f9316d78995c480b90a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 31 Jan 2024 12:02:08 +0100 Subject: [PATCH 29/29] 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 {