Skip to content

Commit 735d0b0

Browse files
authored
Merge pull request #28903 from Luap99/fix-chrootarchive-remote
fix podman-remote save -f oci-dir/docker-dir
2 parents bd5e4c1 + 79e7b0f commit 735d0b0

6 files changed

Lines changed: 51 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,15 @@ jobs:
339339
priv: [rootless, root]
340340
mode: [local, remote]
341341
exclude:
342-
# try to keep the task somewhat sane and not run remote test rootless
343-
- priv: rootless
342+
# try to keep the task somewhat sane and exclude all but one rootless+remote combination
343+
- distro: fedora-prior
344+
priv: rootless
345+
mode: remote
346+
- distro: fedora-rawhide
347+
priv: rootless
348+
mode: remote
349+
- distro: debian-sid
350+
priv: rootless
344351
mode: remote
345352
include:
346353
# Add buildah bud tests, only runs as root for now.

pkg/domain/infra/tunnel/images.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"go.podman.io/podman/v6/pkg/domain/utils"
2525
"go.podman.io/podman/v6/pkg/errorhandling"
2626
"go.podman.io/storage/pkg/archive"
27-
"go.podman.io/storage/pkg/chrootarchive"
2827
)
2928

3029
func (ir *ImageEngine) Exists(_ context.Context, nameOrID string) (*entities.BoolReport, error) {
@@ -368,7 +367,7 @@ func (ir *ImageEngine) Save(_ context.Context, nameOrID string, tags []string, o
368367
return err
369368
}
370369

371-
return chrootarchive.Untar(f, opts.Output, &archive.TarOptions{NoLchown: true})
370+
return archive.Untar(f, opts.Output, &archive.TarOptions{NoLchown: true})
372371
}
373372

374373
func (ir *ImageEngine) Search(_ context.Context, term string, opts entities.ImageSearchOptions) ([]entities.ImageSearchReport, error) {

test/e2e/common_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,11 @@ func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
15471547
}
15481548

15491549
func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers string, label string, extraOptions []string) string {
1550-
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile-"+stringid.GenerateRandomID())
1551-
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0o755)
1550+
buildDir := filepath.Join(p.TempDir, "build"+stringid.GenerateRandomID())
1551+
err := os.Mkdir(buildDir, 0o755)
1552+
Expect(err).ToNot(HaveOccurred())
1553+
dockerfilePath := filepath.Join(buildDir, "Dockerfile-"+stringid.GenerateRandomID())
1554+
err = os.WriteFile(dockerfilePath, []byte(dockerfile), 0o644)
15521555
Expect(err).ToNot(HaveOccurred())
15531556
cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath}
15541557
if label != "" {
@@ -1560,7 +1563,7 @@ func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers
15601563
if len(extraOptions) > 0 {
15611564
cmd = append(cmd, extraOptions...)
15621565
}
1563-
cmd = append(cmd, p.TempDir)
1566+
cmd = append(cmd, buildDir)
15641567
session := p.Podman(cmd)
15651568
session.Wait(240)
15661569
Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString()))

test/e2e/container_create_volume_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,29 @@ import (
1010
. "github.com/onsi/ginkgo/v2"
1111
. "github.com/onsi/gomega"
1212
. "go.podman.io/podman/v6/test/utils"
13+
"go.podman.io/storage/pkg/stringid"
1314
)
1415

1516
func buildDataVolumeImage(pTest *PodmanTestIntegration, image, data, dest string) {
17+
buildDir := filepath.Join(pTest.TempDir, "build"+stringid.GenerateRandomID())
18+
err := os.Mkdir(buildDir, 0o755)
19+
Expect(err).ToNot(HaveOccurred())
20+
1621
// Create a dummy file for data volume
17-
dummyFile := filepath.Join(pTest.TempDir, data)
18-
err := os.WriteFile(dummyFile, []byte(data), 0o644)
22+
dummyFile := filepath.Join(buildDir, data)
23+
err = os.WriteFile(dummyFile, []byte(data), 0o644)
1924
Expect(err).ToNot(HaveOccurred())
2025

2126
// Create a data volume container image but no CMD binary in it
2227
containerFile := fmt.Sprintf(`FROM scratch
2328
CMD doesnotexist.sh
2429
ADD %s %s/
2530
VOLUME %s/`, data, dest, dest)
26-
pTest.BuildImage(containerFile, image, "false")
31+
32+
containerFilePath := filepath.Join(buildDir, "Containerfile")
33+
err = os.WriteFile(containerFilePath, []byte(containerFile), 0o644)
34+
Expect(err).ToNot(HaveOccurred())
35+
pTest.PodmanExitCleanly("build", "--pull-never", "-q", "-t", image, "--layers=false", "--file", containerFilePath)
2736
}
2837

