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

[1.14] Use Native Cache Action (instead of setup-go) #8538

Merged
merged 37 commits into from
Aug 7, 2023

Conversation

sam-heilbron
Copy link
Contributor

@sam-heilbron sam-heilbron commented Aug 3, 2023

Description

Continuation of work from #8535

CI changes

  • Use a shared action to setup the go code
  • Use the base cache action, instead of the caching provided by the setup-go action
  • Remove build cache from entries that we store

Context

I noticed inconsistent cache behaviors: https://github.com/solo-io/solo-projects/issues/4903#issuecomment-1664341061

The hash used in the cache key was identical for a PR that was merged into 1.14 as a cache entry for the main (1.15) branch. This shouldn't be the case because the go.sums are very different

The build cache (understandably) grows between the time we:

It's not clear to me what elements from that cache are useful for other jobs, and under what circumstances that cache should be invalidated (ie what do we use to build a cache key). As a result, I don't feel comfortable including it in our CI. I would rather understand exactly what is cached, and if we decide we need more caching, add it.

It should be noted this mirrors GME

Interesting decisions

I opted to just rely on the base cache action since it provides more functionality. To avoid drift in how we use it, I wrapped this setup in a shared github action.

Testing steps

Again, I can prove that the cache is built, but there isn't a perfect way to prove out the cache will be re-used for future PRs against this branch.

Notes for reviewers

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@github-actions github-actions bot added the keep pr updated signals bulldozer to keep pr up to date with base branch label Aug 3, 2023
@sam-heilbron sam-heilbron changed the title [DNM] Explore GHA Caching [1.14] Use Native Cache Action (instead of setup-go) Aug 3, 2023
@sam-heilbron sam-heilbron marked this pull request as ready for review August 3, 2023 21:39
@solo-changelog-bot
Copy link

Issues linked to changelog:
https://github.com/solo-io/solo-projects/issues/4903

Copy link
Contributor

@elcasteel elcasteel left a comment

Choose a reason for hiding this comment

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

LGTM - do we need to put some of these changes on main as well?

@sam-heilbron
Copy link
Contributor Author

LGTM - do we need to put some of these changes on main as well?

Yeah my plan is to prove out these changes on a branch (1.14 has most recent CI changes, but isn't developed against as often so if I break something it won't be as impactful). After I can prove out on a branch, I will make this consistent across our other LTS branches (including main)

@soloio-bulldozer soloio-bulldozer bot merged commit 5d8da07 into v1.14.x Aug 7, 2023
12 checks passed
@soloio-bulldozer soloio-bulldozer bot deleted the gha-cache-use-composite-action/1-14 branch August 7, 2023 17:37
@sam-heilbron sam-heilbron mentioned this pull request Aug 7, 2023
4 tasks
sam-heilbron added a commit that referenced this pull request Aug 8, 2023
* try to create re-usable prep-go-runner lik other branches

* fix yaml

* fix yaml

* introduce cache delete

* use env.goversion

* use previous step

* change step name

* use env variables, dont hardcoded

* formatting change

* dont use set-output

* add go mod action in cache-setup

* runs -> run

* no-op to trigger ci

* simplfiy codegen to use prep-go-runner

* tidy after download

* add mod-tidy

* remove cache cleanup, add in other pr

* use prep-go-runner more broadly

* remove testing branch

* tidy after codegen

* use explicit list

* use list again

* include github workspace in cache path

* only cache mod-download

* set path on cache save

* fix cache logic

* fix pathing

* cache go tools and test tools

* use on pull request to see if cache is shared

* no-op to trigger ci

* emit cache contents

* list sizes

* max depth 1

* emit cache size after tests and codegen

* only use modcache

* fix prep go runner

