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

Build each platform concurrently #527

Merged
merged 3 commits into from
Dec 9, 2021

Conversation

jonjohnsonjr
Copy link
Collaborator

At least on my machine, this is slightly faster on a cold build and
saves significant time on a warm build.

Fixes #192

At least on my machine, this is slightly faster on a cold build and
saves significant time on a warm build.
@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2021

Codecov Report

Merging #527 (5cb217b) into main (ad0607f) will increase coverage by 0.05%.
The diff coverage is 64.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #527      +/-   ##
==========================================
+ Coverage   48.11%   48.16%   +0.05%     
==========================================
  Files          42       42              
  Lines        2170     2182      +12     
==========================================
+ Hits         1044     1051       +7     
- Misses        950      954       +4     
- Partials      176      177       +1     
Impacted Files Coverage Δ
pkg/build/limit.go 55.55% <ø> (ø)
pkg/build/options.go 72.72% <0.00%> (-5.33%) ⬇️
pkg/build/gobuild.go 56.66% <70.37%> (+0.16%) ⬆️
pkg/commands/resolver.go 31.88% <100.00%> (+0.30%) ⬆️

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 ad0607f...5cb217b. Read the comment docs.

@@ -872,9 +873,12 @@ func (g *gobuild) buildAll(ctx context.Context, ref string, baseIndex v1.ImageIn
return nil, err
}

errg, ctx := errgroup.WithContext(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we want this to share it's threadpool with the --jobs pool, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Plumbed this down into buildOne

if bo.ConcurrentBuilds == 0 {
bo.ConcurrentBuilds = runtime.GOMAXPROCS(0)
}
innerBuilder = build.NewLimiter(innerBuilder, bo.ConcurrentBuilds)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this now dead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is, but build.NewLimiter is public so I'm somewhat reluctant to just delete it.

Copy link
Member

Choose a reason for hiding this comment

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

Can we mark it as Deprecated at least, and delete it in the future? If someone depends on it (highly unlikely) and it's not actively used by the codebase that's not a great place to be in either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -123,6 +131,7 @@ func (gbo *gobuildOpener) Open() (Interface, error) {
buildToDiff: map[string]buildIDToDiffID{},
diffToDesc: map[string]diffIDToDescriptor{},
},
semaphore: semaphore.NewWeighted(int64(gbo.jobs)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, do we Open() once per ko invocation or once per build? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's once per "builder", which means the --jobs isn't shared across build configs... which is annoying, but I'm happy to fix that if someone actually complains...

mattmoor
mattmoor previously approved these changes Dec 8, 2021
@jonjohnsonjr jonjohnsonjr merged commit 2502eb9 into ko-build:main Dec 9, 2021
@jonjohnsonjr jonjohnsonjr deleted the concurrent branch December 9, 2021 19:02
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.

Investigate fanning out multi-platform builds
4 participants