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

Use caching in the CI pipeline #2308

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Aug 17, 2022

Use the Azure DevOps Cache task to cache the go module directory, and the go build directory, so that go build/test run faster. I am using a separate cache key for the native go build (which is mage build) and the cross compiled binaries (which is mage xbuildall), since they generate different artifacts in the go build directory. Once a cache artifact is persisted, it can't be updated or removed. It is keyed based on our go.sum file along with the agent OS. When we need to clear the cached artifacts, the leading version prefix should be incremented, which is used just to bust the cache.

This has brought our builds down from ~6m to ~1m per job. The smoke test on Windows is still slow, but I'll address that in another PR (or most likely updating the agent image for Windows).

@carolynvs carolynvs added the playground 🙈 Pull request to try stuff out and see if it builds. Don't look! label Aug 17, 2022
@carolynvs carolynvs force-pushed the cache-go-modules branch 2 times, most recently from d806eaa to 34cf1dc Compare August 17, 2022 20:51
@carolynvs carolynvs force-pushed the cache-go-modules branch 2 times, most recently from acf3813 to c7031ee Compare August 29, 2022 22:36
Use the Azure DevOps Cache task to cache the go module directory, and the go build directory, so that go build/test run faster. I am using a separate cache key for the native go build (which is mage build) and the cross compiled binaries (which is mage xbuildall), since
they generate different artifacts in the go build directory. Once a cache artifact is persisted, it can't be updated or removed. It is keyed based on our go.sumfile along with the agent OS. When we need to clear the cached artifacts, the leading version prefix should be incremented, which is used just to bust the cache.

This has brought our builds down from ~6m to ~1m per job. The smoke test on Windows is still slow, but I'll address that in another PR (or most likely updating the agent image for Windows).

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs changed the title Cache go modules to improve CI performance Use caching in the CI pipeline Aug 30, 2022
@carolynvs carolynvs marked this pull request as ready for review August 30, 2022 16:01
@carolynvs carolynvs removed the playground 🙈 Pull request to try stuff out and see if it builds. Don't look! label Aug 30, 2022
@carolynvs carolynvs merged commit ec1428f into getporter:release/v1 Aug 30, 2022
@carolynvs carolynvs deleted the cache-go-modules branch August 30, 2022 16:01
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.

1 participant