Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Allows to pass JAVA_OPTS to the JVM on windows #227

Merged
merged 74 commits into from
Nov 29, 2022

Conversation

Vlatombe
Copy link
Member

Just like the linux version

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Just like the linux version
@Vlatombe Vlatombe requested a review from a team as a code owner May 24, 2021 13:20
@Vlatombe Vlatombe changed the title Allows to pass JAVA_OPTS to the JVM Allows to pass JAVA_OPTS to the JVM on windows May 24, 2021
$AgentArguments = @()

if(![System.String]::IsNullOrWhiteSpace($JavaOpts)) {
$AgentArguments += @($JavaOpts.split(" "))
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Contributor

@Dohbedoh Dohbedoh Mar 9, 2022

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..

Per https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.2#parameters:

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

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

jenkins-agent.ps1 Outdated Show resolved Hide resolved
@dduportal
Copy link
Contributor

Ping @Vlatombe , what is the status of this PR? Do you need help to land it?

@Vlatombe
Copy link
Member Author

Vlatombe commented Nov 23, 2022

I have no plans to work on it. Needs some tests based on latest comments.

@slide
Copy link
Member

slide commented Nov 23, 2022

I will take this over, I think the feature would be useful. I'll try and get to it soon.

@dduportal
Copy link
Contributor

Thanks a lot @Vlatombe @slide for the update ❤️

MarkEWaite and others added 19 commits November 23, 2022 12:44
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>
github-actions bot and others added 10 commits November 23, 2022 12:44
…/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
@slide
Copy link
Member

slide commented Nov 24, 2022

Hmmm, that push did more than I thought...

@slide
Copy link
Member

slide commented Nov 24, 2022

I'm going to submit a new PR

@slide
Copy link
Member

slide commented Nov 24, 2022

Actually, I think this is fine.

Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

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

LGTM 👏

@slide slide enabled auto-merge November 29, 2022 02:42
@dduportal dduportal requested a review from slide November 29, 2022 08:24
@slide slide merged commit b537b5a into jenkinsci:master Nov 29, 2022
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this pull request Nov 28, 2023
…atombe/windows_javaopts

Allows to pass JAVA_OPTS to the JVM on windows
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.