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

Detect ci.yml changes when restoring caches #35

Open
gregmedd opened this issue Apr 15, 2024 · 1 comment
Open

Detect ci.yml changes when restoring caches #35

gregmedd opened this issue Apr 15, 2024 · 1 comment

Comments

@gregmedd
Copy link
Contributor

#33 introduced caching for prerequisite package builds. However, if a change is made to the ci.yml in this repo without a corresponding change in one of the external repos, the cache will override and result in a bad build. This can be seen in #32 (https://github.com/eclipse-uprotocol/up-client-zenoh-cpp/actions/runs/8692147864) - GitHub actions will happily fall back to the cache from the main branch in the absence of one from the PR branch.

A temporary workaround would be to clear the cache on main if a PR is changing the CI configuration, but that requires intervention from a committer to unblock other contributors.

A full fix would find a way to get the hash of the ci.yml file and embed that into the cache key to prevent this from happening in the future.

@gregmedd
Copy link
Contributor Author

Looks like GITHUB_WORKFLOW_SHA can fix this

gregmedd added a commit to gregmedd/up-transport-zenoh-cpp that referenced this issue Apr 15, 2024
GitHub will fall back to the cache from the target branch of a PR if it
fails to find a cache for the source branch of a PR. This causes issues
if the PR is changing the ci.yml file (see eclipse-uprotocol#32) without one of the
dependency repos changing (up-cpp and zenoh-c).

This change adds the SHA of the workflow file to the cache key so that
changes to ci.yml will invalidate the caches.

While this reduces the value of the caches when iterating on ci.yml
changes, a developer working in ci.yml would have the ability to remove
this temporarily if needed.
gregmedd added a commit to gregmedd/up-transport-zenoh-cpp that referenced this issue Apr 15, 2024
gregmedd added a commit to gregmedd/up-transport-zenoh-cpp that referenced this issue Apr 15, 2024
GitHub will fall back to the cache from the target branch of a PR if it
fails to find a cache for the source branch of a PR. This causes issues
if the PR is changing the ci.yml file (see eclipse-uprotocol#32) without one of the
dependency repos changing (up-cpp and zenoh-c).

This change adds the SHA of the workflow file to the cache key so that
changes to ci.yml will invalidate the caches.

While this reduces the value of the caches when iterating on ci.yml
changes, a developer working in ci.yml would have the ability to remove
this temporarily if needed.
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 a pull request may close this issue.

1 participant