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

[Enhancement] improve image build efficiency #1191

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

Congrool
Copy link
Member

@Congrool Congrool commented Feb 6, 2023

Signed-off-by: Congrool [email protected]

What type of PR is this?

/kind enhancement

What this PR does / why we need it:

Currently, if we build all images, it has to download dependent go package for several times, which makes the build too slow.
In this pr, we will start a container openyurt-build which will build all binaries first, and then using these built binaries to build images.

Also, we can still only build one of these image as we need. For example:

make docker-build WHAT=yurthub

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

@openyurt-bot
Copy link
Collaborator

@Congrool: GitHub didn't allow me to assign the following users: your_reviewer.

Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

Signed-off-by: Congrool [email protected]

What type of PR is this?

/kind enhancement

What this PR does / why we need it:

Currently, if we build all images, it has to download dependent go package for several times, which makes the build too slow.
In this pr, we will start a container openyurt-build which will build all binaries first, and then using these built binaries to build images.

Also, we can still only build one of these image as we need. For example:

make docker-build WHAT=yurthub

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openyurt-bot openyurt-bot added the kind/enhancement kind/enhancement label Feb 6, 2023
@openyurt-bot openyurt-bot added the size/L size/L: 100-499 label Feb 6, 2023
@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Merging #1191 (df13bfa) into master (a36f3be) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1191   +/-   ##
=======================================
  Coverage   52.16%   52.16%           
=======================================
  Files         110      110           
  Lines       13848    13848           
=======================================
  Hits         7224     7224           
  Misses       5977     5977           
  Partials      647      647           
Flag Coverage Δ
unittests 52.16% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Congrool
Copy link
Member Author

Congrool commented Feb 6, 2023

The time of the build-image step in e2e-tests can be reduced from orginal 6m-9m to current 2m30s.

@Congrool
Copy link
Member Author

Congrool commented Feb 6, 2023

/hold

@openyurt-bot openyurt-bot added the do-not-merge/hold do-not-merge/hold label Feb 6, 2023
@Congrool Congrool force-pushed the fast-build branch 4 times, most recently from 4e60aaf to 0f20649 Compare February 6, 2023 15:03
@Congrool
Copy link
Member Author

Congrool commented Feb 6, 2023

/unhold

@rambohe-ch
Copy link
Member

@Congrool It's good job to improve image build efficiency, and cost time of e2e-tests has reduced from 25m to 17m.

but make docker-push command can not work after hack/dockerfiles/xxx modified, maybe we need to prepare two different dockerfiles for make docker-push and make docker-build.

@Congrool
Copy link
Member Author

Congrool commented Feb 7, 2023

/hold cancel

@openyurt-bot openyurt-bot removed the do-not-merge/hold do-not-merge/hold label Feb 7, 2023
@Congrool
Copy link
Member Author

Congrool commented Feb 7, 2023

This current improvement is only useful for build images, but not suitable for relasing images which is cross-platform. Thus, we still use the original dockerfile to release images.

@openyurt-bot openyurt-bot added the approved approved label Feb 7, 2023
@rambohe-ch
Copy link
Member

/lgtm
/approve

@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Congrool, rambohe-ch

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openyurt-bot openyurt-bot merged commit 971f9b6 into openyurtio:master Feb 7, 2023
@Congrool Congrool deleted the fast-build branch February 27, 2023 07:15
@xavier-hou
Copy link
Member

xavier-hou commented Apr 12, 2023

@Congrool When I use make docker-build, I find most of the time is taken up by downloading dependent go packages even though this process has now been reduced to just once.

When testing locally, most of dependency libraries have been downloaded to local machine in advance, which will reduce the time it takes to execute go build. So does it make sense to build binaries locally and then copy them to container environment to build the images?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved kind/enhancement kind/enhancement lgtm lgtm size/L size/L: 100-499
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants