Skip to content

Invalidate the CI cache when containers are changed#4394

Merged
JordanMartinez merged 2 commits intopurescript:masterfrom
vtrl:ci/invalidate
Sep 27, 2022
Merged

Invalidate the CI cache when containers are changed#4394
JordanMartinez merged 2 commits intopurescript:masterfrom
vtrl:ci/invalidate

Conversation

@purefunctor
Copy link
Copy Markdown
Member

Description of the change

This changes the cache keys for the workflows to take into account the container they're being run on. As mentioned in #4391 (comment), CI is currently failing with a libtinfo error:

/root/.stack/compiler-tools/x86_64-linux/ghc-9.2.3/bin/weeder: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

My guess is that it has to do with the cache being retained after the container was changed since #4391 itself didn't run into this failure as it built its own weeder.


Checklist:

  • Added a file to CHANGELOG.d for this PR (see CHANGELOG.d/README.md)
  • Added myself to CONTRIBUTORS.md (if this is my first contribution)
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@purefunctor
Copy link
Copy Markdown
Member Author

purefunctor commented Sep 27, 2022

It looks like my guess was correct 😄. Take a look at these runs:

pre-container-bump: https://github.com/purescript/purescript/actions/runs/2767436187/jobs/4349010103
container-bump-pr: https://github.com/purescript/purescript/actions/runs/3120713336/jobs/5061508296
post-container-bump: https://github.com/purescript/purescript/actions/runs/3132673764/jobs/5085265725

All of these runs use the same cache key for CI. If I understand correctly, the reason why the container-bump-pr was able to build just fine was because GitHub isolates the caches when on different branches or forks, so it just built its own weeder. When the PR was merged, post-container-bump now has access to the same cache that pre-container-bump did, causing the failure with libtinfo.

Edit: Also feel free to add a CHANGELOG.d for this if anyone's up for merging. I wrote this on-the-go and might not get to it until tomorrow...

/root/.stack
${{ steps.haskell.outputs.stack-root }}
key: "${{ runner.os }}-MdyPsf-${{ hashFiles('stack.yaml') }}"
key: "${{ runner.os }}-${{ job.container.id }}-MdyPsf-${{ hashFiles('stack.yaml') }}"
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.

Where are the docs on job.container.id?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Gotcha. Thanks!

@JordanMartinez JordanMartinez merged commit 782c836 into purescript:master Sep 27, 2022
@rhendric
Copy link
Copy Markdown
Member

Nice, thanks for fixing this!

@purefunctor purefunctor deleted the ci/invalidate branch September 27, 2022 22:39
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.

3 participants