Merge branch 'dev' into 6372-Delete-views-from-vn2008
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
ce0b43ed9e
|
@ -1,4 +1,6 @@
|
|||
node_modules
|
||||
print/node_modules
|
||||
front/node_modules
|
||||
services
|
||||
front
|
||||
db
|
||||
e2e
|
||||
storage
|
||||
|
|
|
@ -5,9 +5,15 @@ def FROM_GIT
|
|||
def RUN_TESTS
|
||||
def RUN_BUILD
|
||||
|
||||
def BRANCH_ENV = [
|
||||
test: 'test',
|
||||
master: 'production'
|
||||
]
|
||||
|
||||
node {
|
||||
stage('Setup') {
|
||||
env.NODE_ENV = 'dev'
|
||||
env.BACK_REPLICAS = 1
|
||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
||||
|
||||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
|
@ -86,9 +92,6 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('Stack') {
|
||||
environment {
|
||||
TZ = 'Europe/Madrid'
|
||||
}
|
||||
parallel {
|
||||
stage('Back') {
|
||||
stages {
|
||||
|
@ -104,14 +107,10 @@ pipeline {
|
|||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
try {
|
||||
junit 'junitresults.xml'
|
||||
junit 'junit.xml'
|
||||
} catch (e) {
|
||||
echo e.toString()
|
||||
}
|
||||
}
|
||||
junit(
|
||||
testResults: 'junitresults.xml',
|
||||
allowEmptyResults: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +143,14 @@ pipeline {
|
|||
steps {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=10'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit(
|
||||
testResults: 'junit.xml',
|
||||
allowEmptyResults: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
when {
|
||||
|
|
|
@ -8,6 +8,26 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.validatesUniquenessOf('bic', {
|
||||
message: 'This BIC already exist.'
|
||||
message: 'This BIC already exist'
|
||||
});
|
||||
|
||||
Self.validatesPresenceOf('countryFk', {
|
||||
message: 'CountryFK cannot be empty'
|
||||
});
|
||||
|
||||
Self.validateAsync('bic', checkBic, {
|
||||
message: 'Bank entity id must be specified'
|
||||
});
|
||||
async function checkBic(err, done) {
|
||||
const filter = {
|
||||
fields: ['code'],
|
||||
where: {id: this.countryFk}
|
||||
};
|
||||
const country = await Self.app.models.Country.findOne(filter);
|
||||
const code = country ? country.code.toLowerCase() : null;
|
||||
|
||||
if (code == 'es' && !this.id)
|
||||
err();
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,19 +1,36 @@
|
|||
/* eslint-disable no-console */
|
||||
const path = require('path');
|
||||
const getopts = require('getopts');
|
||||
const Myt = require('@verdnatura/myt/myt');
|
||||
const Run = require('@verdnatura/myt/myt-run');
|
||||
const helper = require('./tests-helper');
|
||||
|
||||
const opts = getopts(process.argv.slice(2), {
|
||||
string: [
|
||||
'network'
|
||||
],
|
||||
boolean: [
|
||||
'ci',
|
||||
'junit'
|
||||
]
|
||||
});
|
||||
|
||||
let server;
|
||||
const isCI = process.argv[2] === 'ci';
|
||||
const PARALLEL = false;
|
||||
const TIMEOUT = 900000;
|
||||
|
||||
process.on('SIGINT', teardown);
|
||||
process.on('exit', teardown);
|
||||
process.on('uncaughtException', onError);
|
||||
process.on('unhandledRejection', onError);
|
||||
|
||||
const exitSignals = [
|
||||
'SIGINT',
|
||||
'SIGUSR1',
|
||||
'SIGUSR2'
|
||||
];
|
||||
for (const signal of exitSignals)
|
||||
process.on(signal, () => process.exit());
|
||||
|
||||
async function setup() {
|
||||
console.log('Building and running DB container.');
|
||||
|
||||
|
@ -21,9 +38,9 @@ async function setup() {
|
|||
await myt.init({
|
||||
workspace: path.join(__dirname, '..'),
|
||||
random: true,
|
||||
ci: isCI,
|
||||
ci: opts.ci,
|
||||
tmpfs: process.platform == 'linux',
|
||||
network: isCI ? 'jenkins' : null
|
||||
network: opts.network || null
|
||||
});
|
||||
server = await myt.run(Run);
|
||||
await myt.deinit();
|
||||
|
@ -38,18 +55,19 @@ async function setup() {
|
|||
|
||||
async function teardown() {
|
||||
if (!server) return;
|
||||
const oldServer = server;
|
||||
server = null;
|
||||
|
||||
if (!PARALLEL)
|
||||
await helper.deinit();
|
||||
|
||||
console.log('Stopping and removing DB container.');
|
||||
await server.rm();
|
||||
server = null;
|
||||
await oldServer.rm();
|
||||
}
|
||||
|
||||
async function onError(err) {
|
||||
await teardown();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function test() {
|
||||
|
@ -79,8 +97,8 @@ async function test() {
|
|||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
runner.addReporter(new SpecReporter({
|
||||
spec: {
|
||||
displaySuccessful: isCI,
|
||||
displayPending: isCI
|
||||
displaySuccessful: opts.ci,
|
||||
displayPending: opts.ci
|
||||
},
|
||||
summary: {
|
||||
displayPending: false,
|
||||
|
@ -88,11 +106,12 @@ async function test() {
|
|||
}));
|
||||
}
|
||||
|
||||
if (isCI) {
|
||||
if (opts.junit) {
|
||||
const JunitReporter = require('jasmine-reporters');
|
||||
runner.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT;
|
||||
}
|
||||
if (opts.ci)
|
||||
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT;
|
||||
|
||||
// runner.loadConfigFile('back/jasmine.json');
|
||||
runner.loadConfig(config);
|
||||
|
|
|
@ -3,8 +3,9 @@ services:
|
|||
front:
|
||||
image: registry.verdnatura.es/salix-front:${VERSION:?}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
context: front
|
||||
environment:
|
||||
- TZ
|
||||
ports:
|
||||
- 80
|
||||
deploy:
|
||||
|
@ -18,11 +19,12 @@ services:
|
|||
back:
|
||||
image: registry.verdnatura.es/salix-back:${VERSION:?}
|
||||
build: .
|
||||
ports:
|
||||
- 3000
|
||||
environment:
|
||||
- NODE_ENV
|
||||
- DEBUG
|
||||
- TZ
|
||||
ports:
|
||||
- 3000
|
||||
configs:
|
||||
- source: datasources
|
||||
target: /etc/salix/datasources.json
|
||||
|
|
|
@ -10,7 +10,7 @@ RUN apt-get update \
|
|||
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
WORKDIR /etc/nginx
|
||||
COPY front/nginx.conf sites-available/salix
|
||||
COPY nginx.conf sites-available/salix
|
||||
RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix
|
||||
|
||||
COPY dist /salix/dist
|
||||
|
|
46
gulpfile.js
46
gulpfile.js
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-console */
|
||||
require('require-yaml');
|
||||
const gulp = require('gulp');
|
||||
const PluginError = require('plugin-error');
|
||||
|
@ -17,7 +18,7 @@ if (argv.NODE_ENV)
|
|||
let langs = ['es', 'en'];
|
||||
let srcDir = './front';
|
||||
let modulesDir = './modules';
|
||||
let buildDir = 'dist';
|
||||
let buildDir = 'front/dist';
|
||||
|
||||
let backSources = [
|
||||
'!node_modules',
|
||||
|
@ -67,19 +68,40 @@ back.description = `Starts backend and database service`;
|
|||
|
||||
const defaultTask = gulp.parallel(front, back);
|
||||
defaultTask.description = `Starts all application services`;
|
||||
function install() {
|
||||
const install = require('gulp-install');
|
||||
const print = require('gulp-print');
|
||||
async function install() {
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
let npmArgs = [];
|
||||
if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline'];
|
||||
console.log('-> Installing global packages...');
|
||||
await pnpmInstall();
|
||||
|
||||
let packageFiles = ['front/package.json', 'print/package.json'];
|
||||
return gulp.src(packageFiles)
|
||||
.pipe(print(filepath => {
|
||||
return `Installing packages in ${filepath}`;
|
||||
}))
|
||||
.pipe(install({npm: npmArgs}));
|
||||
const modules = ['front', 'print'];
|
||||
for (const module of modules) {
|
||||
console.log(`-> Installing '${module}' packages...`);
|
||||
await pnpmInstall(module);
|
||||
}
|
||||
|
||||
async function pnpmInstall(prefix) {
|
||||
let args = ['install', '--prefer-offline'];
|
||||
if (prefix) args = args.concat(['--prefix', prefix]);
|
||||
|
||||
const options = {
|
||||
stdio: [
|
||||
process.stdin,
|
||||
process.stdout,
|
||||
process.stderr
|
||||
]
|
||||
};
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const child = spawn('pnpm', args, options);
|
||||
child.on('exit', code => {
|
||||
if (code !== 0)
|
||||
reject(new Error(`pnpm exit code ${code}`));
|
||||
else
|
||||
resolve(code);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
install.description = `Installs node dependencies in all directories`;
|
||||
|
||||
|
|
|
@ -198,6 +198,7 @@
|
|||
"Booking completed": "Booking complete",
|
||||
"The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
|
||||
"You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
|
||||
"Bank entity must be specified": "Bank entity must be specified",
|
||||
"Try again": "Try again",
|
||||
"keepPrice": "keepPrice",
|
||||
"Cannot past travels with entries": "Cannot past travels with entries",
|
||||
|
|
|
@ -338,5 +338,6 @@
|
|||
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||
"No tickets to invoice": "No hay tickets para facturar",
|
||||
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
||||
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||
"An email is necessary": "Es necesario un email"
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@babel/register": "^7.7.7",
|
||||
"@verdnatura/myt": "^1.6.3",
|
||||
"@verdnatura/myt": "^1.6.6",
|
||||
"angular-mocks": "^1.7.9",
|
||||
"babel-jest": "^26.0.1",
|
||||
"babel-loader": "^8.2.4",
|
||||
|
@ -67,6 +67,7 @@
|
|||
"eslint-plugin-jasmine": "^2.10.1",
|
||||
"fancy-log": "^1.3.2",
|
||||
"file-loader": "^6.2.0",
|
||||
"getopts": "^2.3.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-env": "^0.4.0",
|
||||
|
@ -107,7 +108,7 @@
|
|||
"scripts": {
|
||||
"dbtest": "nodemon -q db/tests.js -w db/tests",
|
||||
"test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json",
|
||||
"test:back:ci": "node back/tests.js ci",
|
||||
"test:back:ci": "node back/tests.js --ci --junit --network jenkins",
|
||||
"test:e2e": "node e2e/helpers/tests.js",
|
||||
"test:front": "jest --watch",
|
||||
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
|
||||
|
|
|
@ -128,8 +128,8 @@ devDependencies:
|
|||
specifier: ^7.7.7
|
||||
version: 7.23.7(@babel/core@7.23.9)
|
||||
'@verdnatura/myt':
|
||||
specifier: ^1.6.3
|
||||
version: 1.6.3
|
||||
specifier: ^1.6.6
|
||||
version: 1.6.6
|
||||
angular-mocks:
|
||||
specifier: ^1.7.9
|
||||
version: 1.8.3
|
||||
|
@ -163,6 +163,9 @@ devDependencies:
|
|||
file-loader:
|
||||
specifier: ^6.2.0
|
||||
version: 6.2.0(webpack@5.90.1)
|
||||
getopts:
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
gulp:
|
||||
specifier: ^4.0.2
|
||||
version: 4.0.2
|
||||
|
@ -2630,8 +2633,8 @@ packages:
|
|||
dev: false
|
||||
optional: true
|
||||
|
||||
/@verdnatura/myt@1.6.3:
|
||||
resolution: {integrity: sha512-VRoTB5sEPL8a7VaX9l2afpaPNT6pBa+If1tP9tpaJ4enFQbNITlApcC0GK6XYmWMkJQjl2lgdN4/u0UCiNb2MQ==}
|
||||
/@verdnatura/myt@1.6.6:
|
||||
resolution: {integrity: sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@sqltools/formatter': 1.2.5
|
||||
|
|
|
@ -11,7 +11,7 @@ let baseConfig = {
|
|||
entry: {salix: 'salix'},
|
||||
mode,
|
||||
output: {
|
||||
path: path.join(__dirname, 'dist'),
|
||||
path: path.join(__dirname, 'front/dist'),
|
||||
publicPath: '/'
|
||||
},
|
||||
module: {
|
||||
|
@ -139,7 +139,7 @@ let devConfig = {
|
|||
host: '0.0.0.0',
|
||||
port: 5000,
|
||||
publicPath: '/',
|
||||
contentBase: 'dist',
|
||||
contentBase: 'front/dist',
|
||||
quiet: false,
|
||||
noInfo: false,
|
||||
hot: true,
|
||||
|
|
Loading…
Reference in New Issue