Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-69304] Allow specifying a java path #766

Merged
merged 16 commits into from
Aug 25, 2022

Conversation

lemeurherve
Copy link
Member

@lemeurherve lemeurherve commented Aug 17, 2022

Cf https://issues.jenkins.io/browse/JENKINS-69304 and jenkins-infra/helpdesk#3090, this PR add a "javaPath" option.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main 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

@lemeurherve lemeurherve marked this pull request as ready for review August 17, 2022 17:24
final String jvmopts = node.jvmopts;
final String remoteFS = WindowsUtil.quoteArgument(node.getRemoteFS());
final String workDir = Util.fixEmptyAndTrim(remoteFS) != null ? remoteFS : tmpDir;
final String launchString = "java " + (jvmopts != null ? jvmopts : "") + " -jar " + tmpDir + AGENT_JAR + " -workDir " + workDir;
final String launchString = javaPath + " " + (jvmopts != null ? jvmopts : "") + " -jar " + tmpDir + AGENT_JAR + " -workDir " + workDir;
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: unlike the Mac & Unix versions, this launcher doesn't allow specifying command prefix or suffix

@@ -510,6 +520,7 @@ public SlaveTemplate(String ami, String zone, SpotConfiguration spotConfig, Stri
monitoring, t2Unlimited, ConnectionStrategy.backwardsCompatible(usePrivateDnsName, connectUsingPublicIp, associatePublicIp), -1);
}

@Deprecated
Copy link
Member Author

@lemeurherve lemeurherve Aug 17, 2022

Choose a reason for hiding this comment

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

Added these @Deprecated annotations to what seem to me similar deprecated constructors. (I might be wrong)

@lemeurherve lemeurherve marked this pull request as draft August 17, 2022 19:31
@lemeurherve lemeurherve marked this pull request as ready for review August 17, 2022 22:46
@lemeurherve lemeurherve marked this pull request as draft August 17, 2022 22:53
@lemeurherve lemeurherve marked this pull request as ready for review August 17, 2022 23:22
@alecharp
Copy link
Member

@fcojfernandez would you have time to review this? Thanks.

@lemeurherve
Copy link
Member Author

Manually tested an incremental on infra.ci.jenkins.io ✅

lemeurherve added a commit to jenkins-infra/docker-jenkins-weeklyci that referenced this pull request Aug 18, 2022
* chore: try ec2-plugin with `javaPath` option

Ref: jenkinsci/ec2-plugin#766

* include last fix and dependencies needed for this incremental ec2-plugin version (https://plugins.jenkins.io/ec2/#dependencies)

* remove plugins already present

* fix bounty-castle dependency

Plugin workflow-basic-steps:991.v43d80fea_ff66 (via mailer:438.v02c7f0a_12fa_4->instance-identity:116.vf8f487400980) depends on bouncycastle-api:2.26, but there is an older version defined on the top level - bouncycastle-api:2.25

* fix more dependencies

* fix incremental syntax

* no .workflow (?)

* add missing incremental branch ref

* drop ec2 prefix from the incremental version

Co-authored-by: Devin Nusbaum <dwnusbaum@users.noreply.github.com>

* more dependency fixes

Co-authored-by: Devin Nusbaum <dwnusbaum@users.noreply.github.com>
lemeurherve pushed a commit to lemeurherve/kubernetes-management that referenced this pull request Aug 18, 2022
lemeurherve added a commit to jenkins-infra/kubernetes-management that referenced this pull request Aug 18, 2022
* fix: use ec2-plugin 'javaPath' option instead of command prefix

Should fix Windows (which can't have command prefix)

Ref:
- jenkinsci/ec2-plugin#766
- jenkins-infra/helpdesk#3090
- jenkins-infra/docker-jenkins-weeklyci#565

* fix: use slash instead of antislash for Windows paths

* add missing .exe extension for the Windows javaPath
@res0nance res0nance added the enhancement Feature additions or enhancements label Aug 25, 2022
@res0nance res0nance merged commit 33e4f99 into jenkinsci:master Aug 25, 2022
lemeurherve added a commit to jenkins-infra/docker-jenkins-weeklyci that referenced this pull request Aug 25, 2022
As jenkinsci/ec2-plugin#766 has been merged, this PR revert the incremental introduced in #565
@Hentheroot
Copy link

Hentheroot commented Aug 28, 2022

Hi, all very nice. But if you keep 'javaPath' empty (like me) I expect the system does a 'which java' to selfdetect the java binary.
Because now I kept it empty the launch of an EC2 failed so I was under the impression version 2.0.0 had a bug so I rolled back.

@res0nance
Copy link
Contributor

Hi, all very nice. But if you keep 'javaPath' empty (like me) I expect the system does a 'which java' to selfdetect the java binary. Because now I kept it empty the launch of an EC2 failed so I was under the impression version 2.0.0 had a bug so I rolled back.

Has the 2.0.1 version resolved this for you?

@Hentheroot
Copy link

Has the 2.0.1 version resolved this for you?

Yes it did. Thanks for the quick fix.

lemeurherve added a commit to lemeurherve/kubernetes-management that referenced this pull request Aug 31, 2022
…ins-infra#2721)

* fix: use ec2-plugin 'javaPath' option instead of command prefix

Should fix Windows (which can't have command prefix)

Ref:
- jenkinsci/ec2-plugin#766
- jenkins-infra/helpdesk#3090
- jenkins-infra/docker-jenkins-weeklyci#565

* fix: use slash instead of antislash for Windows paths

* add missing .exe extension for the Windows javaPath
lemeurherve added a commit to lemeurherve/kubernetes-management that referenced this pull request Sep 1, 2022
…ins-infra#2721)

* fix: use ec2-plugin 'javaPath' option instead of command prefix

Should fix Windows (which can't have command prefix)

Ref:
- jenkinsci/ec2-plugin#766
- jenkins-infra/helpdesk#3090
- jenkins-infra/docker-jenkins-weeklyci#565

* fix: use slash instead of antislash for Windows paths

* add missing .exe extension for the Windows javaPath
@basil basil mentioned this pull request Sep 20, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature additions or enhancements
Projects
None yet
5 participants