Pass network name
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2022-10-06 09:09:49 +02:00
parent b134aeb0ea
commit 1bf090b6ee
1 changed files with 4 additions and 3 deletions

View File

@ -19,8 +19,9 @@ module.exports = class Docker {
* to avoid a bug with OverlayFS driver on MacOS.
*
* @param {Boolean} ci continuous integration environment argument
* @param {String} networkName Name of the container network
*/
async run(ci) {
async run(ci, networkName = 'jenkins') {
let d = new Date();
let pad = v => v < 10 ? '0' + v : v;
let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
@ -43,7 +44,7 @@ module.exports = class Docker {
let runChown = process.platform != 'linux';
let network = '';
if (ci) network = '--network="jenkins"';
if (ci) network = `--network="${networkName}"`;
log('Starting container...');
const container = await this.execP(`
@ -60,7 +61,7 @@ module.exports = class Docker {
let netSettings = JSON.parse(inspect.stdout);
if (ci) {
this.dbConf.host = netSettings.Networks.jenkins.IPAddress;
this.dbConf.host = netSettings.Networks[networkName].IPAddress;
this.dbConf.port = 3306;
} else
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];