From b2eab3ab51e207fe829634fa87927d3cc9bed58a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Aug 2019 14:18:15 +0200 Subject: [PATCH] DB IP autodetected when random container --- Jenkinsfile | 1 - gulpfile.js | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4ccc54b46..5d03be700 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,7 +68,6 @@ pipeline { environment { NODE_ENV = "" FIREFOX_BIN = "/opt/firefox/firefox-bin" - DB_HOST = "${env.DOCKER_HOST_2}" } steps { nodejs('node-lts') { diff --git a/gulpfile.js b/gulpfile.js index 2ac31a86e..46285530d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,9 +23,6 @@ let containerId = 'salix-db'; let dataSources = require('./loopback/server/datasources.json'); let dbConf = dataSources.vn; -if (process.env.DB_HOST) - dbConf.host = process.env.DB_HOST; - let backSources = [ '!node_modules', 'loopback', @@ -424,8 +421,10 @@ async function docker() { if (argv['random']) { let inspect = await execP(`docker inspect -f "{{json .NetworkSettings.Ports}}" ${containerId}`); - let ports = JSON.parse(inspect.stdout); - dbConf.port = ports['3306/tcp'][0]['HostPort']; + let netSettings = JSON.parse(inspect); + + dbConf.host = netSettings.IPAddress; + dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; } if (runChown) await dockerWait();