-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
JS: Change how TRAP cache is configured #9949
Conversation
It sounds like we deliberately prevent ourselves from using "our own" cache on a PR where codeql is run multiple times. Is that cache effect considered insignificant compared to the cache on main? |
In this initial prototype, the plan is to only keep a cache from the latest run on |
Great, thanks for confirming and explaining. The implementation LGTM, but I'll defer to @asgerf for the final decision. Long shot: perhaps @max-schaefer has some LGTM_TRAP_CACHE usage that we do not know about. |
I do not, but many thanks for considering it! |
f8f5cbd
to
2e1c394
Compare
github/codeql-action#1172 is the PR on the Action that will start hitting this code path. It's gated behind a feature flag. |
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.
LGTM, just a weird indentation issue
* | ||
* @return a TRAP cache | ||
*/ | ||
public static ITrapCache fromExtractorOptions() { |
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.
* | |
* @return a TRAP cache | |
*/ | |
public static ITrapCache fromExtractorOptions() { | |
* | |
* @return a TRAP cache | |
*/ | |
public static ITrapCache fromExtractorOptions() { |
Not sure what happened to the indentation there
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.
Good spot, fixed.
2e1c394
to
5c3d395
Compare
This PR refactors how we configure the TRAP cache for the JavaScript extractor. Previously, we had two different mechanisms:
LGTM_TRAP_CACHE
environment variables.--trap-cache
flags.As far as I can tell, neither of these mechanisms is actually in use at the moment. So, before we create new uses for it, let's take the opportunity to refactor both those code paths to flow through the same place, and be configured by the new extractor options functionality documented here, which is how the Action's upcoming TRAP caching feature will configure the cache.
As part of this, I've also added a new option that configures whether the cache should be written to. This will be needed in the new usage of this cache in the Action, where we will distinguish runs on
main
(which will update the cache) and runs on PRs (which may read a cache, but will never bother writing to it since it will be discarded).