mirror of
https://github.com/mudler/luet.git
synced 2025-08-14 05:25:53 +00:00
Be sure to copy exact folder structure when generating final images
'COPY *' has a different behavior than 'COPY .' - when regexes are involved, COPY behave differently, by unpacking directory content to the root. Enhance unit test to cover the scenario as well
This commit is contained in:
parent
544895e051
commit
4d9297e3da
@ -248,7 +248,7 @@ func (a *PackageArtifact) SetPath(p string) {
|
|||||||
func (a *PackageArtifact) genDockerfile() string {
|
func (a *PackageArtifact) genDockerfile() string {
|
||||||
return `
|
return `
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY * /`
|
COPY . /`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateArtifactForFile creates a new artifact from the given file
|
// CreateArtifactForFile creates a new artifact from the given file
|
||||||
|
@ -175,9 +175,14 @@ RUN echo bar > /test2`))
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
defer os.RemoveAll(tmpWork) // clean up
|
defer os.RemoveAll(tmpWork) // clean up
|
||||||
|
|
||||||
|
Expect(os.MkdirAll(filepath.Join(tmpdir, "foo", "bar"), os.ModePerm)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
err = ioutil.WriteFile(filepath.Join(tmpdir, "test"), testString, 0644)
|
err = ioutil.WriteFile(filepath.Join(tmpdir, "test"), testString, 0644)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
err = ioutil.WriteFile(filepath.Join(tmpdir, "foo", "bar", "test"), testString, 0644)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
artifact := NewPackageArtifact(filepath.Join(tmpWork, "fake.tar"))
|
artifact := NewPackageArtifact(filepath.Join(tmpWork, "fake.tar"))
|
||||||
artifact.SetCompileSpec(&LuetCompilationSpec{Package: &pkg.DefaultPackage{Name: "foo", Version: "1.0"}})
|
artifact.SetCompileSpec(&LuetCompilationSpec{Package: &pkg.DefaultPackage{Name: "foo", Version: "1.0"}})
|
||||||
|
|
||||||
@ -201,6 +206,11 @@ RUN echo bar > /test2`))
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(content).To(Equal(testString))
|
Expect(content).To(Equal(testString))
|
||||||
|
|
||||||
|
content, err = ioutil.ReadFile(filepath.Join(result, "foo", "bar", "test"))
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
Expect(content).To(Equal(testString))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Generates empty packages images", func() {
|
It("Generates empty packages images", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user