Skip to content

Fixed misleading expansion variable log message in ci.common - #532

Open
sajeerzeji wants to merge 4 commits into
OpenLiberty:1.xfrom
sajeerzeji:fix/GHMVN2076-Message_update
Open

Fixed misleading expansion variable log message in ci.common#532
sajeerzeji wants to merge 4 commits into
OpenLiberty:1.xfrom
sajeerzeji:fix/GHMVN2076-Message_update

Conversation

@sajeerzeji

Copy link
Copy Markdown
Contributor

Fixes OpenLiberty/ci.maven#2076

Reference: OpenLiberty/ci.maven#2076 (comment)

Moved the log call to after the full string is assembled, so the complete resolved path is shown, and updates the message format to clearly state which variable was expanded, the original expression it appeared in, and the fully resolved result. The corresponding IT assertions in ci.maven and ci.gradle are updated to match the new message format.

@sajeerzeji
sajeerzeji requested a review from venmanyarun August 13, 2026 08:48
@sajeerzeji
sajeerzeji changed the base branch from main to 1.x August 13, 2026 08:49
@venmanyarun
venmanyarun requested a review from cherylking August 19, 2026 12:52
…alue instead of the full expression buffer by moving the log call inside the while loop.
@sajeerzeji
sajeerzeji requested a review from cherylking August 20, 2026 11:04
}
matcher.appendReplacement(sb, Matcher.quoteReplacement(finalReplacement));
log.info(String.format("Resolving Property %s for expression %s. Resolved expression value is %s", varName , value , sb));
log.info(String.format("Resolved environment variable \"%s\" in path \"%s\" to \"%s\"", varName, value, finalReplacement));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this log message here with the replaced value for the variable is good, but to address the original issue I think you also need a single log message at the end showing what the complete replaced value is. My other comment was about how having a for loop for the variables at the end repeating the same complete value did not make sense. But having a single log message with the complete value would be valuable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one full line log at the end to show which one got replaced with what. Also shown the sample logs captured from my local in this comment #532 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ci.maven and ci.gradle IT assertions are updated too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@sajeerzeji

Copy link
Copy Markdown
Contributor Author

Below are the logs captured in different scenarios

Scenario 1: single variable

[INFO] Resolved environment variable "BASE" in path "${BASE}/bin" to "/usr/local/java"
[INFO] Resolved path "${BASE}/bin" to "/usr/local/java/bin"

Scenario 2: two variables combined

[INFO] Resolved environment variable "EXP_VAR" in path "${EXP_VAR}_${EXP_VAR2}" to "TEST"
[INFO] Resolved environment variable "EXP_VAR2" in path "${EXP_VAR}_${EXP_VAR2}" to "UNIX"
[INFO] Resolved path "${EXP_VAR}_${EXP_VAR2}" to "TEST_UNIX"

Scenario 3: recursive

[INFO] Resolved environment variable "ROOT" in path "${ROOT}/semeru" to "/opt/ibm"
[INFO] Resolved path "${ROOT}/semeru" to "/opt/ibm/semeru"
[INFO] Resolved environment variable "ROOT" in path "${ROOT}/semeru" to "/opt/ibm"
[INFO] Resolved path "${ROOT}/semeru" to "/opt/ibm/semeru"
[INFO] Resolved environment variable "JDK" in path "${JDK}/bin" to "/opt/ibm/semeru"
[INFO] Resolved path "${JDK}/bin" to "/opt/ibm/semeru/bin"

NOTE: ${ROOT}/semeru appears twice because it's resolved once for JDK and again when resolving JAVA_HOME_DERIVED through JDK

@sajeerzeji
sajeerzeji requested a review from cherylking August 21, 2026 07:40
}
matcher.appendReplacement(sb, Matcher.quoteReplacement(finalReplacement));
log.info(String.format("Resolving Property %s for expression %s. Resolved expression value is %s", varName , value , sb));
log.info(String.format("Resolved environment variable \"%s\" in path \"%s\" to \"%s\"", varName, value, finalReplacement));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SVT:Expansion variables needs an improvement for windows

3 participants