8713-testToMaster #3523

Merged
alexm merged 383 commits from 8713-testToMaster into master 2025-03-04 06:52:15 +00:00
7 changed files with 91 additions and 102 deletions
Showing only changes of commit 2bac7cbd09 - Show all commits

159
Jenkinsfile vendored
View File

@ -8,6 +8,7 @@ def RUN_BUILD
def BRANCH_ENV = [
test: 'test',
master: 'production',
main: 'production',
beta: 'production'
]
@ -20,12 +21,14 @@ node {
'dev',
'test',
'master',
'main',
'beta'
].contains(env.BRANCH_NAME)
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
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}"
@ -73,6 +76,7 @@ pipeline {
def packageJson = readJSON file: 'package.json'
def version = "${packageJson.version}-build${env.BUILD_ID}"
writeFile(file: 'VERSION.txt', text: version)
echo "VERSION.txt: ${version}"
}
}
}
@ -105,93 +109,73 @@ pipeline {
}
}
}
stage('Stack') {
parallel {
stage('Back') {
stages {
stage('Test') {
when {
expression { RUN_TESTS }
}
environment {
NODE_ENV = ''
}
steps {
sh 'node back/tests.js --junit'
}
post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
}
}
stage('Build') {
when {
expression { RUN_BUILD }
}
environment {
VERSION = readFile 'VERSION.txt'
}
steps {
sh 'docker-compose build back'
}
}
}
}
stage('Front') {
when {
expression { FROM_GIT }
}
stages {
stage('Test') {
when {
expression { RUN_TESTS }
}
environment {
NODE_ENV = ''
}
steps {
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=10'
}
post {
always {
junit(
testResults: 'junit.xml',
allowEmptyResults: true
)
}
}
}
stage('Build') {
when {
expression { RUN_BUILD }
}
environment {
VERSION = readFile 'VERSION.txt'
}
steps {
sh 'gulp build'
sh 'docker-compose build front'
}
}
}
}
}
}
stage('Push') {
stage('Build') {
when {
expression { RUN_BUILD }
}
environment {
CREDENTIALS = credentials('docker-registry')
VERSION = readFile 'VERSION.txt'
CREDENTIALS = credentials('docker-registry')
}
steps {
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
sh 'docker-compose push'
parallel {
stage('Back') {
steps {
dockerBuildPush 'salix-back', '.', 'back/Dockerfile'
}
}
stage('Front') {
steps {
sh 'gulp build'
dockerBuildPush 'salix-front', 'front'
}
}
stage('DB') {
steps {
sh 'npx myt run -t'
sh 'docker exec vn-database sh -c "cp -r /var/lib/mysql /data"'
sh 'docker commit vn-database vn_db'
sh 'docker stop vn-database'
sh 'docker rm vn-database'
dockerBuildPush 'salix-db', 'db'
}
}
}
}
stage('Test') {
when {
expression { RUN_TESTS }
}
environment {
NODE_ENV = ''
}
parallel {
stage('Back') {
steps {
sh 'node back/tests.js --junit'
}
post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
}
}
}
stage('Front') {
steps {
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=10'
}
post {
always {
junit(
testResults: 'junit.xml',
allowEmptyResults: true
)
}
}
}
}
}
stage('Deploy') {
@ -264,3 +248,16 @@ pipeline {
}
}
}
def dockerBuildPush(imageName, context, dockerfile = null) {
if (dockerfile == null)
dockerfile = "${context}/Dockerfile"
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
def baseImage = "${imageName}:${env.VERSION}"
def image = docker.build(baseImage, "-f ${dockerfile} ${context}")
image.push()
image.push(env.BRANCH_NAME)
if (IS_LATEST) image.push('latest')
}
}

View File

@ -25,7 +25,7 @@ RUN apt-get update \
libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 \
libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \
libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 build-essential \
fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
# Extra dependencies
@ -55,4 +55,4 @@ COPY \
README.md \
./
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"]
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"]

4
db/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM mariadb:10.11.6
ENV TZ Europe/Madrid
COPY --from=vn_db /data /var/lib/mysql
CMD ["mysqld"]

View File

@ -207,7 +207,7 @@ BEGIN
SELECT t.originType,
t.originId,
@shipped:= t.shipped,
@shipped:= t.shipped shipped,
t.alertLevel,
t.stateName,
t.reference,

View File

@ -72,7 +72,7 @@ proc: BEGIN
IF(tpr.isFreezed, ' CONGELADO',''),
IF(tpr.hasHighRisk, ' RIESGO',''),
IF(tpr.hasTicketRequest, ' COD 100',''),
IF(tpr.isTaxDataChecked, '',' FICHA INCOMPLETA'),
IF(tpr.isTaxDataChecked, ' FICHA INCOMPLETA', ''),
IF(tpr.hasComponentLack, ' COMPONENTES', ''),
IF(HOUR(util.VN_NOW()) < IF(HOUR(t.shipped), HOUR(t.shipped), COALESCE(HOUR(zc.hour),HOUR(z.hour)))
AND tpr.isTooLittle, ' PEQUEÑO', '')

View File

@ -1,11 +0,0 @@
version: '3.7'
services:
front:
image: registry.verdnatura.es/salix-front:${VERSION:?}
build:
context: front
back:
image: registry.verdnatura.es/salix-back:${VERSION:?}
build:
context: .
dockerfile: back/Dockerfile

View File

@ -1,9 +1,8 @@
subject: Votre facture
title: Votre facture
dear: Cher client,
description: Le facture <strong>{0}</strong> correspondant à la commande <strong>{1}</strong> est maintenant disponible.<br/>
Vous pouvez le télécharger en cliquant sur la pièce jointe dans cet email.
poll: Si vous le souhaitez, vous pouvez répondre à notre questionaire de satisfaction
pour nous aider à améliorer notre service. Votre avis est très important pour nous!
help: N'hésitez pas nous envoyer toute doute ou question, <strong>nous sommes là pour vous aider!</strong>
dear: Chère cliente, cher client
description: La facture <strong>{0}</strong> correspondant à votre commande <strong>{1}</strong> est maintenant disponible.<br/>
Vous pouvez la télécharger en cliquant sur la pièce jointe.
poll: <strong></strong>
help: En cas de besoin d'eclaircissement, n'hésitez pas à nous contacter, <strong>nous sommes là pour vous aider!</strong>
conclusion: Merci pour votre attention!