mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '3.2.x'
Closes gh-40799
This commit is contained in:
+11
@@ -102,6 +102,17 @@ public abstract class AbstractBuildLog implements BuildLog {
|
|||||||
log();
|
log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failedCleaningWorkDir(Cache cache, Exception exception) {
|
||||||
|
StringBuilder message = new StringBuilder("Warning: Working location " + cache + " could not be cleaned");
|
||||||
|
if (exception != null) {
|
||||||
|
message.append(": ").append(exception.getMessage());
|
||||||
|
}
|
||||||
|
log();
|
||||||
|
log(message.toString());
|
||||||
|
log();
|
||||||
|
}
|
||||||
|
|
||||||
private String getDigest(Image image) {
|
private String getDigest(Image image) {
|
||||||
List<String> digests = image.getDigests();
|
List<String> digests = image.getDigests();
|
||||||
return (digests.isEmpty() ? "" : digests.get(0));
|
return (digests.isEmpty() ? "" : digests.get(0));
|
||||||
|
|||||||
+7
@@ -114,6 +114,13 @@ public interface BuildLog {
|
|||||||
*/
|
*/
|
||||||
void taggedImage(ImageReference tag);
|
void taggedImage(ImageReference tag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log that a cache cleanup step was not completed successfully.
|
||||||
|
* @param cache the cache
|
||||||
|
* @param exception any exception that caused the failure
|
||||||
|
*/
|
||||||
|
void failedCleaningWorkDir(Cache cache, Exception exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory method that returns a {@link BuildLog} the outputs to {@link System#out}.
|
* Factory method that returns a {@link BuildLog} the outputs to {@link System#out}.
|
||||||
* @return a build log instance that logs to system out
|
* @return a build log instance that logs to system out
|
||||||
|
|||||||
+4
-4
@@ -311,7 +311,7 @@ class Lifecycle implements Closeable {
|
|||||||
deleteVolume(cache.getVolume().getVolumeName());
|
deleteVolume(cache.getVolume().getVolumeName());
|
||||||
}
|
}
|
||||||
if (cache.getBind() != null) {
|
if (cache.getBind() != null) {
|
||||||
deleteBind(cache.getBind().getSource());
|
deleteBind(cache.getBind());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,12 +319,12 @@ class Lifecycle implements Closeable {
|
|||||||
this.docker.volume().delete(name, true);
|
this.docker.volume().delete(name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteBind(String source) {
|
private void deleteBind(Cache.Bind bind) {
|
||||||
try {
|
try {
|
||||||
FileSystemUtils.deleteRecursively(Path.of(source));
|
FileSystemUtils.deleteRecursively(Path.of(bind.getSource()));
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
throw new IllegalStateException("Error cleaning bind mount directory '" + source + "'", ex);
|
this.log.failedCleaningWorkDir(bind, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-5
@@ -36,7 +36,6 @@ import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
|
|||||||
import org.apache.commons.compress.utils.IOUtils;
|
import org.apache.commons.compress.utils.IOUtils;
|
||||||
import org.gradle.testkit.runner.BuildResult;
|
import org.gradle.testkit.runner.BuildResult;
|
||||||
import org.gradle.testkit.runner.TaskOutcome;
|
import org.gradle.testkit.runner.TaskOutcome;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.TestTemplate;
|
import org.junit.jupiter.api.TestTemplate;
|
||||||
import org.junit.jupiter.api.condition.EnabledOnOs;
|
import org.junit.jupiter.api.condition.EnabledOnOs;
|
||||||
import org.junit.jupiter.api.condition.OS;
|
import org.junit.jupiter.api.condition.OS;
|
||||||
@@ -301,10 +300,8 @@ class BootBuildImageIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
@EnabledOnOs(value = OS.LINUX,
|
@EnabledOnOs(value = OS.LINUX, disabledReason = "Works with Docker Engine on Linux but is not reliable with "
|
||||||
disabledReason = "Works with Docker Engine on Linux but is not reliable with "
|
+ "Docker Desktop on other OSs")
|
||||||
+ "Docker Desktop on other OSs")
|
|
||||||
@Disabled("gh-40760")
|
|
||||||
void buildsImageWithBindCaches() throws IOException {
|
void buildsImageWithBindCaches() throws IOException {
|
||||||
writeMainClass();
|
writeMainClass();
|
||||||
writeLongNameResource();
|
writeLongNameResource();
|
||||||
|
|||||||
+2
-5
@@ -25,7 +25,6 @@ import java.time.OffsetDateTime;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.TestTemplate;
|
import org.junit.jupiter.api.TestTemplate;
|
||||||
import org.junit.jupiter.api.condition.EnabledOnOs;
|
import org.junit.jupiter.api.condition.EnabledOnOs;
|
||||||
import org.junit.jupiter.api.condition.OS;
|
import org.junit.jupiter.api.condition.OS;
|
||||||
@@ -402,10 +401,8 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
@EnabledOnOs(value = OS.LINUX,
|
@EnabledOnOs(value = OS.LINUX, disabledReason = "Works with Docker Engine on Linux but is not reliable with "
|
||||||
disabledReason = "Works with Docker Engine on Linux but is not reliable with "
|
+ "Docker Desktop on other OSs")
|
||||||
+ "Docker Desktop on other OSs")
|
|
||||||
@Disabled("gh-40760")
|
|
||||||
void whenBuildImageIsInvokedWithBindCaches(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithBindCaches(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-bind-caches")
|
mavenBuild.project("build-image-bind-caches")
|
||||||
|
|||||||
Reference in New Issue
Block a user