-
-
Notifications
You must be signed in to change notification settings - Fork 528
Allows to pass JAVA_OPTS to the JVM on windows #227
Conversation
Just like the linux version
jenkins-agent.ps1
Outdated
$AgentArguments = @() | ||
|
||
if(![System.String]::IsNullOrWhiteSpace($JavaOpts)) { | ||
$AgentArguments += @($JavaOpts.split(" ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the JavaOpts contains a quoted string with spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it doesn't work. I found some scripts like https://github.com/beatcracker/Powershell-Misc/blob/master/Split-CommandLine.ps1 that would be able to do the splitting correctly but I don't have the correct environment to test it atm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can test out when I am back from my vacation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually necessary to split it ? maybe it can just be added as is..
Arguments can be accepted as a single string with the arguments separated by spaces, or as an array of strings separated by commas. The cmdlet joins the array into a single string with each element of the array separated by a single space.
The outer quotes of the PowerShell strings are not included when the ArgumentList values are passed to the new process. If parameters or parameter values contain a space or quotes, they need to be surrounded with escaped double quotes. For more information, see [about_Quoting_Rules](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.2).
So we should be able to do something like this no ?
if (![System.String]::IsNullOrWhiteSpace($javaOpts)) {
$AgentArguments += @(`"$javaOpts`")
}
I haven't tested that but noticed this as part of #261
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the whole $AgentArguments
should be a string in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible to write a test for this?
https://github.com/jenkinsci/docker-inbound-agent/blob/master/tests/inboundAgent.Tests.ps1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nice, this wasn't there when I initially wrote this PR. Will have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For info: jenkins-infra/helpdesk#3274
Ping @Vlatombe , what is the status of this PR? Do you need help to land it? |
I have no plans to work on it. Needs some tests based on latest comments. |
I will take this over, I think the feature would be useful. I'll try and get to it soon. |
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
https://github.com/jenkinsci/docker-agent/releases/tag/4.13-2 lists: * fix: enable long paths for git in Windows images (jenkinsci#239) @lemeurherve * Use git lfs 3.1.4, not 3.1.2 (#246) @MarkEWaite * Use Java 17.0.2_8, not 17_35 on Nanoserver (jenkinsci#245) @MarkEWaite * Use git 2.35.3 for Windows (jenkinsci#244) @MarkEWaite * Use remoting 4.13, not 4.12 (jenkinsci#243) @MarkEWaite * Use Alpine 3.15.4, not 3.15.0 (#242) @MarkEWaite * Bump debian from bullseye-20220228 to bullseye-20220328 in /11/bullseye (#237, jenkinsci#240) @dependabot * Bump debian from bullseye-20220228 to bullseye-20220328 in /8/bullseye (jenkinsci#236, jenkinsci#241) @dependabot
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
Pipeline will compute it based on tag string
Co-authored-by: Damien Duportal <damien.duportal@gmail.com>
Closes #272 Bumps version of upstream image too
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
…/d... ... ocker-inbound-agent/11/debian/Dockerfile" Made with ❤️️ by updatecli
Hmmm, that push did more than I thought... |
I'm going to submit a new PR |
Actually, I think this is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👏
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
…atombe/windows_javaopts Allows to pass JAVA_OPTS to the JVM on windows
Just like the linux version