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

[CI] improve the ci efficiency by parallelizing the build tasks #398

Conversation

nwangfw
Copy link
Collaborator

@nwangfw nwangfw commented Nov 15, 2024

Pull Request Description

In the initial version, we do not care the efficiency that much and we use single runner to build the images one by one.

In this PR, we create four runners to build images in parallel and then use another runner to conduct tests.

Related Issues

Resolves: #[128]

@nwangfw nwangfw linked an issue Nov 15, 2024 that may be closed by this pull request
@nwangfw
Copy link
Collaborator Author

nwangfw commented Nov 15, 2024

Tested on local mac machine, reduced about 40% docker building time. However, based on online Integration Test, there is no performance gain.

Makefile Outdated
@@ -133,7 +133,8 @@ define push_image
endef

.PHONY: docker-build-all
docker-build-all: docker-build-controller-manager docker-build-plugins docker-build-runtime docker-build-users ## Build all docker images
docker-build-all: ## Build all docker images in parallel
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Jeffwan
Copy link
Collaborator

Jeffwan commented Nov 19, 2024

there's another option

leverage the matrix to increase the parallelisme
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix

    strategy:
      matrix:
        image: [controller-manager, plugins, runtime, users]
# then let's do not use make docker-build-all, instead, let's build separate ones.

@Jeffwan
Copy link
Collaborator

Jeffwan commented Nov 19, 2024

Please help write the PR description and linked issue. check #205 as an example

@xieus
Copy link
Collaborator

xieus commented Nov 19, 2024

Tested on local mac machine, reduced about 40% docker building time. However, based on online Integration Test, there is performance gain.

No performance gain for online integration test?

@nwangfw
Copy link
Collaborator Author

nwangfw commented Nov 19, 2024

Tested on local mac machine, reduced about 40% docker building time. However, based on online Integration Test, there is performance gain.

No performance gain for online integration test?

Tested on local mac machine, reduced about 40% docker building time. However, based on online Integration Test, there is performance gain.

No performance gain for online integration test?

No, thanks for finding this typo. Will try some new ideas as Jiaxin suggested.

@nwangfw nwangfw force-pushed the 128-ci-improve-the-ci-efficiency-by-parallelizing-the-build-tasks branch from 1baa693 to 814b189 Compare November 19, 2024 19:48
@nwangfw nwangfw changed the title improve the ci efficiency by parallelizing the build tasks [CI] improve the ci efficiency by parallelizing the build tasks Nov 19, 2024
@nwangfw nwangfw force-pushed the 128-ci-improve-the-ci-efficiency-by-parallelizing-the-build-tasks branch 2 times, most recently from 690bc5b to b1aa5cd Compare November 19, 2024 21:58
@nwangfw
Copy link
Collaborator Author

nwangfw commented Nov 19, 2024

there's another option

leverage the matrix to increase the parallelisme https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix

    strategy:
      matrix:
        image: [controller-manager, plugins, runtime, users]
# then let's do not use make docker-build-all, instead, let's build separate ones.

The matrix approach works after some dependency modification! Now, we are able to have 4 runners to build images in parallel. The overall test time reduced 1/3 (from ~9m to ~6m)

@nwangfw nwangfw requested a review from Jeffwan November 19, 2024 22:19
@nwangfw nwangfw marked this pull request as ready for review November 19, 2024 22:19
path: ${{ matrix.image }}.tar
retention-days: 1

installation-test:
Copy link
Collaborator

Choose a reason for hiding this comment

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

em. are those images not visible to further loading process? is artifact upload required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the previous version, we only used 1 runner and we don't need upload and download steps. However, we use 5 runners in total (the first 4 runners to build images and the last runner to run the installation test) and that's why we need upload process for the first four runners and the download process for the last runner.
image

@nwangfw nwangfw force-pushed the 128-ci-improve-the-ci-efficiency-by-parallelizing-the-build-tasks branch 4 times, most recently from 93a297a to 5e5c7d5 Compare November 19, 2024 23:54
@nwangfw nwangfw force-pushed the 128-ci-improve-the-ci-efficiency-by-parallelizing-the-build-tasks branch from 5e5c7d5 to 3b70b6e Compare November 20, 2024 00:07
@Jeffwan Jeffwan merged commit d54b96a into main Nov 20, 2024
14 checks passed
@Jeffwan Jeffwan deleted the 128-ci-improve-the-ci-efficiency-by-parallelizing-the-build-tasks branch November 20, 2024 00:50
gangmuk pushed a commit that referenced this pull request Jan 25, 2025
improve-the-ci-efficiency-by-parallelizing-the-build-tasks
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.

[CI] Improve the CI efficiency by parallelizing the build tasks
3 participants