Skip to content

Commit

Permalink
Use GraalVM Download Service's new latest GFTC URL (#1249)
Browse files Browse the repository at this point in the history
* WIP: use GDS download URLs

* Prepare for new GDS URLs

* Use GraalVM Download Service's new latest GFTC URL
  • Loading branch information
alvarosanchez authored Nov 12, 2024
1 parent 79c3b6c commit 0c48151
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal AS graalvm
ENV LANG=en_US.UTF-8
RUN dnf update -y && dnf install -y gcc glibc-devel zlib-devel libstdc++-static tar && dnf clean all && rm -rf /var/cache/dnf
RUN curl -4 -L https://download.oracle.com/graalvm/17/archive/graalvm-jdk-17.0.12_linux-aarch64_bin.tar.gz -o /tmp/graalvm.tar.gz \
RUN curl -4 -L https://gds.oracle.com/download/graal/17/latest-gftc/graalvm-jdk-17_linux-aarch64_bin.tar.gz -o /tmp/graalvm.tar.gz \
&& mkdir -p /usr/lib/graalvm \
&& tar -zxf /tmp/graalvm.tar.gz -C /usr/lib/graalvm --strip-components 1 \
&& rm -rf /tmp/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal AS graalvm
ENV LANG=en_US.UTF-8
RUN dnf update -y && dnf install -y gcc glibc-devel zlib-devel libstdc++-static tar && dnf clean all && rm -rf /var/cache/dnf
RUN curl -4 -L https://download.oracle.com/graalvm/17/archive/graalvm-jdk-17.0.12_linux-x64_bin.tar.gz -o /tmp/graalvm.tar.gz \
RUN curl -4 -L https://gds.oracle.com/download/graal/17/latest-gftc/graalvm-jdk-17_linux-x64_bin.tar.gz -o /tmp/graalvm.tar.gz \
&& mkdir -p /usr/lib/graalvm \
&& tar -zxf /tmp/graalvm.tar.gz -C /usr/lib/graalvm --strip-components 1 \
&& rm -rf /tmp/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal AS graalvm
ENV LANG=en_US.UTF-8
RUN dnf update -y && dnf install -y gcc glibc-devel zlib-devel libstdc++-static tar && dnf clean all && rm -rf /var/cache/dnf
RUN curl -4 -L https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-aarch64_bin.tar.gz -o /tmp/graalvm.tar.gz \
RUN curl -4 -L https://gds.oracle.com/download/graal/21/latest-gftc/graalvm-jdk-21_linux-aarch64_bin.tar.gz -o /tmp/graalvm.tar.gz \
&& mkdir -p /usr/lib/graalvm \
&& tar -zxf /tmp/graalvm.tar.gz -C /usr/lib/graalvm --strip-components 1 \
&& rm -rf /tmp/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal AS graalvm
ENV LANG=en_US.UTF-8
RUN dnf update -y && dnf install -y gcc glibc-devel zlib-devel libstdc++-static tar && dnf clean all && rm -rf /var/cache/dnf
RUN curl -4 -L https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz -o /tmp/graalvm.tar.gz \
RUN curl -4 -L https://gds.oracle.com/download/graal/21/latest-gftc/graalvm-jdk-21_linux-x64_bin.tar.gz -o /tmp/graalvm.tar.gz \
&& mkdir -p /usr/lib/graalvm \
&& tar -zxf /tmp/graalvm.tar.gz -C /usr/lib/graalvm --strip-components 1 \
&& rm -rf /tmp/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public abstract class AbstractDockerMojo extends AbstractMicronautMojo {
public static final String X86_64_ARCH = "x64";
public static final String DEFAULT_ORACLE_LINUX_VERSION = "ol9";
public static final String ORACLE_CLOUD_FUNCTION_DEFAULT_CMD = "CMD [\"io.micronaut.oraclecloud.function.http.HttpFunction::handleRequest\"]";
public static final String GRAALVM_DOWNLOAD_URL = "https://download.oracle.com/graalvm/%s/%s/graalvm-jdk-%s_linux-%s_bin.tar.gz";

//Latest version of GraalVM for JDK 17 available under the GraalVM Free Terms and Conditions (GFTC) licence
public static final String GRAALVM_FOR_JDK17 = "17.0.12";
public static final String GDS_DOWNLOAD_URL = "https://gds.oracle.com/download/graal/%s/latest-gftc/graalvm-jdk-%s_linux-%s_bin.tar.gz";

protected final MavenProject mavenProject;
protected final JibConfigurationService jibConfigurationService;
Expand Down Expand Up @@ -160,9 +157,9 @@ protected String graalVmJvmVersion() {
*/
protected String graalVmDownloadUrl() {
if (javaVersion().getMajorVersion() == 17) {
return GRAALVM_DOWNLOAD_URL.formatted(17, "archive", GRAALVM_FOR_JDK17, graalVmArch());
return GDS_DOWNLOAD_URL.formatted(17, 17, graalVmArch());
} else {
return GRAALVM_DOWNLOAD_URL.formatted(21, "latest", 21, graalVmArch());
return GDS_DOWNLOAD_URL.formatted(21, 21, graalVmArch());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class DockerNativeMojoTest {

@ParameterizedTest
@CsvSource({
"17,https://download.oracle.com/graalvm/17/archive/graalvm-jdk-17.0.12_linux-x64_bin.tar.gz",
"21,https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz"
"17,https://gds.oracle.com/download/graal/17/latest-gftc/graalvm-jdk-17_linux-x64_bin.tar.gz",
"21,https://gds.oracle.com/download/graal/21/latest-gftc/graalvm-jdk-21_linux-x64_bin.tar.gz"
})
@SetSystemProperty(key = "os.arch", value = X86_64_ARCH)
void testGraalVmDownloadUrl(String javaVersion, String expectedUrl) throws URISyntaxException, IOException, InterruptedException {
Expand All @@ -54,7 +54,9 @@ void testGraalVmDownloadUrl(String javaVersion, String expectedUrl) throws URISy

assertEquals(expectedUrl, actualUrl);

var client = HttpClient.newHttpClient();
var client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NORMAL)
.build();
var request = HttpRequest.newBuilder()
.uri(new URI(actualUrl))
.method("HEAD", HttpRequest.BodyPublishers.noBody())
Expand Down

0 comments on commit 0c48151

Please sign in to comment.