From bdfbb8f6f7b05e1cec605a7591addd221a429931 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 7 Feb 2024 12:54:37 +0100 Subject: [PATCH 1/3] build: refs#6706 gulp install fixed, myt updated --- gulpfile.js | 44 +++++++++++++++++++++++++++++++++----------- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 1c6fe2a2d..255b1ee05 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ require('require-yaml'); const gulp = require('gulp'); const PluginError = require('plugin-error'); @@ -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`; diff --git a/package.json b/package.json index 73fa5fc7a..197c1094d 100644 --- a/package.json +++ b/package.json @@ -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.5", + "@verdnatura/myt": "^1.6.6", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83904cf41..19f57caf9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,8 +128,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.5 - version: 1.6.5 + specifier: ^1.6.6 + version: 1.6.6 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2633,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.5: - resolution: {integrity: sha512-0h7FvhSewd2W9EOymc59YymZJOBfCXmY5CWNFhol1yBfWSOOF9JAEE9DKRMbKaMqd/5Dy9LriS5PYOfeqm3HjA==} + /@verdnatura/myt@1.6.6: + resolution: {integrity: sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5 From eda85eda76337d1d1699bda12ef73d3fa97ead2f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 7 Feb 2024 13:24:50 +0100 Subject: [PATCH 2/3] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4bacaa6d2..034bda012 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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', @@ -23,24 +29,26 @@ node { echo "NODE_NAME: ${env.NODE_NAME}" echo "WORKSPACE: ${env.WORKSPACE}" - configFileProvider([ - configFile(fileId: 'salix.properties', - variable: 'PROPS_FILE') - ]) { - def props = readProperties file: PROPS_FILE - props.each {key, value -> env."${key}" = value } - props.each {key, value -> echo "${key}: ${value}" } - } - - if (PROTECTED_BRANCH) { + if (FROM_GIT) { configFileProvider([ - configFile(fileId: "salix.branch.${env.BRANCH_NAME}", - variable: 'BRANCH_PROPS_FILE') + configFile(fileId: 'salix.properties', + variable: 'PROPS_FILE') ]) { - def props = readProperties file: BRANCH_PROPS_FILE + def props = readProperties file: PROPS_FILE props.each {key, value -> env."${key}" = value } props.each {key, value -> echo "${key}: ${value}" } } + + if (PROTECTED_BRANCH) { + configFileProvider([ + configFile(fileId: "salix.branch.${env.BRANCH_NAME}", + variable: 'BRANCH_PROPS_FILE') + ]) { + def props = readProperties file: BRANCH_PROPS_FILE + props.each {key, value -> env."${key}" = value } + props.each {key, value -> echo "${key}: ${value}" } + } + } } } } From c4907d1a33ad9d9d2998512f4b430f10c26c3a15 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 7 Feb 2024 13:56:21 +0100 Subject: [PATCH 3/3] ci: refs#6706 Jenkinsfile fixes --- Jenkinsfile | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 034bda012..2c04bcf16 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,26 +29,24 @@ node { echo "NODE_NAME: ${env.NODE_NAME}" echo "WORKSPACE: ${env.WORKSPACE}" - if (FROM_GIT) { + configFileProvider([ + configFile(fileId: 'salix.properties', + variable: 'PROPS_FILE') + ]) { + def props = readProperties file: PROPS_FILE + props.each {key, value -> env."${key}" = value } + props.each {key, value -> echo "${key}: ${value}" } + } + + if (PROTECTED_BRANCH) { configFileProvider([ - configFile(fileId: 'salix.properties', - variable: 'PROPS_FILE') + configFile(fileId: "salix.branch.${env.BRANCH_NAME}", + variable: 'BRANCH_PROPS_FILE') ]) { - def props = readProperties file: PROPS_FILE + def props = readProperties file: BRANCH_PROPS_FILE props.each {key, value -> env."${key}" = value } props.each {key, value -> echo "${key}: ${value}" } } - - if (PROTECTED_BRANCH) { - configFileProvider([ - configFile(fileId: "salix.branch.${env.BRANCH_NAME}", - variable: 'BRANCH_PROPS_FILE') - ]) { - def props = readProperties file: BRANCH_PROPS_FILE - props.each {key, value -> env."${key}" = value } - props.each {key, value -> echo "${key}: ${value}" } - } - } } } }