Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cli/command/image/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)

if err != nil {
if options.quiet && urlutil.IsURL(specifiedContext) {
fmt.Fprintln(dockerCli.Err(), progBuff)
_, _ = fmt.Fprintln(dockerCli.Err(), progBuff)
}
return errors.Errorf("unable to prepare context: %s", err)
}
Expand Down Expand Up @@ -337,16 +337,16 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
for k, auth := range creds {
authConfigs[k] = registrytypes.AuthConfig(auth)
}
buildOptions := imageBuildOptions(dockerCli, options)
buildOptions.Version = types.BuilderV1
buildOptions.Dockerfile = relDockerfile
buildOptions.AuthConfigs = authConfigs
buildOptions.RemoteContext = remote
buildOpts := imageBuildOptions(dockerCli, options)
buildOpts.Version = types.BuilderV1
buildOpts.Dockerfile = relDockerfile
buildOpts.AuthConfigs = authConfigs
buildOpts.RemoteContext = remote

response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions)
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOpts)
if err != nil {
if options.quiet {
fmt.Fprintf(dockerCli.Err(), "%s", progBuff)
_, _ = fmt.Fprintf(dockerCli.Err(), "%s", progBuff)
}
cancel()
return err
Expand All @@ -357,7 +357,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
aux := func(msg jsonstream.JSONMessage) {
var result types.BuildResult
if err := json.Unmarshal(*msg.Aux, &result); err != nil {
fmt.Fprintf(dockerCli.Err(), "Failed to parse aux message: %s", err)
_, _ = fmt.Fprintf(dockerCli.Err(), "Failed to parse aux message: %s", err)
} else {
imageID = result.ID
}
Expand All @@ -371,7 +371,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
jerr.Code = 1
}
if options.quiet {
fmt.Fprintf(dockerCli.Err(), "%s%s", progBuff, buildBuff)
_, _ = fmt.Fprintf(dockerCli.Err(), "%s%s", progBuff, buildBuff)
}
return cli.StatusError{Status: jerr.Message, StatusCode: jerr.Code}
}
Expand All @@ -381,7 +381,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
// Windows: show error message about modified file permissions if the
// daemon isn't running Windows.
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
_, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
"image from Windows against a non-Windows Docker host. All files and "+
"directories added to build context will have '-rwxr-xr-x' permissions. "+
"It is recommended to double check and reset permissions for sensitive "+
Expand Down Expand Up @@ -502,12 +502,12 @@ func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.Rea
hdr, err := tarReader.Next()
if err == io.EOF {
// Signals end of archive.
tarWriter.Close()
pipeWriter.Close()
_ = tarWriter.Close()
_ = pipeWriter.Close()
return
}
if err != nil {
pipeWriter.CloseWithError(err)
_ = pipeWriter.CloseWithError(err)
return
}

Expand All @@ -519,20 +519,20 @@ func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.Rea
var newDockerfile []byte
newDockerfile, *resolvedTags, err = rewriteDockerfileFromForContentTrust(ctx, content, translator)
if err != nil {
pipeWriter.CloseWithError(err)
_ = pipeWriter.CloseWithError(err)
return
}
hdr.Size = int64(len(newDockerfile))
content = bytes.NewBuffer(newDockerfile)
}

if err := tarWriter.WriteHeader(hdr); err != nil {
pipeWriter.CloseWithError(err)
_ = pipeWriter.CloseWithError(err)
return
}

if _, err := io.Copy(tarWriter, content); err != nil {
pipeWriter.CloseWithError(err)
_ = pipeWriter.CloseWithError(err)
return
}
}
Expand Down