From cd6333267c8a6fdbd52b3524fd2394b1b73f50d3 Mon Sep 17 00:00:00 2001 From: h0ngcha0 Date: Sat, 23 Mar 2024 11:25:44 +0100 Subject: [PATCH 1/2] Parse image correctly for containerd image store --- src/main/scala/sbtdocker/DockerBuild.scala | 2 ++ src/test/scala/sbtdocker/DockerBuildSpec.scala | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/scala/sbtdocker/DockerBuild.scala b/src/main/scala/sbtdocker/DockerBuild.scala index 500322e..15f0148 100644 --- a/src/main/scala/sbtdocker/DockerBuild.scala +++ b/src/main/scala/sbtdocker/DockerBuild.scala @@ -198,6 +198,7 @@ object DockerBuild { private val SuccessfullyBuilt = "^Successfully built ([0-9a-f]+)$".r private val SuccessfullyBuiltBuildKit = ".* writing image sha256:([0-9a-f]+) .*\\bdone$".r + private val SuccessfullyBuiltContainerd = ".* exporting manifest list sha256:([0-9a-f]+) .*\\bdone$".r private val SuccessfullyBuiltBuildx = ".* exporting config sha256:([0-9a-f]+) .*\\bdone$".r private val SuccessfullyBuiltPodman = "^([0-9a-f]{64})$".r private val SuccessfullyBuiltNerdctl = "^Loaded image: .*sha256:([0-9a-f]+)$".r @@ -206,6 +207,7 @@ object DockerBuild { lines.collect { case SuccessfullyBuilt(id) => ImageId(id) case SuccessfullyBuiltBuildKit(id) => ImageId(id) + case SuccessfullyBuiltContainerd(id) => ImageId(id) case SuccessfullyBuiltBuildx(id) => ImageId(id) case SuccessfullyBuiltPodman(id) => ImageId(id) case SuccessfullyBuiltNerdctl(id) => ImageId(id) diff --git a/src/test/scala/sbtdocker/DockerBuildSpec.scala b/src/test/scala/sbtdocker/DockerBuildSpec.scala index c9b7389..c74abc2 100644 --- a/src/test/scala/sbtdocker/DockerBuildSpec.scala +++ b/src/test/scala/sbtdocker/DockerBuildSpec.scala @@ -125,6 +125,18 @@ class DockerBuildSpec extends AnyFreeSpec with Matchers { DockerBuild.parseImageId(lines) shouldEqual Some(ImageId("353fcb84af6b")) } + "Docker build with containerd output" in { + val lines = Seq( + "[info] #10 exporting layers 2.8s done", + "[info] #10 exporting manifest sha256:7f8c52951645245ac6bdc0e213330a88834ebcce340b32a834287bb6bfa6d5cb 0.0s done", + "[info] #10 exporting config sha256:9f7f478055830d4b6f0981b76dcb33be52c1ef1496c71b2dbbecf7336ede58a2 0.0s done", + "[info] #10 exporting attestation manifest sha256:ba07dabd29c79fa4f8f55b2d691cc740638e4b4d6abe6eb07aa8774f0b203cc1", + "[info] #10 exporting attestation manifest sha256:ba07dabd29c79fa4f8f55b2d691cc740638e4b4d6abe6eb07aa8774f0b203cc1 0.1s done", + "[info] #10 exporting manifest list sha256:bb462cb506fd951efc8847f7f4c9a227b5908246101c1d9e5685daf632ce9c51 0.0s done" + ) + DockerBuild.parseImageId(lines) shouldEqual Some(ImageId("bb462cb506fd951efc8847f7f4c9a227b5908246101c1d9e5685daf632ce9c51")) + } + "Docker buildx output" in { val lines = Seq( "#7 exporting layers 0.4s done", From d4177d3eca064397b328f6662f5fb727ac30ac8c Mon Sep 17 00:00:00 2001 From: Marcus Drake Date: Thu, 12 Dec 2024 15:42:42 +0100 Subject: [PATCH 2/2] Run build on PRs --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0a3f95..630d3a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ name: CI on: + pull_request: push: jobs: build: