Skip to content

Commit

Permalink
conformance tests: archive the context directory as 0:0
Browse files Browse the repository at this point in the history
When uploading a context directory to dockerd, generate the archive
ourselves so that we can force the ownerships in it to 0:0, which
BuildKit seems to expect clients to do.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
  • Loading branch information
nalind committed Nov 16, 2023
1 parent e2c8519 commit fae3e24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,18 @@ func buildUsingDocker(ctx context.Context, t *testing.T, client *docker.Client,
pullImageIfMissing(t, client, stageBase)
}

excludes, err := imagebuilder.ParseDockerignore(contextDir)
require.NoErrorf(t, err, "parsing ignores file in %q", contextDir)
inputReader, inputCloser, err := dockerclient.NewClientExecutor(client).Archive(true, contextDir, ".", false, excludes)
require.NoErrorf(t, err, "archiving context directory %q", contextDir)
defer inputCloser.Close()

// set up build options
output := &bytes.Buffer{}
options := docker.BuildImageOptions{
Context: ctx,
ContextDir: contextDir,
Dockerfile: dockerfileRelativePath,
InputStream: inputReader,
OutputStream: output,
Name: dockerImage,
NoCache: true,
Expand Down

0 comments on commit fae3e24

Please sign in to comment.