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 concurrency issue in multi-config #5646

Merged
merged 2 commits into from
Apr 10, 2021

Conversation

gsquared94
Copy link
Contributor

Fixes #5645

@gsquared94 gsquared94 requested a review from a team as a code owner April 8, 2021 01:52
@google-cla google-cla bot added the cla: yes label Apr 8, 2021
@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #5646 (cff5987) into master (b496731) will increase coverage by 0.00%.
The diff coverage is 84.61%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5646   +/-   ##
=======================================
  Coverage   70.53%   70.53%           
=======================================
  Files         410      410           
  Lines       15624    15631    +7     
=======================================
+ Hits        11020    11026    +6     
- Misses       3791     3794    +3     
+ Partials      813      811    -2     
Impacted Files Coverage Δ
pkg/skaffold/build/builder_mux.go 44.73% <75.00%> (+10.36%) ⬆️
pkg/skaffold/schema/defaults/defaults.go 87.57% <100.00%> (ø)
pkg/skaffold/util/util.go 83.82% <100.00%> (+0.24%) ⬆️
pkg/skaffold/test/test_factory.go 69.56% <0.00%> (-2.53%) ⬇️
pkg/skaffold/deploy/kpt/kpt.go 74.22% <0.00%> (-1.05%) ⬇️
pkg/skaffold/runner/dev.go 73.00% <0.00%> (+0.33%) ⬆️
pkg/skaffold/test/custom/custom.go 60.22% <0.00%> (+1.27%) ⬆️
pkg/skaffold/runner/intent.go 76.92% <0.00%> (+2.45%) ⬆️
pkg/skaffold/test/structure/structure.go 90.69% <0.00%> (+2.56%) ⬆️

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 b496731...cff5987. Read the comment docs.

pkg/skaffold/build/builder_mux.go Outdated Show resolved Hide resolved
Comment on lines +489 to +491
if len(b.Artifacts) > 0 {
b.LocalBuild.Concurrency = &constants.DefaultLocalConcurrency
}
Copy link
Member

Choose a reason for hiding this comment

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

What if we instead pushed this to the local builder itself, so that it determined the default concurrency at build time?

(And isn't this duplicating what is being done in the call to withLocalBuild() in defaults.go?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a function in the test file that sets up the expected config

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thought about pushing this to local.Builder but it doesn't maintain the []*latest.Artifact slice and it seemed more convoluted to first set the default to 1 but later ignore it in the method.

Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we just change this method in the local builder to return 1?

func (b *Builder) Concurrency() int {
if b.local.Concurrency == nil {
return 0
}
return *b.local.Concurrency
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we don't set it in default.Set then we'll need a reference to the []*latest.Artifact per config in local.Builder to decide if it should return 0 or 1 by default (0 if len(artifacts) == 0, otherwise 1). That plumbing seems more convoluted that this fix.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I didn't clue in that this definition was in a test — I thought it was the implementation of withLocalBuilder in pkg/skaffold/schema/defaults/ 🤦

@gsquared94 gsquared94 added the kokoro:force-run forces a kokoro re-run on a PR label Apr 9, 2021
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Apr 9, 2021
Comment on lines +489 to +491
if len(b.Artifacts) > 0 {
b.LocalBuild.Concurrency = &constants.DefaultLocalConcurrency
}
Copy link
Member

Choose a reason for hiding this comment

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

Oh I didn't clue in that this definition was in a test — I thought it was the implementation of withLocalBuilder in pkg/skaffold/schema/defaults/ 🤦

@gsquared94 gsquared94 merged commit 60458eb into GoogleContainerTools:master Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build concurrency setting not applied correctly when one config uses only imported artifacts
3 participants