Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tarball publisher ctx handling #545

Merged
merged 1 commit into from
Dec 14, 2021
Merged

Conversation

jonjohnsonjr
Copy link
Collaborator

Previously, we'd use the ctx from the Build invocation, but because
remote stashes the remote.WithContext option, when we later go to fetch
the actual base image to write it out to a tarball, it will fail because
the Build ctx was cancelled.

For whatever reason, NewGo takes a ctx, so this change propagates the
badness from remote so we can use the NewGo ctx when we fetch base
images.

Previously, we'd use the ctx from the Build invocation, but because
remote stashes the remote.WithContext option, when we later go to fetch
the actual base image to write it out to a tarball, it will fail because
the Build ctx was cancelled.

For whatever reason, NewGo takes a ctx, so this change propagates the
badness from remote so we can use the NewGo ctx when we fetch base
images.
@@ -826,7 +830,9 @@ func updatePath(cf *v1.ConfigFile, appPath string) {
// Build implements build.Interface
func (g *gobuild) Build(ctx context.Context, s string) (Result, error) {
// Determine the appropriate base image for this import path.
baseRef, base, err := g.getBase(ctx, s)
// We use the overall gobuild.ctx because the Build ctx gets cancelled
Copy link
Member

Choose a reason for hiding this comment

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

Why does the Build ctx get cancelled early?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@codecov-commenter
Copy link

Codecov Report

Merging #545 (a56047a) into main (96bedf1) will increase coverage by 0.00%.
The diff coverage is 66.66%.

❗ Current head a56047a differs from pull request most recent head f130aab. Consider uploading reports for the commit f130aab to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main     #545   +/-   ##
=======================================
  Coverage   48.16%   48.17%           
=======================================
  Files          42       42           
  Lines        2182     2186    +4     
=======================================
+ Hits         1051     1053    +2     
- Misses        954      955    +1     
- Partials      177      178    +1     
Impacted Files Coverage Δ
pkg/build/gobuild.go 56.61% <66.66%> (-0.06%) ⬇️

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 96bedf1...f130aab. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants