Skip to content

[GR-55581] Check layered image build option compatibility. #11207

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented May 15, 2025

This is the first incarnation of checking layered builds to use mostly identical build arguments between parent layer and current layer build.

Using -H:-LayerVerificationStrict allows us to quickly find all offenders (see Warning messages):

========================================================================================================================
GraalVM Native Image: Generating 'application-layer-test' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
Native Image Layers: Loaded layer libjavabaselayer from base-layer.nil
Native Image Layers: Layer created at 'Wednesday, May 28, 2025, 1:22:53 PM Central European Summer Time'
Native Image Layers: Using version: 'GraalVM Community 25+23-jvmci-b01' on platform: 'linux-amd64'
Warning: Current layer gets built with option argument '-g' from command line. This is also required to be specified for the parent layer build at the same position.
Warning: Parent layer was built with option argument '--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.genscavenge=ALL-UNNAMED' from command line. This is also required to be specified for the current layered image build.
Warning: Parent layer was built with option argument '--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.heap=ALL-UNNAMED' from command line. This is also required to be specified for the current layered image build.
...

Note, how the found offenders can differentiate between changes where the position in the argument sequence matters (-g) and where it does not (--add-exports).

Without it, the first warning would already be an error that aborts the build:

[1/8] Initializing...                                                                                    (0.0s @ 0.34GB)
Error: Current layer gets built with option argument '-g' from command line. This is also required to be specified for the parent layer build at the same position.

The newly added annotation com.oracle.svm.core.option.LayerVerification allows us to selectively increase the amount of options where we want this checking to apply.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 15, 2025
@olpaw olpaw self-assigned this May 16, 2025
olpaw added 7 commits May 28, 2025 12:36
* Make -H:TempDirectory available as early as possible
* Ensure layerDir respects -H:TempDirectory like all other builder generated temp files
* Do not expose layer-snapshot.lsb and layer-snapshot-graphs.big to BuildArtifacts
* Remove LAYER_SNAPSHOT and LAYER_SNAPSHOT_GRAPHS artifact types
* Clean up LayerArchiveSupport class hierarchy
* Clean up HostedImageLayerBuildingSupport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants