GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Automatically clean up old TRAP caches by henrymercer · Pull Request #2306 · github/codeql-action

Conversation

@henrymercer

@henrymercer henrymercer commented May 23, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
henrymercer added 13 commits May 21, 2024 22:27
@henrymercer
List matching Actions caches
cc96c82
@henrymercer
Restrict TRAP cache cleanup to analyzed language
087f0b0
@henrymercer
Look at ref rather than default branch
4fd6c0d
Since we'll only cleanup when running on the default branch
@henrymercer
Invoke cleanup in analyze Action
0b42149
@henrymercer
Log key and ref for which we're retrieving caches
1bea17f
@henrymercer
Use automatic pagination mapping function
898dead
@henrymercer
Clean up old TRAP caches
610e722
@henrymercer
Add specific error for lacking actions:write permission
59af9fc
@henrymercer
Add telemetry for TRAP cache cleanup
4f2b182
@henrymercer
Put TRAP cache cleanup behind a feature flag
6ccd563
@henrymercer
Add unit test for cleanup
f7f7192
@henrymercer
Improve log message when there's nothing to clean up
fdba1f9
@henrymercer
Add changelog note
9983853
@henrymercer
henrymercer requested a review from a team as a code owner May 23, 2024 15:32
aeisenberg
aeisenberg reviewed May 24, 2024
View reviewed changes
Comment thread src/trap-caching.test.ts
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,
},

@aeisenberg aeisenberg May 24, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@henrymercer henrymercer May 24, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aeisenberg aeisenberg May 24, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@henrymercer
Add some comments to explain test case
f629cb3
aeisenberg
aeisenberg approved these changes May 24, 2024
View reviewed changes
@henrymercer
henrymercer merged commit 584871b into main May 24, 2024
@henrymercer
henrymercer deleted the henrymercer/trap-cache-space-efficiency branch May 24, 2024 14:51
This was referenced May 31, 2024
Merge main into releases/v3 #2317
Merged
Merge releases/v3 into releases/v2 #2319
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Apr 3, 2026
Release v0.0.6 t0k0sh1/ry#619
Merged
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aeisenberg aeisenberg aeisenberg approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@henrymercer @aeisenberg
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.