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

Automatically clean up old TRAP caches #2306

Merged
merged 14 commits into from
May 24, 2024

Conversation

henrymercer
Copy link
Contributor

@henrymercer henrymercer commented May 23, 2024

This PR implements a new feature, behind a flag, that keeps only the newest TRAP cache for each language.

We call the Actions cache APIs directly as these have not yet been added to the @actions/cache npm package.

I have added a unit test exercising most of the functionality, and have also tested this manually using a test repo. I think an integration test is probably not worth it, particularly on this repo where the databases are small enough that TRAP caching skips the upload anyway.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@henrymercer henrymercer requested a review from a team as a code owner May 23, 2024 15:32
Comment on lines +241 to +246
{
id: 7,
key: "codeql-trap-1-2.0.0-swift-older",
created_at: "2024-02-21T14:25:00Z",
size_in_bytes: 300 * 1024 * 1024,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

This one wasn't deleted. Is it because the timestamp is identical to id 6? Wait...the code should only keep one cache per language. So, I'm not sure what's going on here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see now that the reasoning for this is a bit opaque without looking at the rest of the file. We're expecting to only clean up TRAP caches for JavaScript and Ruby as these are the only ones that the getTestConfigWithTempDir config specifies as languages to analyze in this job. I'll add a comment to make this clearer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. That makes a lot of sense.

@henrymercer henrymercer merged commit 584871b into main May 24, 2024
296 checks passed
@henrymercer henrymercer deleted the henrymercer/trap-cache-space-efficiency branch May 24, 2024 14:51
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.

None yet

2 participants