Report missing Docker clearly and preserve CI attempt setup
Some checks failed
Build, test and publish / verify (push) Failing after 3m9s

This commit is contained in:
2026-10-29 09:23:24 +01:00
parent 069b62ae92
commit 19fffe2cd3
4 changed files with 15 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ public class Ci {
Path file = Path.of(Setup.required(env, "GITHUB_ENV"));
String id = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSSSSSSS")
.withZone(ZoneOffset.UTC).format(Instant.now());
Files.writeString(file, "CI_RUN_ATTEMPT=" + id + "\n", StandardOpenOption.APPEND);
Files.writeString(file, "CI_RUN_ATTEMPT=" + id + "\n", StandardOpenOption.CREATE, StandardOpenOption.APPEND);
}
case "configure-gitea" -> Setup.configureGitea(env);
case "configure-docker" -> {

View File

@@ -82,6 +82,14 @@ class CiTests {
test("Older commit cannot move main", () -> {
try (Fixture f = new Fixture()) { f.fake.head = "c".repeat(40); f.pipeline.publish(); equal(2L,f.calls("push")); }
});
test("Unavailable Docker fails before build with a concrete cause", () -> {
try (Fixture f = new Fixture()) {
f.fake.dockerAvailable = false;
try { f.pipeline.verify(); throw new AssertionError("Expected failure"); }
catch (IllegalArgumentException error) { equal(true,error.getMessage().contains("Docker is unavailable")); }
equal(0L,f.fake.calls.stream().filter(a -> a.getFirst().equals("mvn")).count());
}
});
test("Architecture mismatch blocks publication", () -> {
try (Fixture f = new Fixture()) { f.pipeline.env.put("TARGET_PLATFORM","linux/arm64"); failure(f.pipeline::publish); equal(0L,f.calls("push")); }
});
@@ -128,6 +136,7 @@ class CiTests {
final Map<String,String> images = new HashMap<>(), tags = new HashMap<>();
String head = SHA, pushFailure = "", pullFailure = "";
boolean manifestError, mavenFailure;
boolean dockerAvailable = true;
FakeCommands() { super(Duration.ofMinutes(1)); }
@Override Result execute(List<String> args, Path cwd, Map<String,String> env, String input, boolean echo) {
calls.add(List.copyOf(args));
@@ -135,7 +144,7 @@ class CiTests {
if (args.getFirst().equals("mvn") && mavenFailure) return new Result(42,"deliberate failure");
if (!args.getFirst().equals("docker")) return new Result(0,"");
String command = args.get(1), ref = args.getLast();
if (command.equals("info")) return new Result(0,args.contains("{{.Architecture}}") ? "amd64" : "linux");
if (command.equals("info")) return new Result(dockerAvailable ? 0 : 1,args.contains("{{.Architecture}}") ? "amd64" : "linux");
if (command.equals("context")) return new Result(0,"unix:///tmp/test-docker.sock");
if (command.equals("manifest")) {
if (manifestError) return new Result(1,"unauthorized");

View File

@@ -40,7 +40,9 @@ class Pipeline {
void run(String... args) throws Exception { result(true, args).checked(); }
void requirePlatform() throws Exception {
String target = Setup.required(env,"TARGET_PLATFORM");
String arch = capture("docker", "info", "--format", "{{.Architecture}}");
var docker = result(false,"docker", "info", "--format", "{{.Architecture}}");
check(docker.code() == 0, "Docker is unavailable; start Docker Desktop before running CI (details in verify.log)");
String arch = docker.output().strip();
arch = switch (arch) { case "x86_64" -> "amd64"; case "aarch64" -> "arm64"; default -> arch; };
String nativePlatform = capture("docker", "info", "--format", "{{.OSType}}") + "/" + arch;
check(target.equals(nativePlatform), "Target " + target + " differs from Docker host " + nativePlatform);

View File

@@ -111,7 +111,7 @@ only then can real main publication/pullback/rerun acceptance be completed.
CI orchestration, setup and behavior tests now run through `java ci/Ci.java`.
The shell/Python helpers have been removed. The source launcher compiles helper
classes in memory without external dependencies or preview flags. Fourteen Java
classes in memory without external dependencies or preview flags. Fifteen Java
behavior tests pass, including JSON/configuration preservation, publication gates,
partial recovery and process deadlines. A real feature run validates this revision
before updating the existing open PR; no merge to main is authorized.