GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add feature flag to roll out JAR minimization in the Java extractor by nickrolfe · Pull Request #3107 · github/codeql-action Conversation
Contributor
This adds a feature flag which, when enabled, will have two effects:
Risk assessmentFor internal use only. Please select the risk level of this change:
Merge / deployment checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pull Request OverviewThis PR adds a feature flag to control JAR minimization in the Java extractor, which will reduce the size of dependency JARs stored in Actions caches. The feature is gated behind the Key changes:
Reviewed ChangesCopilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments. Show a summary per file
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
nickrolfe
force-pushed
the
nickrolfe/minimize-jars
branch
from
a9e4902 to
f14c640
Compare
mbg
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for putting this together! I have a few minor comments about how the code is organised that are mostly suggestions, and one major comment about how the FF affects the cache key. In particular, I think that disabling the FF wouldn't prevent a minified cache from being restored -- see my comment there for more details.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be a
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I considered that, and thought it better to use a minimum version for two reasons:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No strong feelings here, but isn't setting
This makes sense. Am I assuming that your implicit thinking here is that
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, if the flag rollout reveals problems that require a fix in the extractor and a new CLI release, we can just bump the If we used I don't have particularly strong feelings about this, but using
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, we had to do that recently with something else.
The tricky aspect here is always understanding all the possible permutations in which the Action, the CLI, and the FFs interact. The If things go wrong, then bumping To prevent that, we'd either need a different
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
| logger.debug( | ||
| "CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS is already set, so the Action will not override it.", | ||
| ); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Minor: Do you see any value in including the existing value of CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS here?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| core.exportVariable("CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB", "true"); | ||
| } | ||
| } | ||
| if (process.env["CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS"]) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Consider adding CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS to EnvVar in environment.ts and then use that everywhere.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| logger.debug( | ||
| "CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS is already set, so the Action will not override it.", | ||
| ); | ||
| } else if (await minimizeJavaDependencyJars(config, features, codeql)) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Another alternative with minimizeJavaDependencyJars would be to just inline it here, since it is the only place where it's used. You could re-use the result of querying Feature.JavaMinimizeDependencyJars from earlier in this function and combine it with the language + build-mode checks.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I went with this approach.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| // To ensure a safe rollout of JAR minimization, we change the key when the feature is enabled. | ||
| if (language === KnownLanguage.java && minimizeJavaJars) { | ||
| prefix = `${prefix}-minify`; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
One concern I have is the following chain of events:
codeql-dependencies-minify${hash}.cachePrefix(..) will return just codeql-dependencies- for the next run.cachePrefix(..) as a possible restore key in the actionsCache.restoreCache call if we don't get an exact match for the primary cache key, we would restore the broken codeql-dependencies-minify ${hash} cache.That sort of defeats the point of having a FF in the first place. We should ensure that we don't restore a minified cache if the FF is disabled. Maybe the easiest way of accomplishing this would be to add minify or whatever at the start of the cache key prefix?
Alternatively, we could include different symbols after the main prefix depending on whether minimising is enabled or not.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks. I was vaguely aware that the Actions cache worked by matching a prefix, and not necessarily a full string, but I hadn't thought through the consequences. I think I'll just change it to minify-${prefix}.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
f14c640 to
df56f59
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, thanks for making those changes!
I have added a few more suggestions, but none are very major.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ## [UNRELEASED] | ||
|
|
||
| No user facing changes. | ||
| - We are rolling out a change in September 2025 that will reduce the size of Actions dependency caches for Java analyses. [#3107](https://github.com/github/codeql-action/pull/3107) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How about, rather than having a date here that might change, we could word this to be about the support for it. Something like:
| - We are rolling out a change in September 2025 that will reduce the size of Actions dependency caches for Java analyses. [#3107](https://github.com/github/codeql-action/pull/3107) | |
| - We added support for reducing the size of dependency caches for Java analyses, which will reduce cache usage and speed up workflows. This will be enabled automatically at a later time. [#3107](https://github.com/github/codeql-action/pull/3107) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| // If the feature flag to minimize Java dependency jars is enabled, and we are doing a Java | ||
| // `build-mode: none` analysis (i.e. the flag is relevant), then set the environment variable | ||
| // that enables the corresponding option int he Java extractor. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| // that enables the corresponding option int he Java extractor. | |
| // that enables the corresponding option in the Java extractor. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // that enables the corresponding option int he Java extractor. | ||
| if (process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]) { | ||
| logger.debug( | ||
| `${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to ${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}, so the Action will not override it.`, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Just to make it clearer what the value is, in case it's set to something silly that blends into the rest of the sentence.
| `${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to ${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}, so the Action will not override it.`, | |
| `${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to '${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}', so the Action will not override it.`, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| [Feature.JavaMinimizeDependencyJars]: { | ||
| defaultValue: false, | ||
| envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS", | ||
| minimumVersion: "2.23.0", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No strong feelings here, but isn't setting minimumVersion sort of equivalent to adding a ToolsFeature in that there's some CLI version that's going to add the ToolsFeature which is the minimum? I appreciate it's an extractor feature, but either way we don't check the extractors.
There were several earlier releases where the extractor supported this feature (i.e. would respond to the env var), but those were buggy (or caused problems by deleting private fields). So we want a version that not only supports the feature but is also known to be safe to use.
This makes sense. Am I assuming that your implicit thinking here is that minimumVersion is easier to change, if we discover other bugs, than a ToolsFeature?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think you'll also need to rebuild the JS files (possibly requiring changes from |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
df56f59 to
c5c7736
Compare
c5c7736 to
3ca9525
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.