Skip to content

Attempting to fix CI build's cache issues - #4915

Closed
anupsdf wants to merge 15 commits into
stellar:masterfrom
anupsdf:cache_gha_builds
Closed

Attempting to fix CI build's cache issues#4915
anupsdf wants to merge 15 commits into
stellar:masterfrom
anupsdf:cache_gha_builds

Conversation

@anupsdf

@anupsdf anupsdf commented Aug 29, 2025

Copy link
Copy Markdown
Contributor

what

Attempting to fix CI build's cache issues since it seems our CI builds are not using the cache well.

The problems identified are,

  1. steps.cache.outputs.cache-primary-key was used when saving the cache but in probe cache we used a different key. This might be why it was broken.
  2. Added an additional fallback restore key ${{ runner.os }}-${{ matrix.toolchain }}- to improve cache hit rates. (Need an extra set of eye here if this seems right)
  3. Cache was only saved on master branch, limiting benefits for PR builds.

@anupsdf
anupsdf requested review from Copilot and graydon and removed request for Copilot August 29, 2025 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves CI caching efficiency by fixing key naming issues and expanding cache availability beyond the master branch. The changes address poor cache hit rates by using more descriptive cache keys and adding fallback restore mechanisms.

  • Replaces confusing cache key reference with explicit OS-toolchain-protocol-SHA format
  • Adds hierarchical restore keys to improve cache hit rates across builds
  • Removes master branch restriction for cache saving to benefit PR builds

Comment thread .github/workflows/build.yml Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probe Cache step above was looking for a different key and not this steps.cache.outputs.cache-primary-key

dmkozh and others added 4 commits August 29, 2025 15:05
Also separated config updates from the in-memory config.

The motivation of the changes is as follows:

- Config is semantically not mutable. It's just a view for the ledger snapshot that is convenient to pass around and sometimes store.
- Config caching during apply resulted in some bugs (like broken updates for some state archival settings). Loading the config is cheap enough, so we just load it from LTX during the apply process.
- Updates are performed on the ledger entries and they don't need to be coupled with the view data structure.

On-demand config loading is still not 100% fool-proof and it's still possible to accidentally access stale config during the apply flow. However, I don't have a better idea for how this could be further improved at the moment. But at least outside of the apply flow only the last closed config can be accessed now, which I think is a net win for the change.
Attempting to fix CI build's cache issues
marta-lokhova and others added 5 commits August 29, 2025 15:07
Also separated config updates from the in-memory config.

The motivation of the changes is as follows:

- Config is semantically not mutable. It's just a view for the ledger snapshot that is convenient to pass around and sometimes store.
- Config caching during apply resulted in some bugs (like broken updates for some state archival settings). Loading the config is cheap enough, so we just load it from LTX during the apply process.
- Updates are performed on the ledger entries and they don't need to be coupled with the view data structure.

On-demand config loading is still not 100% fool-proof and it's still possible to accidentally access stale config during the apply flow. However, I don't have a better idea for how this could be further improved at the moment. But at least outside of the apply flow only the last closed config can be accessed now, which I think is a net win for the change.
Attempting to fix CI build's cache issues
@anupsdf
anupsdf changed the base branch from master to acceptance-test-pass August 29, 2025 22:12
@anupsdf
anupsdf changed the base branch from acceptance-test-pass to master August 29, 2025 22:12
@anupsdf
anupsdf marked this pull request as draft August 29, 2025 22:30
@anupsdf

anupsdf commented Sep 1, 2025

Copy link
Copy Markdown
Contributor Author

Test deletion of cache when PR is closed.

@anupsdf anupsdf closed this Sep 1, 2025
@anupsdf

anupsdf commented Sep 1, 2025

Copy link
Copy Markdown
Contributor Author

Deletion failed with message,
https://github.com/stellar/stellar-core/actions/runs/17387784116/job/49356946111

Fetching list of cache key
Deleting caches...
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1033210120)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1033208106)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1033206949)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1033206623)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1033193472)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019479125)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019457824)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019481055)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019447847)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019450362)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019450756)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019440683)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019432768)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019432654)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019431306)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019412496)
X Failed to delete cache: HTTP 403: Resource not accessible by integration (https://api.github.com/repos/stellar/stellar-core/actions/caches/1019405069)

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.

4 participants