Pass network name
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b134aeb0ea
commit
1bf090b6ee
|
@ -19,8 +19,9 @@ module.exports = class Docker {
|
||||||
* to avoid a bug with OverlayFS driver on MacOS.
|
* to avoid a bug with OverlayFS driver on MacOS.
|
||||||
*
|
*
|
||||||
* @param {Boolean} ci continuous integration environment argument
|
* @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 d = new Date();
|
||||||
let pad = v => v < 10 ? '0' + v : v;
|
let pad = v => v < 10 ? '0' + v : v;
|
||||||
let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
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 runChown = process.platform != 'linux';
|
||||||
|
|
||||||
let network = '';
|
let network = '';
|
||||||
if (ci) network = '--network="jenkins"';
|
if (ci) network = `--network="${networkName}"`;
|
||||||
|
|
||||||
log('Starting container...');
|
log('Starting container...');
|
||||||
const container = await this.execP(`
|
const container = await this.execP(`
|
||||||
|
@ -60,7 +61,7 @@ module.exports = class Docker {
|
||||||
let netSettings = JSON.parse(inspect.stdout);
|
let netSettings = JSON.parse(inspect.stdout);
|
||||||
|
|
||||||
if (ci) {
|
if (ci) {
|
||||||
this.dbConf.host = netSettings.Networks.jenkins.IPAddress;
|
this.dbConf.host = netSettings.Networks[networkName].IPAddress;
|
||||||
this.dbConf.port = 3306;
|
this.dbConf.port = 3306;
|
||||||
} else
|
} else
|
||||||
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||||
|
|
Loading…
Reference in New Issue