From 7fa2c923db80154e98015c0f2c0f4d61f4eec529 Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Fri, 19 Sep 2025 09:52:15 -0500 Subject: [PATCH 01/10] LPD-65679 removes duplicates --- scripts/cli/lec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index 750f2f6..9cf894f 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -229,7 +229,7 @@ _listReleases() { jq '.[].releaseKey' -r "${RELEASES_JSON_FILE}" } _listRunningProjects() { - docker compose ls --format=json | jq -r '.[] | .ConfigFiles' | sed 's@,@\n@g' | grep compose-recipes | sed 's,/compose-recipes/.*,,g' + docker compose ls --format=json | jq -r '.[] | .ConfigFiles' | sed 's@,@\n@g' | grep compose-recipes | sed 's,/compose-recipes/.*,,g' | sort -u } _listWorktrees() { _git worktree list --porcelain | grep worktree | awk '{print $2}' From 2d735b6a2e81651f181145d693dce2c6bb0f63bb Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Wed, 24 Sep 2025 10:12:21 -0500 Subject: [PATCH 02/10] LPD-66521 if $HOME/.liferay/workspace does not exist, create it before calling curl --- scripts/cli/lec.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index 9cf894f..da4a57a 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -194,13 +194,20 @@ _checkCWDProject() { # Download releases.json file if it is missing or out of date # -RELEASES_JSON_FILE="$HOME/.liferay/workspace/releases.json" +LIFERAY_WORKSPACE_HOME="$HOME/.liferay/workspace" + +RELEASES_JSON_FILE="${LIFERAY_WORKSPACE_HOME}/releases.json" + _checkReleasesJsonFile() { local curl_cmd local etag_status_code - local releases_json_etag_file="$HOME/.liferay/workspace/releases-json.etag" + local releases_json_etag_file="${LIFERAY_WORKSPACE_HOME}/releases-json.etag" local releases_json_url="https://releases-cdn.liferay.com/releases.json" + if [[ ! -d "${LIFERAY_WORKSPACE_HOME}" ]]; then + mkdir -p "${LIFERAY_WORKSPACE_HOME}" + fi + curl_cmd=(curl --silent --output "${RELEASES_JSON_FILE}" --etag-save "${releases_json_etag_file}" "${releases_json_url}") if [[ ! -f "${RELEASES_JSON_FILE}" ]]; then From 445a8f14c155d4557ae67f76fbd224f658b19f89 Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Wed, 24 Sep 2025 12:16:06 -0500 Subject: [PATCH 03/10] LPD-66537 uses compgen's built-in filtering, and only looks for shell functions --- scripts/cli/lec.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index da4a57a..69b69f2 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -227,8 +227,23 @@ _checkReleasesJsonFile() { # Helper functions to list information # -_listCommands() { - compgen -c | grep "^cmd_" | sed "s/^cmd_//g" +_listFunctions() { + local prefix="${1}" + + compgen -A function "${prefix}" +} + +_listPrefixedFunctions() { + local prefix="${1:?Prefix required}" + + _listFunctions "${prefix}" | sed "s/^${prefix}//g" +} + +_listPrivateCommands() { + _listPrefixedFunctions "_cmd_" +} +_listPublicCommands() { + _listPrefixedFunctions "cmd_" } _listReleases() { _checkReleasesJsonFile @@ -249,12 +264,12 @@ _listWorktrees() { _getClosestCommand() { local command="${1}" - _listCommands | fzf --bind="load:accept" --exit-0 --height 30% --reverse --select-1 --query "${command}" + _listPublicCommands | fzf --bind="load:accept" --exit-0 --height 30% --reverse --select-1 --query "${command}" } _verifyCommand() { local command="${1}" - _listCommands | grep -q "^${command}$" + _listPublicCommands | grep -q "^${command}$" } # @@ -317,13 +332,13 @@ _cmd_commands() { _bold "Public Commands" echo - _listCommands + _listPublicCommands echo _bold "Private Commands" echo - compgen -c | grep "^_cmd_" | sed "s/^_cmd_//g" + _listPrivateCommands } _cmd_gw() { _checkCWDProject From faed6125f0f1ac37dff26db7d3797efff00db735 Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Wed, 24 Sep 2025 12:17:28 -0500 Subject: [PATCH 04/10] LPD-66537 (unrelated) adds helper function to invoke an arbitrary function for testing --- scripts/cli/lec.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index 69b69f2..210ff31 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -349,6 +349,9 @@ _cmd_gw() { ./gradlew "${@}" ) } +_cmd_fn() { + "${1}" "${@:2}" +} _cmd_list() { _listWorktrees } From fe32d3bcafada125a475fa8de27ad8be79540974 Mon Sep 17 00:00:00 2001 From: Minhchau Date: Wed, 24 Sep 2025 12:47:00 +0900 Subject: [PATCH 05/10] LPD-66454 Prune deleted worktrees --- scripts/cli/lec.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index 210ff31..bf1e74e 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -379,6 +379,11 @@ _cmd_setVersion() { # cmd_clean() { + cd "$(dirname ${0})" + _print_step "Removing manually deleted worktrees" + git worktree prune + cd - + _checkCWDProject ( From 299030d2875b8cb3a4c586e0f9e403de3fc043b9 Mon Sep 17 00:00:00 2001 From: Minhchau Date: Wed, 24 Sep 2025 12:47:38 +0900 Subject: [PATCH 06/10] LPD-66454 Adjust phrasing, since environment composer can be used for any ticket --- scripts/cli/lec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index bf1e74e..69cf2cd 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -405,7 +405,7 @@ cmd_init() { local worktree_name if [[ -z "${ticket}" ]]; then - _prompt "LPP ticket number: " ticket + _prompt "ticket number: " ticket fi _cancelIfEmpty "${ticket}" From 7ffa1ae78703b32fcf7fb8d058462ce6915037a2 Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Wed, 24 Sep 2025 21:04:25 -0500 Subject: [PATCH 07/10] LPD-66454 simplify - uses helper method to run git commands on the main repo dir --- scripts/cli/lec.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index 69cf2cd..e1f59cd 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -379,10 +379,8 @@ _cmd_setVersion() { # cmd_clean() { - cd "$(dirname ${0})" _print_step "Removing manually deleted worktrees" - git worktree prune - cd - + _git worktree prune _checkCWDProject From ed2a35fe23da4335dbea76ec613ae9611e142d43 Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Wed, 24 Sep 2025 21:09:24 -0500 Subject: [PATCH 08/10] LPD-66454 SF: capitalize --- scripts/cli/lec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index e1f59cd..03ef14f 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -403,7 +403,7 @@ cmd_init() { local worktree_name if [[ -z "${ticket}" ]]; then - _prompt "ticket number: " ticket + _prompt "Ticket number: " ticket fi _cancelIfEmpty "${ticket}" From 6a1c9e0d3fc7651934a5ac5dd4c299433adffc9d Mon Sep 17 00:00:00 2001 From: Minhchau Date: Wed, 24 Sep 2025 16:28:25 +0900 Subject: [PATCH 09/10] LPD-66479 Add clustering license check when clustering is enabled --- .../main/groovy/docker-liferay-bundle.gradle | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/groovy/docker-liferay-bundle.gradle b/buildSrc/src/main/groovy/docker-liferay-bundle.gradle index 52f7756..fedc138 100644 --- a/buildSrc/src/main/groovy/docker-liferay-bundle.gradle +++ b/buildSrc/src/main/groovy/docker-liferay-bundle.gradle @@ -27,16 +27,31 @@ Closure isValidLicenseFile = { return false } + String invalidLicenseReason = null + XmlSlurper xmlSlurper = new XmlSlurper() GPathResult gPathResult = xmlSlurper.parse(licenseFile) + + if (config.useClustering) { + String licenseType = gPathResult["license-type"].text() + + if (["developer", "limited", "trial"].contains(licenseType)) { + invalidLicenseReason = "Clustering is enabled, but ${licenseType} license file ${licenseFile.absolutePath} cannot be used in a clustered environment" + } + } + String expirationDateText = gPathResult["expiration-date"].text() - if (new Date(expirationDateText).after(new Date())) { + if (new Date(expirationDateText).before(new Date())) { + invalidLicenseReason = "License file ${licenseFile.absolutePath} expired on ${expirationDateText}" + } + + if (invalidLicenseReason == null) { return true } - println "License file ${licenseFile.absolutePath} expired on ${expirationDateText}" + println invalidLicenseReason licenseFile.delete() @@ -91,7 +106,7 @@ Closure getLatestImageNameLocal = { Closure copyLiferayLicenseFromDXPImage = { String imageName, boolean pullImage = false -> - if ((imageName == null) || !(imageName.contains(".q") || imageName.contains("latest"))) { + if ((config.useClustering || imageName == null) || !(imageName.contains(".q") || imageName.contains("latest"))) { return null } @@ -166,6 +181,10 @@ tasks.register("checkForLiferayLicense") { } if (Util.isEmpty(licenseXmlFileCollection)) { + if (config.useClustering) { + throw new GradleException("Please add a non-expired license that allows for clustering to configs/common/osgi/modules/") + } + throw new GradleException("Please add a non-expired license to configs/common/osgi/modules/") } } From c211a4e5af8d5032e13ecb605c841a3ab1850615 Mon Sep 17 00:00:00 2001 From: Drew Brokke Date: Wed, 24 Sep 2025 21:49:44 -0500 Subject: [PATCH 10/10] LPD-66479 no need to group the conditions --- buildSrc/src/main/groovy/docker-liferay-bundle.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/docker-liferay-bundle.gradle b/buildSrc/src/main/groovy/docker-liferay-bundle.gradle index fedc138..81771d5 100644 --- a/buildSrc/src/main/groovy/docker-liferay-bundle.gradle +++ b/buildSrc/src/main/groovy/docker-liferay-bundle.gradle @@ -106,7 +106,7 @@ Closure getLatestImageNameLocal = { Closure copyLiferayLicenseFromDXPImage = { String imageName, boolean pullImage = false -> - if ((config.useClustering || imageName == null) || !(imageName.contains(".q") || imageName.contains("latest"))) { + if (config.useClustering || (imageName == null) || !(imageName.contains(".q") || imageName.contains("latest"))) { return null }