Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Create a context for the progress printer #764

Closed
wants to merge 1 commit into from

Conversation

rumpl
Copy link
Member

@rumpl rumpl commented Nov 25, 2019

We call cancel on the context once we finished so that it will stop
printing stuff. This could fix APP-349 and could fix the errors with
status code 141 that we see on our CI.

We call cancel on the context once we finished so that it will stop
printing stuff. This *could* fix APP-349 and could fix the errors with
status code 141 that we see on our CI.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@codecov
Copy link

codecov bot commented Nov 25, 2019

Codecov Report

Merging #764 into master will decrease coverage by 1.75%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #764      +/-   ##
==========================================
- Coverage   71.27%   69.52%   -1.76%     
==========================================
  Files          67       64       -3     
  Lines        3837     3521     -316     
==========================================
- Hits         2735     2448     -287     
+ Misses        768      753      -15     
+ Partials      334      320      -14
Impacted Files Coverage Δ
internal/commands/build/build.go 60.8% <100%> (+0.39%) ⬆️
internal/commands/image/rm.go 58.62% <0%> (-11.15%) ⬇️
internal/packager/init.go 64.64% <0%> (-8.61%) ⬇️
internal/packager/extract.go 23.8% <0%> (-8.4%) ⬇️
internal/commands/build/compose.go 78.57% <0%> (-8.1%) ⬇️
internal/store/bundle.go 76.41% <0%> (-5.99%) ⬇️
internal/validator/rules/relativepath.go
internal/validator/rules/externalsecrets.go
internal/validator/validator.go

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f38c337...cebcef5. Read the comment docs.

@@ -169,7 +169,9 @@ func buildImageUsingBuildx(app *types.App, contextPath string, opt buildOptions,
out = os.NewFile(dockerCli.Out().FD(), "/dev/stdout")
}

pw := progress.NewPrinter(ctx, out, opt.progress)
ctx2, cancel := context.WithCancel(context.TODO())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a regression test could be tricky to add here, but maybe a one line comment explaining why we have another context?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can find a better name, like printerContext?

Suggested change
ctx2, cancel := context.WithCancel(context.TODO())
printerContext, cancel := context.WithCancel(context.TODO())

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with comment added

Copy link
Member

@eunomie eunomie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message is relying on APP-349 that is an internal tracking number. Maybe we can replace it by an issue here or just a few lines to describe the issue?

@@ -169,7 +169,9 @@ func buildImageUsingBuildx(app *types.App, contextPath string, opt buildOptions,
out = os.NewFile(dockerCli.Out().FD(), "/dev/stdout")
}

pw := progress.NewPrinter(ctx, out, opt.progress)
ctx2, cancel := context.WithCancel(context.TODO())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can find a better name, like printerContext?

Suggested change
ctx2, cancel := context.WithCancel(context.TODO())
printerContext, cancel := context.WithCancel(context.TODO())

@rumpl rumpl closed this Nov 28, 2019
@rumpl rumpl deleted the feat-cancel-context branch November 28, 2019 09:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants