dockerfile: add test for chown destination
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-18.09
parent
e04e16c836
commit
25bfc57e9e
|
@ -35,7 +35,7 @@ const (
|
|||
localNameContext = "context"
|
||||
historyComment = "buildkit.dockerfile.v0"
|
||||
|
||||
DefaultCopyImage = "tonistiigi/copy:v0.1.4@sha256:d9d49bedbbe2b27df88115e6aff7b9cd11ed2fbd8d9013f02d3da735c08c92e5"
|
||||
DefaultCopyImage = "tonistiigi/copy:v0.1.5@sha256:eab89b76ffbb3c807663a67a41e8be31b8a0e362d7fb074a55bddace563a28bb"
|
||||
)
|
||||
|
||||
type ConvertOpt struct {
|
||||
|
|
|
@ -51,7 +51,7 @@ func init() {
|
|||
opts = []integration.TestOpt{
|
||||
integration.WithMirroredImages(integration.OfficialImages("busybox:latest")),
|
||||
integration.WithMirroredImages(map[string]string{
|
||||
"tonistiigi/copy:v0.1.4": "docker.io/" + dockerfile2llb.DefaultCopyImage,
|
||||
"tonistiigi/copy:v0.1.5": "docker.io/" + dockerfile2llb.DefaultCopyImage,
|
||||
}),
|
||||
integration.WithMatrix("frontend", frontends),
|
||||
}
|
||||
|
@ -114,9 +114,40 @@ func TestIntegration(t *testing.T) {
|
|||
testIgnoreEntrypoint,
|
||||
testCopyThroughSymlinkContext,
|
||||
testCopyThroughSymlinkMultiStage,
|
||||
testCopyChownCreateDest,
|
||||
}, opts...)
|
||||
}
|
||||
|
||||
func testCopyChownCreateDest(t *testing.T, sb integration.Sandbox) {
|
||||
t.Parallel()
|
||||
f := getFrontend(t, sb)
|
||||
|
||||
dockerfile := []byte(`
|
||||
FROM busybox
|
||||
RUN adduser -D user
|
||||
COPY --chown=user:user . /dest
|
||||
RUN [ "$(stat -c "%U %G" /dest)" == "user user" ]
|
||||
`)
|
||||
|
||||
dir, err := tmpdir(
|
||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||
)
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
c, err := client.New(context.TODO(), sb.Address())
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||
LocalDirs: map[string]string{
|
||||
builder.LocalNameDockerfile: dir,
|
||||
builder.LocalNameContext: dir,
|
||||
},
|
||||
}, nil)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func testCopyThroughSymlinkContext(t *testing.T, sb integration.Sandbox) {
|
||||
t.Parallel()
|
||||
f := getFrontend(t, sb)
|
||||
|
|
Loading…
Reference in New Issue