2938
func createContainersConfFile(pTest *PodmanTestIntegration) {

test/e2e/pod_create_test.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"go.podman.io/common/pkg/sysinfo"
2121
"go.podman.io/podman/v6/pkg/util"
2222
. "go.podman.io/podman/v6/test/utils"
23+
"go.podman.io/storage/pkg/stringid"
2324
)
2425

2526
var _ = Describe("Podman pod create", func() {
@@ -175,8 +176,12 @@ var _ = Describe("Podman pod create", func() {
175176

176177
Describe("podman create pod with --hosts-file", func() {
177178
BeforeEach(func() {
178-
imageHosts := filepath.Join(podmanTest.TempDir, "pause_hosts")
179-
err := os.WriteFile(imageHosts, []byte("56.78.12.34 image.example.com"), 0o755)
179+
buildDir := filepath.Join(podmanTest.TempDir, "build"+stringid.GenerateRandomID())
180+
err := os.Mkdir(buildDir, 0o755)
181+
Expect(err).ToNot(HaveOccurred())
182+
183+
imageHosts := filepath.Join(buildDir, "pause_hosts")
184+
err = os.WriteFile(imageHosts, []byte("56.78.12.34 image.example.com"), 0o755)
180185
Expect(err).ToNot(HaveOccurred())
181186

182187
configHosts := filepath.Join(podmanTest.TempDir, "hosts")
@@ -191,11 +196,16 @@ var _ = Describe("Podman pod create", func() {
191196
podmanTest.RestartRemoteService()
192197
}
193198

194-
dockerfile := strings.Join([]string{
199+
containerfile := strings.Join([]string{
195200
`FROM ` + INFRA_IMAGE,
196201
`COPY pause_hosts /etc/hosts`,
197202
}, "\n")
198-
podmanTest.BuildImage(dockerfile, "foobar.com/hosts_test_pause:latest", "false", "--no-hosts")
203+
204+
containerFilePath := filepath.Join(buildDir, "Containerfile")
205+
err = os.WriteFile(containerFilePath, []byte(containerfile), 0o644)
206+
Expect(err).ToNot(HaveOccurred())
207+
208+
podmanTest.PodmanExitCleanly("build", "-q", "-t", "foobar.com/hosts_test_pause:latest", "--layers=false", "--no-hosts", buildDir)
199209
})
200210

201211
It("--hosts-file=path", func() {

test/e2e/pull_chunked_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,18 @@ func pullChunkedTests() { // included in pull_test.go, must use a Ginkgo DSL at
6969
registryRef: pullChunkedRegistryPrefix + "chunked-normal",
7070
dirPath: filepath.Join(imageDir, "chunked-normal"),
7171
}
72+
73+
buildDir := filepath.Join(podmanTest.TempDir, "build")
74+
err := os.Mkdir(buildDir, 0o755)
75+
Expect(err).ToNot(HaveOccurred())
7276
chunkedNormalContentPath := "chunked-normal-image-content"
73-
err := os.WriteFile(filepath.Join(podmanTest.TempDir, chunkedNormalContentPath), fmt.Appendf(nil, "content-%d", rand.Int64()), 0o600)
77+
err = os.WriteFile(filepath.Join(buildDir, chunkedNormalContentPath), fmt.Appendf(nil, "content-%d", rand.Int64()), 0o600)
7478
Expect(err).NotTo(HaveOccurred())
7579
chunkedNormalContainerFile := fmt.Sprintf("FROM scratch\nADD %s /content", chunkedNormalContentPath)
76-
podmanTest.BuildImage(chunkedNormalContainerFile, chunkedNormal.localTag(), "true")
80+
err = os.WriteFile(filepath.Join(buildDir, "Containerfile"), []byte(chunkedNormalContainerFile), 0o600)
81+
Expect(err).NotTo(HaveOccurred())
82+
podmanTest.PodmanExitCleanly("build", "-q", "-t", chunkedNormal.localTag(), "--layers=true", buildDir)
83+
7784
podmanTest.PodmanExitCleanly("push", "-q", "--tls-verify=false", "--force-compression", "--compression-format=zstd:chunked", chunkedNormal.localTag(), chunkedNormal.registryRef)
7885
skopeo := SystemExec("skopeo", []string{"copy", "-q", "--preserve-digests", "--all", "--src-tls-verify=false", chunkedNormal.registryRef, "dir:" + chunkedNormal.dirPath})
7986
skopeo.WaitWithDefaultTimeout()

0 commit comments

Comments
 (0)