mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.7.x' into 3.0.x
Closes gh-37739
This commit is contained in:
commit
30af19acc2
@ -34,6 +34,7 @@ dependencies {
|
|||||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.11.4")
|
implementation("com.fasterxml.jackson.core:jackson-databind:2.11.4")
|
||||||
implementation("com.gradle:gradle-enterprise-gradle-plugin:3.12.1")
|
implementation("com.gradle:gradle-enterprise-gradle-plugin:3.12.1")
|
||||||
implementation("com.tngtech.archunit:archunit:1.0.0")
|
implementation("com.tngtech.archunit:archunit:1.0.0")
|
||||||
|
implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.5.0")
|
||||||
implementation("commons-codec:commons-codec:1.13")
|
implementation("commons-codec:commons-codec:1.13")
|
||||||
implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}")
|
implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}")
|
||||||
implementation("org.apache.maven:maven-embedder:3.6.2")
|
implementation("org.apache.maven:maven-embedder:3.6.2")
|
||||||
|
@ -7,6 +7,7 @@ outputs:
|
|||||||
- name: git-repo
|
- name: git-repo
|
||||||
caches:
|
caches:
|
||||||
- path: gradle
|
- path: gradle
|
||||||
|
- path: build/downloads
|
||||||
- path: embedmongo
|
- path: embedmongo
|
||||||
params:
|
params:
|
||||||
BRANCH:
|
BRANCH:
|
||||||
|
@ -2,10 +2,14 @@ plugins {
|
|||||||
id "java"
|
id "java"
|
||||||
id "org.springframework.boot.conventions"
|
id "org.springframework.boot.conventions"
|
||||||
id "org.springframework.boot.integration-test"
|
id "org.springframework.boot.integration-test"
|
||||||
|
id "de.undercouch.download"
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Spring Boot Launch Script Integration Tests"
|
description = "Spring Boot Launch Script Integration Tests"
|
||||||
|
|
||||||
|
def jdkVersion = "17.0.8.1+1"
|
||||||
|
def jdkArch = "aarch64".equalsIgnoreCase(System.getProperty("os.arch")) ? "aarch64" : "amd64"
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
@ -38,6 +42,26 @@ task buildApp(type: GradleBuild) {
|
|||||||
tasks = ["build"]
|
tasks = ["build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task downloadJdk(type: Download) {
|
||||||
|
def destFolder = new File(rootProject.buildDir, "downloads/jdk/bellsoft")
|
||||||
|
destFolder.mkdirs()
|
||||||
|
src "https://download.bell-sw.com/java/${jdkVersion}/bellsoft-jdk${jdkVersion}-linux-${jdkArch}.tar.gz"
|
||||||
|
dest destFolder
|
||||||
|
tempAndMove true
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
task syncJdkDownloads(type: Sync) {
|
||||||
|
dependsOn downloadJdk
|
||||||
|
from "${rootProject.buildDir}/downloads/jdk/bellsoft/"
|
||||||
|
include "bellsoft-jdk${jdkVersion}-linux-${jdkArch}.tar.gz"
|
||||||
|
into "${project.buildDir}/downloads/jdk/bellsoft/"
|
||||||
|
}
|
||||||
|
|
||||||
|
processIntTestResources {
|
||||||
|
dependsOn syncJdkDownloads
|
||||||
|
}
|
||||||
|
|
||||||
intTest {
|
intTest {
|
||||||
dependsOn buildApp
|
dependsOn buildApp
|
||||||
}
|
}
|
@ -17,12 +17,9 @@
|
|||||||
package org.springframework.boot.launchscript;
|
package org.springframework.boot.launchscript;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.assertj.core.api.Condition;
|
import org.assertj.core.api.Condition;
|
||||||
@ -50,11 +47,6 @@ import static org.hamcrest.Matchers.containsString;
|
|||||||
*/
|
*/
|
||||||
abstract class AbstractLaunchScriptIntegrationTests {
|
abstract class AbstractLaunchScriptIntegrationTests {
|
||||||
|
|
||||||
private static final Map<Architecture, URI> JAVA_DOWNLOAD_URLS = Map.of(Architecture.AMD64,
|
|
||||||
URI.create("https://download.bell-sw.com/java/17.0.8.1+1/bellsoft-jdk17.0.8.1+1-linux-amd64.tar.gz"),
|
|
||||||
Architecture.AARCH64,
|
|
||||||
URI.create("https://download.bell-sw.com/java/17.0.8.1+1/bellsoft-jdk17.0.8.1+1-linux-aarch64.tar.gz"));
|
|
||||||
|
|
||||||
protected static final char ESC = 27;
|
protected static final char ESC = 27;
|
||||||
|
|
||||||
private final String scriptsDir;
|
private final String scriptsDir;
|
||||||
@ -108,9 +100,7 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
|||||||
private static final class LaunchScriptTestContainer extends GenericContainer<LaunchScriptTestContainer> {
|
private static final class LaunchScriptTestContainer extends GenericContainer<LaunchScriptTestContainer> {
|
||||||
|
|
||||||
private LaunchScriptTestContainer(String os, String version, String scriptsDir, String testScript) {
|
private LaunchScriptTestContainer(String os, String version, String scriptsDir, String testScript) {
|
||||||
super(new ImageFromDockerfile("spring-boot-launch-script/" + os.toLowerCase() + "-" + version)
|
super(createImage(os, version));
|
||||||
.withDockerfile(Paths.get("src/intTest/resources/conf/" + os + "/" + version + "/Dockerfile"))
|
|
||||||
.withBuildArg("JAVA_DOWNLOAD_URL", getJavaDownloadUrl()));
|
|
||||||
withCopyFileToContainer(MountableFile.forHostPath(findApplication().getAbsolutePath()), "/app.jar");
|
withCopyFileToContainer(MountableFile.forHostPath(findApplication().getAbsolutePath()), "/app.jar");
|
||||||
withCopyFileToContainer(
|
withCopyFileToContainer(
|
||||||
MountableFile.forHostPath("src/intTest/resources/scripts/" + scriptsDir + "test-functions.sh"),
|
MountableFile.forHostPath("src/intTest/resources/scripts/" + scriptsDir + "test-functions.sh"),
|
||||||
@ -123,14 +113,15 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
|||||||
withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(5)));
|
withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getJavaDownloadUrl() {
|
private static ImageFromDockerfile createImage(String os, String version) {
|
||||||
Architecture architecture = Architecture.current();
|
ImageFromDockerfile image = new ImageFromDockerfile(
|
||||||
Assert.notNull(architecture,
|
"spring-boot-launch-script/" + os.toLowerCase() + "-" + version);
|
||||||
() -> String.format("Failed to find current architecture. Value of os.arch is: '%s'",
|
image.withFileFromFile("Dockerfile",
|
||||||
System.getProperty("os.arch")));
|
new File("src/intTest/resources/conf/" + os + "/" + version + "/Dockerfile"));
|
||||||
URI uri = JAVA_DOWNLOAD_URLS.get(architecture);
|
for (File file : new File("build/downloads/jdk/bellsoft").listFiles()) {
|
||||||
Assert.notNull(uri, () -> String.format("No JDK download URL for architecture %s found", architecture));
|
image.withFileFromFile("downloads/" + file.getName(), file);
|
||||||
return uri.toString();
|
}
|
||||||
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File findApplication() {
|
private static File findApplication() {
|
||||||
@ -142,30 +133,4 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum Architecture {
|
|
||||||
|
|
||||||
AMD64, AARCH64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current architecture.
|
|
||||||
* @return the current architecture or {@code null}
|
|
||||||
*/
|
|
||||||
static Architecture current() {
|
|
||||||
String arch = System.getProperty("os.arch");
|
|
||||||
if (arch == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
switch (arch) {
|
|
||||||
case "amd64":
|
|
||||||
case "x86_64":
|
|
||||||
return AMD64;
|
|
||||||
case "aarch64":
|
|
||||||
return AARCH64;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
FROM redhat/ubi9:9.2-722 as prepare
|
||||||
|
COPY downloads/* /opt/download/
|
||||||
|
RUN mkdir -p /opt/jdk && \
|
||||||
|
cd /opt/jdk && \
|
||||||
|
tar xzf /opt/download/* --strip-components=1
|
||||||
|
|
||||||
FROM redhat/ubi9:9.2-722
|
FROM redhat/ubi9:9.2-722
|
||||||
ARG JAVA_DOWNLOAD_URL=https://download.bell-sw.com/java/17.0.8.1+1/bellsoft-jdk17.0.8.1+1-linux-amd64.tar.gz
|
COPY --from=prepare /opt/jdk /opt/jdk
|
||||||
ENV JAVA_HOME /opt/openjdk
|
ENV JAVA_HOME /opt/jdk
|
||||||
ENV PATH $JAVA_HOME/bin:$PATH
|
ENV PATH $JAVA_HOME/bin:$PATH
|
||||||
RUN mkdir -p /opt/openjdk && \
|
|
||||||
cd /opt/openjdk && \
|
|
||||||
curl -L $JAVA_DOWNLOAD_URL | tar zx --strip-components=1
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
FROM ubuntu:jammy-20230624 as prepare
|
||||||
|
COPY downloads/* /opt/download/
|
||||||
|
RUN mkdir -p /opt/jdk && \
|
||||||
|
cd /opt/jdk && \
|
||||||
|
tar xzf /opt/download/* --strip-components=1
|
||||||
|
|
||||||
FROM ubuntu:jammy-20230624
|
FROM ubuntu:jammy-20230624
|
||||||
RUN apt-get update && \
|
RUN apt-get update && apt-get install -y software-properties-common curl
|
||||||
apt-get install -y software-properties-common curl && \
|
COPY --from=prepare /opt/jdk /opt/jdk
|
||||||
mkdir -p /opt/openjdk
|
ENV JAVA_HOME /opt/jdk
|
||||||
ARG JAVA_DOWNLOAD_URL=https://download.bell-sw.com/java/17.0.8.1+1/bellsoft-jdk17.0.8.1+1-linux-amd64.tar.gz
|
|
||||||
ENV JAVA_HOME /opt/openjdk
|
|
||||||
ENV PATH $JAVA_HOME/bin:$PATH
|
ENV PATH $JAVA_HOME/bin:$PATH
|
||||||
RUN cd /opt/openjdk && \
|
|
||||||
curl -L $JAVA_DOWNLOAD_URL | tar zx --strip-components=1
|
|
||||||
|
@ -2,10 +2,14 @@ plugins {
|
|||||||
id "java"
|
id "java"
|
||||||
id "org.springframework.boot.conventions"
|
id "org.springframework.boot.conventions"
|
||||||
id "org.springframework.boot.integration-test"
|
id "org.springframework.boot.integration-test"
|
||||||
|
id "de.undercouch.download"
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Spring Boot Loader Integration Tests"
|
description = "Spring Boot Loader Integration Tests"
|
||||||
|
|
||||||
|
def oracleJdkVersion = "17.0.8"
|
||||||
|
def oracleJdkArch = "aarch64".equalsIgnoreCase(System.getProperty("os.arch")) ? "aarch64" : "x86"
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
@ -39,6 +43,26 @@ task buildApp(type: GradleBuild) {
|
|||||||
tasks = ["build"]
|
tasks = ["build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task downloadJdk(type: Download) {
|
||||||
|
def destFolder = new File(rootProject.buildDir, "downloads/jdk/oracle")
|
||||||
|
destFolder.mkdirs()
|
||||||
|
src "https://download.oracle.com/java/17/archive/jdk-${oracleJdkVersion}_linux-${oracleJdkArch}_bin.tar.gz"
|
||||||
|
dest destFolder
|
||||||
|
tempAndMove true
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
task syncJdkDownloads(type: Sync) {
|
||||||
|
dependsOn downloadJdk
|
||||||
|
from "${rootProject.buildDir}/downloads/jdk/oracle/"
|
||||||
|
include "jdk-${oracleJdkVersion}_linux-${oracleJdkArch}_bin.tar.gz"
|
||||||
|
into "${project.buildDir}/downloads/jdk/oracle/"
|
||||||
|
}
|
||||||
|
|
||||||
|
processIntTestResources {
|
||||||
|
dependsOn syncJdkDownloads
|
||||||
|
}
|
||||||
|
|
||||||
intTest {
|
intTest {
|
||||||
dependsOn buildApp
|
dependsOn buildApp
|
||||||
}
|
}
|
@ -118,10 +118,11 @@ class LoaderIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static JavaRuntime oracleJdk17() {
|
static JavaRuntime oracleJdk17() {
|
||||||
String arch = System.getProperty("os.arch");
|
ImageFromDockerfile image = new ImageFromDockerfile("spring-boot-loader/oracle-jdk");
|
||||||
String dockerFile = ("aarch64".equals(arch)) ? "Dockerfile-aarch64" : "Dockerfile";
|
image.withFileFromFile("Dockerfile", new File("src/intTest/resources/conf/oracle-jdk-17/Dockerfile"));
|
||||||
ImageFromDockerfile image = new ImageFromDockerfile("spring-boot-loader/oracle-jdk-17")
|
for (File file : new File("build/downloads/jdk/oracle").listFiles()) {
|
||||||
.withFileFromFile("Dockerfile", new File("src/intTest/resources/conf/oracle-jdk-17/" + dockerFile));
|
image.withFileFromFile("downloads/" + file.getName(), file);
|
||||||
|
}
|
||||||
return new JavaRuntime("Oracle JDK 17", JavaVersion.SEVENTEEN, () -> new GenericContainer<>(image));
|
return new JavaRuntime("Oracle JDK 17", JavaVersion.SEVENTEEN, () -> new GenericContainer<>(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
FROM ubuntu:jammy-20230624 as prepare
|
||||||
|
COPY downloads/* /opt/download/
|
||||||
|
RUN mkdir -p /opt/jdk && \
|
||||||
|
cd /opt/jdk && \
|
||||||
|
tar xzf /opt/download/* --strip-components=1
|
||||||
|
|
||||||
FROM ubuntu:jammy-20230624
|
FROM ubuntu:jammy-20230624
|
||||||
RUN apt-get update && \
|
COPY --from=prepare /opt/jdk /opt/jdk
|
||||||
apt-get install -y software-properties-common curl && \
|
ENV JAVA_HOME /opt/jdk
|
||||||
mkdir -p /opt/oraclejdk && \
|
|
||||||
cd /opt/oraclejdk && \
|
|
||||||
curl -L https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz | tar zx --strip-components=1
|
|
||||||
ENV JAVA_HOME /opt/oraclejdk
|
|
||||||
ENV PATH $JAVA_HOME/bin:$PATH
|
ENV PATH $JAVA_HOME/bin:$PATH
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
FROM ubuntu:jammy-20230624
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y software-properties-common curl && \
|
|
||||||
mkdir -p /opt/oraclejdk && \
|
|
||||||
cd /opt/oraclejdk && \
|
|
||||||
curl -L https://download.oracle.com/java/17/archive/jdk-17.0.8_linux-aarch64_bin.tar.gz | tar zx --strip-components=1
|
|
||||||
ENV JAVA_HOME /opt/oraclejdk
|
|
||||||
ENV PATH $JAVA_HOME/bin:$PATH
|
|
Loading…
Reference in New Issue
Block a user