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

Update basic templates default Java version to JDK 17 #564

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

gdams
Copy link
Contributor

@gdams gdams commented Oct 4, 2024

Going forwards Jenkins will only support JDK17+ (https://www.jenkins.io/blog/2024/06/11/require-java-17/)

For Windows I switched from AdoptOpenJDK to Temurin (the new name for the project)

For Ubuntu I've changed to explicitly stating JDK17

Testing done

Submitter checklist

  • 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

gdams added 3 commits October 4, 2024 09:29
For Windows I switched from AdoptOpenJDK to Temurin (the new name for the project)

For Ubuntu we will need to change the apt-get install
@@ -1,6 +1,6 @@
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

choco install -y adoptopenjdk11
choco install -y temurin17
Copy link
Member

Choose a reason for hiding this comment

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

Looks like these scripts were broken by chocolatey 2, I'm testing a fix atm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had considered switching this to use winget:

winget install EclipseAdoptium.Temurin.17.JDK

Copy link
Member

Choose a reason for hiding this comment

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

winget is only available from window server 2022+ as far as I remember

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The alternative would be to use the Adoptium API directly

# Set the URL for the Adoptium API
$downloadUrl = "https://api.adoptium.net/v3/installer/latest/17/ga/windows/x64/jdk/hotspot/normal/eclipse"

# Specify the download location
$destination = "$env:TEMP\temurin17.msi"

# Download the JDK installer
Invoke-WebRequest -Uri $downloadUrl -OutFile $destination

# Install the JDK
Start-Process -FilePath msiexec.exe -ArgumentList "/i", $destination, "/quiet", "/norestart" -Wait

# Clean up the installer file
Remove-Item $destination

Copy link
Member

Choose a reason for hiding this comment

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

Probably ok but for now I've pinned chocolatey to 1.x and it worked:

image

Chocolatey 2.x requires .net 4.8 which isn't installed by default on
older windows and requires a reboot to install on those.
@@ -4,6 +4,6 @@ set -ex

# Install Java
sudo apt-get -y update
sudo apt-get install -y default-jdk
sudo apt-get install -y openjdk-17-jdk
Copy link
Member

Choose a reason for hiding this comment

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

worked:

    java.vm.name = OpenJDK 64-Bit Server VM
    java.vm.specification.name = Java Virtual Machine Specification
    java.vm.specification.vendor = Oracle Corporation
    java.vm.specification.version = 17
    java.vm.vendor = Ubuntu
    java.vm.version = 17.0.12+7-Ubuntu-1ubuntu220.04

@@ -128,7 +128,6 @@ public final class Constants {
public static final String WINDOWS_SERVER_2022 = "Windows Server 2022";
public static final String WINDOWS_SERVER_2019 = "Windows Server 2019";
public static final String WINDOWS_SERVER_2016 = "Windows Server 2016";
public static final String UBUNTU_1604_LTS = "Ubuntu 16.04 LTS";
Copy link
Member

Choose a reason for hiding this comment

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

openjdk-17-jdk is not available on Ubuntu 16, given its so far out of support I've removed it from the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make sense to me

@timja timja changed the title java: update installed version to JDK 17 Update basic templates default Java version to JDK 17 Oct 4, 2024
@timja timja merged commit 8043e8b into jenkinsci:master Oct 4, 2024
17 checks passed
@timja
Copy link
Member

timja commented Oct 4, 2024

Thanks!

@gdams gdams deleted the patch-1 branch October 4, 2024 09:22
@gdams
Copy link
Contributor Author

gdams commented Oct 4, 2024

Thanks!

when do you expect we will have a new release of this plugin?

@timja
Copy link
Member

timja commented Oct 4, 2024

next 5-10 mins or so i'd expect, its automated.

@timja
Copy link
Member

timja commented Oct 4, 2024

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

Successfully merging this pull request may close these issues.

2 participants