ip botained for ci and localhost
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-06-11 10:37:55 +02:00
parent 477b1c8e1e
commit d4f1a90f87
3 changed files with 10 additions and 7 deletions

2
Jenkinsfile vendored
View File

@ -68,7 +68,7 @@ pipeline {
stage('Backend') {
steps {
nodejs('node-lts') {
sh 'gulp backTestOnce --junit'
sh 'gulp backTestOnce --ci'
}
}
}

View File

@ -17,8 +17,10 @@ module.exports = class Docker {
* image when fixtures have been modified or when the day on which the
* image was built is different to today. Some workarounds have been used
* to avoid a bug with OverlayFS driver on MacOS.
*
* @param {Boolean} ci continuous integration environment argument
*/
async run() {
async run(ci) {
let d = new Date();
let pad = v => v < 10 ? '0' + v : v;
let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
@ -45,8 +47,9 @@ module.exports = class Docker {
let inspect = await this.execP(`docker inspect -f "{{json .NetworkSettings}}" ${this.id}`);
let netSettings = JSON.parse(inspect.stdout);
// this.dbConf.host = netSettings.Gateway;
this.dbConf.host = '127.0.0.1';
if (ci)
this.dbConf.host = netSettings.Gateway;
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
}

View File

@ -74,7 +74,7 @@ async function backTestOnce(done) {
let dataSources = require('./loopback/server/datasources.json');
const container = new Docker();
await container.run();
await container.run(argv.ci);
dataSources = JSON.parse(JSON.stringify(dataSources));
@ -100,7 +100,7 @@ async function backTestOnce(done) {
}
};
if (argv.junit) {
if (argv.ci) {
const reporters = require('jasmine-reporters');
options.reporter = new reporters.JUnitXmlReporter();
}
@ -126,7 +126,7 @@ async function backTestOnce(done) {
if (err)
throw err;
}
backTestOnce.description = `Runs the backend tests once using a random container, can receive --junit arg to save reports on a xml file`;
backTestOnce.description = `Runs the backend tests once using a random container, can receive --ci arg to save reports on a xml file`;
function backTest(done) {
const nodemon = require('gulp-nodemon');