Skip to content

Commit

Permalink
Update basic templates default Java version to JDK 17 (#564)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
gdams and timja authored Oct 4, 2024
1 parent 7b9ec2e commit 8043e8b
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
4 changes: 3 additions & 1 deletion docs/init-scripts/windows-inbound-agent.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# choco 2.x requires .net 4.8 which is not installed by default and requires a reboot
$env:chocolateyVersion = '1.4.0'
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

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

Expand Down
4 changes: 3 additions & 1 deletion docs/init-scripts/windows-ssh.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# choco 2.x requires .net 4.8 which is not installed by default and requires a reboot
$env:chocolateyVersion = '1.4.0'
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

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ public void cleanDeployments(long successTimeoutInMinutes, long failTimeoutInMin
deploymentsToClean.add(info);
}
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to get/delete deployment: {0}", e);
LOGGER.log(Level.WARNING, String.format("Failed to get/delete deployment: %s",
info.getDeploymentName()), e);

Check warning on line 273 in src/main/java/com/microsoft/azure/vmagent/AzureVMAgentCleanUpTask.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 272-273 are not covered by tests
// Check the number of attempts remaining. If greater than 0, decrement
// and add back into the queue.
if (info.hasAttemptsRemaining()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,7 @@ public static String getBasicInitScript(AzureVMAgentTemplate template) {
AzureVMManagementServiceDelegate.PRE_INSTALLED_TOOLS_SCRIPT
.get(builtInImage).get(Constants.INSTALL_GIT));
}
if ((builtInImage.equals(Constants.UBUNTU_1604_LTS)
|| builtInImage.equals(Constants.UBUNTU_2004_LTS)
if ((builtInImage.equals(Constants.UBUNTU_2004_LTS)

Check warning on line 769 in src/main/java/com/microsoft/azure/vmagent/AzureVMAgentTemplate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 769 is not covered by tests
|| builtInImage.equals(Constants.UBUNTU_2204_LTS))
&& template.isInstallDocker()) {
stringBuilder.append(getSeparator(template.getOsType()));
Expand Down Expand Up @@ -1744,7 +1743,6 @@ public ListBoxModel doFillBuiltInImageItems() {
ListBoxModel model = new ListBoxModel();
model.add(Constants.UBUNTU_2204_LTS);
model.add(Constants.UBUNTU_2004_LTS);
model.add(Constants.UBUNTU_1604_LTS);
model.add(Constants.WINDOWS_SERVER_2022);
model.add(Constants.WINDOWS_SERVER_2019);
model.add(Constants.WINDOWS_SERVER_2016);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1569,8 +1569,6 @@ private static Map<String, Map<String, String>> getDefaultImageProperties() {
imageProperties("MicrosoftWindowsServer", "WindowsServer", "2019-Datacenter", "2019-Datacenter-with-Containers", Constants.OS_TYPE_WINDOWS));
imageProperties.put(Constants.WINDOWS_SERVER_2022,
imageProperties("MicrosoftWindowsServer", "WindowsServer", "2022-datacenter-azure-edition-core", "2022-datacenter-azure-edition-core", Constants.OS_TYPE_WINDOWS));
imageProperties.put(Constants.UBUNTU_1604_LTS,
imageProperties("Canonical", "UbuntuServer", "16.04-LTS", "16.04-LTS", Constants.OS_TYPE_LINUX));
imageProperties.put(Constants.UBUNTU_2004_LTS,
imageProperties("canonical", "0001-com-ubuntu-server-focal", "20_04-lts-gen2", "20_04-lts-gen2", Constants.OS_TYPE_LINUX));
imageProperties.put(Constants.UBUNTU_2204_LTS,
Expand Down Expand Up @@ -1602,14 +1600,12 @@ private static Map<String, Map<String, String>> getPreInstalledToolsScript() {
tools.put(Constants.WINDOWS_SERVER_2016, new HashMap<>());
tools.put(Constants.WINDOWS_SERVER_2019, new HashMap<>());
tools.put(Constants.WINDOWS_SERVER_2022, new HashMap<>());
tools.put(Constants.UBUNTU_1604_LTS, new HashMap<>());
tools.put(Constants.UBUNTU_2004_LTS, new HashMap<>());
tools.put(Constants.UBUNTU_2204_LTS, new HashMap<>());
try {
windows(Constants.WINDOWS_SERVER_2016, tools);
windows(Constants.WINDOWS_SERVER_2019, tools);
windows(Constants.WINDOWS_SERVER_2022, tools);
ubuntu(Constants.UBUNTU_1604_LTS, tools);
ubuntu(Constants.UBUNTU_2004_LTS, tools);
ubuntu(Constants.UBUNTU_2204_LTS, tools);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
public static final String UBUNTU_2004_LTS = "Ubuntu 20.04 LTS";
public static final String UBUNTU_2204_LTS = "Ubuntu 22.04 LTS";

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/scripts/ubuntuInstallJavaScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

java -version
4 changes: 3 additions & 1 deletion src/main/resources/scripts/windowsInstallJavaScript.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# choco 2.x requires .net 4.8 which is not installed by default and requires a reboot
$env:chocolateyVersion = '1.4.0'
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

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/help-osType.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Enter an os type of the image family the template is for.<br><br>

e.g. <b>For the image family</b><br>
&nbsp;&nbsp;&nbsp;&nbsp;1. Ubuntu Server 16.04 LTS: specify &quot;Linux&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;2. Windows Server 2016 Datacenter: specify &quot;Windows&quot;<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;1. Ubuntu Server 22.04 LTS: specify &quot;Linux&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;2. Windows Server 2019 Datacenter: specify &quot;Windows&quot;<br><br>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ protected VirtualMachine createAzureVM(final String vmName, final String tagName
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIPAddressDynamic()
.withoutPrimaryPublicIPAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_20_04_LTS)
.withRootUsername(TestEnvironment.GenerateRandomString(8))
.withRootPassword(TestEnvironment.GenerateRandomString(16) + "AA@@12345@#$%^&*-_!+=[]{}|\\:`,.?/~\\\"();\'") //don't try this at home
.withOSDiskStorageAccountType(StorageAccountTypes.STANDARD_LRS)
Expand Down

0 comments on commit 8043e8b

Please sign in to comment.