mirror of
https://github.com/containers/podman.git
synced 2025-05-31 07:27:13 +08:00
Completely rework --change parsing
The way we were trying to parse was very broken. I originally attempted to use Buildah's Dockerfile parser here, but dealing with it (and convincing it to accept only a limited subset, and only one instruction at a time) was challenging, so I rewrote a subset of Dockerfile parsing. This should handle most common cases well, though there are definitely unhandled edge cases for ENV and LABEL. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:

committed by
Matthew Heon

parent
4dbab37e05
commit
001d06d7f6
@ -105,7 +105,9 @@ var _ = Describe("Podman import", func() {
|
||||
results.WaitWithDefaultTimeout()
|
||||
Expect(results.ExitCode()).To(Equal(0))
|
||||
imageData := results.InspectImageJSON()
|
||||
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash"))
|
||||
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/sh"))
|
||||
Expect(imageData[0].Config.Cmd[1]).To(Equal("-c"))
|
||||
Expect(imageData[0].Config.Cmd[2]).To(Equal("/bin/bash"))
|
||||
})
|
||||
|
||||
It("podman import with change flag CMD <path>", func() {
|
||||
@ -126,6 +128,8 @@ var _ = Describe("Podman import", func() {
|
||||
Expect(results.ExitCode()).To(Equal(0))
|
||||
imageData := results.InspectImageJSON()
|
||||
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/sh"))
|
||||
Expect(imageData[0].Config.Cmd[1]).To(Equal("-c"))
|
||||
Expect(imageData[0].Config.Cmd[2]).To(Equal("/bin/sh"))
|
||||
})
|
||||
|
||||
It("podman import with change flag CMD [\"path\",\"path'\"", func() {
|
||||
@ -137,7 +141,7 @@ var _ = Describe("Podman import", func() {
|
||||
export.WaitWithDefaultTimeout()
|
||||
Expect(export.ExitCode()).To(Equal(0))
|
||||
|
||||
importImage := podmanTest.Podman([]string{"import", "--change", "CMD [/bin/bash]", outfile, "imported-image"})
|
||||
importImage := podmanTest.Podman([]string{"import", "--change", "CMD [\"/bin/bash\"]", outfile, "imported-image"})
|
||||
importImage.WaitWithDefaultTimeout()
|
||||
Expect(importImage.ExitCode()).To(Equal(0))
|
||||
|
||||
|
Reference in New Issue
Block a user