Skip to content

Commit

Permalink
Merge pull request #136 from h0ngcha0/master
Browse files Browse the repository at this point in the history
Parse Image Correctly When Using Containerd Image Store
  • Loading branch information
marcus-drake authored Dec 12, 2024
2 parents 3374975 + cd63332 commit c505816
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/sbtdocker/DockerBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions src/test/scala/sbtdocker/DockerBuildSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c505816

Please sign in to comment.