refs #6397 emailValidation #1941
|
@ -1,9 +1,17 @@
|
|||
#!/usr/bin/env groovy
|
||||
|
||||
def PROTECTED_BRANCH
|
||||
def FROM_GIT
|
||||
def RUN_TESTS
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
tools {
|
||||
nodejs 'node-v20'
|
||||
}
|
||||
environment {
|
||||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
|
@ -13,24 +21,37 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
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 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
env.BACK_REPLICAS = 4
|
||||
break
|
||||
}
|
||||
|
||||
configFileProvider([
|
||||
configFile(fileId: "salix.groovy",
|
||||
variable: 'GROOVY_FILE')
|
||||
]) {
|
||||
load env.GROOVY_FILE
|
||||
}
|
||||
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()
|
||||
|
||||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
FROM_GIT = JOB_NAME.startsWith('gitea/')
|
||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||
}
|
||||
setEnv()
|
||||
}
|
||||
}
|
||||
|
@ -38,60 +59,85 @@ pipeline {
|
|||
environment {
|
||||
NODE_ENV = ""
|
||||
}
|
||||
parallel {
|
||||
stage('Backend') {
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
sh 'gulp install --ci'
|
||||
}
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
when { not { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}}
|
||||
when {
|
||||
expression { return RUN_TESTS }
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ""
|
||||
TZ = 'Europe/Madrid'
|
||||
}
|
||||
parallel {
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=4'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Backend') {
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'npm run test:back:ci'
|
||||
}
|
||||
}
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
when {
|
||||
expression { return PROTECTED_BRANCH && FROM_GIT }
|
||||
}
|
||||
environment {
|
||||
CREDENTIALS = credentials('docker-registry')
|
||||
}
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'gulp build'
|
||||
}
|
||||
|
||||
dockerBuild()
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
when {
|
||||
expression { return PROTECTED_BRANCH }
|
||||
}
|
||||
parallel {
|
||||
stage('Database') {
|
||||
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'
|
||||
}
|
||||
|
||||
sh 'npx myt push $NODE_ENV --force --commit'
|
||||
}
|
||||
}
|
||||
stage('Docker') {
|
||||
when {
|
||||
expression { return FROM_GIT }
|
||||
}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
}
|
||||
|
@ -99,30 +145,13 @@ pipeline {
|
|||
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.${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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
if (!['master', 'test'].contains(env.BRANCH_NAME)) {
|
||||
if (RUN_TESTS) {
|
||||
try {
|
||||
junit 'junitresults.xml'
|
||||
junit 'junit.xml'
|
||||
|
@ -130,18 +159,28 @@ pipeline {
|
|||
echo e.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
success {
|
||||
script {
|
||||
if (env.BRANCH_NAME == 'master' && FROM_GIT) {
|
||||
String message = env.GIT_COMMIT_MSG
|
||||
int index = message.indexOf('\n')
|
||||
if (index != -1)
|
||||
message = message.substring(0, index)
|
||||
|
||||
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}"
|
||||
rocketSend(
|
||||
channel: 'vn-database',
|
||||
message: "*DB version uploaded:* ${message}"
|
||||
+"\n$COMMITTER_EMAIL ($BRANCH_NAME)"
|
||||
+"\n$GIT_URL/commit/$GIT_COMMIT",
|
||||
rawMessage: true
|
||||
)
|
||||
} catch (e) {
|
||||
echo e.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
unsuccessful {
|
||||
sendEmail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ;
|
|
@ -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
|
||||
|
|
|
@ -7,14 +7,6 @@ BEGIN
|
|||
|
||||
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;
|
||||
|
|
|
@ -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';
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
version: '3.7'
|
||||
services:
|
||||
front:
|
||||
image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?}
|
||||
image: registry.verdnatura.es/salix-front:${VERSION:?}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
|
@ -16,7 +16,7 @@ services:
|
|||
limits:
|
||||
memory: 1G
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||
image: registry.verdnatura.es/salix-back:${VERSION:?}
|
||||
build: .
|
||||
ports:
|
||||
- 3000
|
||||
|
|
|
@ -143,15 +143,12 @@
|
|||
"isFloramondo": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"packingShelve": {
|
||||
"type": "number"
|
||||
},
|
||||
"isLaid": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPhotoRequested": {
|
||||
"type": "boolean",
|
||||
"mysql":{
|
||||
"mysql": {
|
||||
"columnName": "doPhoto"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue