Skip to content

Commit 44f262f

Browse files
holatuwoldrewbrokke
authored andcommitted
LPD-55579 Read the port from Docker, since it won't always be 8080
1 parent e4bc4db commit 44f262f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

buildSrc/src/main/groovy/docker-liferay-bundle.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import com.liferay.docker.workspace.environments.Util
22

33
import de.undercouch.gradle.tasks.download.Download
44

5+
import groovy.json.JsonSlurper
56
import groovy.xml.XmlSlurper
67
import groovy.xml.slurpersupport.GPathResult
78

@@ -287,13 +288,19 @@ tasks.register("listAdminUsers") {
287288
config.useDatabase
288289
}
289290

291+
JsonSlurper jsonSlurper = new JsonSlurper()
292+
293+
String networkPorts = waitForCommand("docker inspect ${config.namespace}-liferay --format '{{ json .NetworkSettings.Ports }}'")
294+
295+
String tcp8080Port = jsonSlurper.parseText(networkPorts)["8080/tcp"][0]["HostPort"]
296+
290297
Closure<Void> listAdminUsersForCompany = {
291298
String companyId, String hostname, String webId, String schema ->
292299

293300
List results = executeSQLQuery("select screenName, emailAddress from User_ where companyId = ${companyId} and userId in (select userId from Users_Roles where roleId in (select roleId from Role_ where name = 'Administrator'))", schema)
294301

295-
println "\nhttp://${hostname}:8080/c/portal/login"
296-
println "http://${hostname}:8080/?p_p_id=com_liferay_login_web_portlet_LoginPortlet&p_p_lifecycle=0&p_p_state=exclusive&p_p_mode=view&_com_liferay_login_web_portlet_LoginPortlet_mvcRenderCommandName=%2Flogin%2Flogin&saveLastPath=false"
302+
println "\nhttp://${hostname}:${tcp8080Port}/c/portal/login"
303+
println "http://${hostname}:${tcp8080Port}/?p_p_id=com_liferay_login_web_portlet_LoginPortlet&p_p_lifecycle=0&p_p_state=exclusive&p_p_mode=view&_com_liferay_login_web_portlet_LoginPortlet_mvcRenderCommandName=%2Flogin%2Flogin&saveLastPath=false"
297304
println getDatabaseAccessCommand(schema)
298305

299306
if (results.isEmpty()) {

0 commit comments

Comments
 (0)