* add changelog
soloio-bulldozer bot pushed a commit that referenced this pull request Aug 8, 2023
* [1.14] Introduce GHA Go Cache on LTS (#8535)

* have codegen run on merge

* add changelog

* cache go modules job, dont reuse codegen

* undo codegen job changes

* filter only lts branches

* [1.14] Use Native Cache Action (instead of setup-go) (#8538)

* try to create re-usable prep-go-runner lik other branches

* fix yaml

* fix yaml

* introduce cache delete

* use env.goversion

* use previous step

* change step name

* use env variables, dont hardcoded

* formatting change

* dont use set-output

* add go mod action in cache-setup

* runs -> run

* no-op to trigger ci

* simplfiy codegen to use prep-go-runner

* tidy after download

* add mod-tidy

* remove cache cleanup, add in other pr

* use prep-go-runner more broadly

* remove testing branch

* tidy after codegen

* use explicit list

* use list again

* include github workspace in cache path

* only cache mod-download

* set path on cache save

* fix cache logic

* fix pathing

* cache go tools and test tools

* use on pull request to see if cache is shared

* no-op to trigger ci

* emit cache contents

* list sizes

* max depth 1

* emit cache size after tests and codegen

* only use modcache

* fix prep go runner

* add changelog

* Validate GHA Cache Hit (#8545)

* Add no-op commit

* fix cache hit logic, remove do-not-submit

* add changelog

* consolidate changelogs
sam-heilbron added a commit that referenced this pull request Aug 8, 2023
* [1.14] Introduce GHA Go Cache on LTS (#8535)

* have codegen run on merge

* add changelog

* cache go modules job, dont reuse codegen

* undo codegen job changes

* filter only lts branches

* [1.14] Use Native Cache Action (instead of setup-go) (#8538)

* try to create re-usable prep-go-runner lik other branches

* fix yaml

* fix yaml

* introduce cache delete

* use env.goversion

* use previous step

* change step name

* use env variables, dont hardcoded

* formatting change

* dont use set-output

* add go mod action in cache-setup

* runs -> run

* no-op to trigger ci

* simplfiy codegen to use prep-go-runner

* tidy after download

* add mod-tidy

* remove cache cleanup, add in other pr

* use prep-go-runner more broadly

* remove testing branch

* tidy after codegen

* use explicit list

* use list again

* include github workspace in cache path

* only cache mod-download

* set path on cache save

* fix cache logic

* fix pathing

* cache go tools and test tools

* use on pull request to see if cache is shared

* no-op to trigger ci

* emit cache contents

* list sizes

* max depth 1

* emit cache size after tests and codegen

* only use modcache

* fix prep go runner

* add changelog

* Validate GHA Cache Hit (#8545)

* Add no-op commit

* fix cache hit logic, remove do-not-submit

* add changelog

* consolidate changelogs
soloio-bulldozer bot pushed a commit that referenced this pull request Aug 8, 2023
* [1.13] Introduce GHA Cache on LTS (#8550)

* [1.14] Introduce GHA Go Cache on LTS (#8535)

* have codegen run on merge

* add changelog

* cache go modules job, dont reuse codegen

* undo codegen job changes

* filter only lts branches

* [1.14] Use Native Cache Action (instead of setup-go) (#8538)

* try to create re-usable prep-go-runner lik other branches

* fix yaml

* fix yaml

* introduce cache delete

* use env.goversion

* use previous step

* change step name

* use env variables, dont hardcoded

* formatting change

* dont use set-output

* add go mod action in cache-setup

* runs -> run

* no-op to trigger ci

* simplfiy codegen to use prep-go-runner

* tidy after download

* add mod-tidy

* remove cache cleanup, add in other pr

* use prep-go-runner more broadly

* remove testing branch

* tidy after codegen

* use explicit list

* use list again

* include github workspace in cache path

* only cache mod-download

* set path on cache save

* fix cache logic

* fix pathing

* cache go tools and test tools

* use on pull request to see if cache is shared

* no-op to trigger ci

* emit cache contents

* list sizes

* max depth 1

* emit cache size after tests and codegen

* only use modcache

* fix prep go runner

* add changelog

* Validate GHA Cache Hit (#8545)

* Add no-op commit

* fix cache hit logic, remove do-not-submit

* add changelog

* consolidate changelogs

* move changelog

* fix bad merge

* fix changelog

* remove duplicate mod-tidy
sheidkamp pushed a commit that referenced this pull request Aug 22, 2023
* [1.13] Introduce GHA Cache on LTS (#8550)

* [1.14] Introduce GHA Go Cache on LTS (#8535)

* have codegen run on merge

* add changelog

* cache go modules job, dont reuse codegen

* undo codegen job changes

* filter only lts branches

* [1.14] Use Native Cache Action (instead of setup-go) (#8538)

* try to create re-usable prep-go-runner lik other branches

* fix yaml

* fix yaml

* introduce cache delete

* use env.goversion

* use previous step

* change step name

* use env variables, dont hardcoded

* formatting change

* dont use set-output

* add go mod action in cache-setup

* runs -> run

* no-op to trigger ci

* simplfiy codegen to use prep-go-runner

* tidy after download

* add mod-tidy

* remove cache cleanup, add in other pr

* use prep-go-runner more broadly

* remove testing branch

* tidy after codegen

* use explicit list

* use list again

* include github workspace in cache path

* only cache mod-download

* set path on cache save

* fix cache logic

* fix pathing

* cache go tools and test tools

* use on pull request to see if cache is shared

* no-op to trigger ci

* emit cache contents

* list sizes

* max depth 1

* emit cache size after tests and codegen

* only use modcache

* fix prep go runner

* add changelog

* Validate GHA Cache Hit (#8545)

* Add no-op commit

* fix cache hit logic, remove do-not-submit

* add changelog

* consolidate changelogs

* move changelog

* fix bad merge

* fix changelog

* remove duplicate mod-tidy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep pr updated signals bulldozer to keep pr up to date with base branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants