Skip to content

Commit 0052f31

Browse files
committed
Incorporate feedback from Native Image Committer and Community Meeting
1 parent a5f5648 commit 0052f31

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

docs/reference-manual/native-image/ReplayBundles.md

+30-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ native-image --replay .../path/to/alaunch.nirb.jar
4949
this will rebuild the `alaunch` image with the same image arguments, environment variables, system properties
5050
settings, classpath and module-path options as in the initial build.
5151

52+
To support the use-case of image-building-as-a-service, there should also be a way to create a bundle without
53+
performing the initial build locally. This allows users to offload image building to a cloud-service specialized in
54+
image building and retaining of replay bundles. The command line for that should be:
55+
56+
```shell
57+
native-image --replay-prepare ...other native-image arguments...
58+
```
59+
5260
## Replay Bundles File Format
5361

5462
A `<imagename>.nirb.jar` file is a regular jar-file that contains all information needed to replay a previous build.
@@ -79,11 +87,19 @@ alaunch.nirb.jar
7987
│ ├── all.env <- All environment variables used in the image build
8088
│ ├── all.properties <- All system properties passed to the builder
8189
│ ├── build.cmd <- Full native-image command line (minus --replay-create option)
82-
│ └── run.cmd <- Arguments to run application on java (for laucher, see below)
90+
│ ├── run.cmd <- Arguments to run application on java (for laucher, see below)
91+
│ └── container <- For containerized build this subdirs holds all info about that
92+
│ ├── Dockerfile <- Container image that was used to perform the build
93+
│ ├── run.cmd <- Arguments passed to docker/podman to run the container
94+
│ └── setup.json <- Info about the docker/podman setup that was used
95+
│ * Linux kernel version
96+
│ * Docker/podman version
97+
│ * CGroup v2 or CGroup v1
8398
├── META-INF
8499
│ ├── MANIFEST.MF <- Specifes rbundle/Launcher as mainclass
85100
│ └── RBUNDLE.MF <- Contains replay bundle version info:
86101
│ * Replay-bundle format version
102+
│ * Platform the bundle was created on (e.g. linux-amd64)
87103
│ * GraalVM / Native-image version used for build
88104
├── out
89105
│ ├── alaunch.debug <- Native debuginfo for the built image
@@ -106,6 +122,8 @@ Here we also find `RBUNDLE.MF`. This file is specific to replay bundles. Its exi
106122
ordinary jar-file but a native image replay bundle. The file contains version information of the native image replay
107123
bundle format itself and also which GraalVM version was used to create the bundle. This can later be used to report a
108124
warning message if a bundle gets replayed with a GraalVM version different from the one used to create the bundle.
125+
This file also contains information about the platform the bundle was created on (e.g. `linux-amd64` or
126+
`darwin-aarch64`).
109127

110128
### `input`:
111129

@@ -125,6 +143,15 @@ class/module-path entries as the initial build. The use of `run.cmd` is explaine
125143
File `all.env` contains the environment variables that we allowed the builder to see during the initial build and
126144
`all.properties` the respective system-properties.
127145

146+
#### `input/stage/container`:
147+
148+
If the image builder runs in a container environment, this subdirectory holds all information necessary to redo the
149+
image build later in an equivalent container environment. It contains the `Dockerfile` that was used to specify the
150+
container image that executed the image builder. Next, `run.cmd` contains all the arguments that were passed to
151+
docker/podman. It does not contain the arguments passed to be builder. In `setup.json` we save all information about
152+
the container environment that was used (Linux kernel version, CGroup V1 or V2, Docker/podman version). For more info
153+
see [below](#containerized-image-building-on-supported-platforms).
154+
128155
### `build`:
129156

130157
This folder is used to document the build process that lead to the image that was created alongside the bundle.
@@ -162,7 +189,8 @@ us to prevent the builder from using the network during image build**, thus guar
162189
not depend on some unknown (and therefore unreproducible) network state. Another advantage is that we can mount
163190
`input/classes` and `$GRAALVM_HOME` read-only into the container and only allow read-write access to the mounted `out`
164191
and `build` directories. This will prevent the application code that runs at image build time to mess with anything
165-
other than those directories.
192+
other than those directories. All information about containerized building is recorded in bundle subdirectory
193+
`input/stage/container`.
166194

167195
### Fallback for systems without container support
168196

0 commit comments

Comments
 (0)