Skip to content

Commit

Permalink
Merge pull request #14 from paketo-buildpacks/remove_kill_agent
Browse files Browse the repository at this point in the history
Upgrades libjvm to remove the kill agent in favor of native JVM flags
  • Loading branch information
Daniel Mikusa authored Aug 27, 2021
2 parents dfc71f0 + 09345a1 commit cb023b2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# `gcr.io/paketo-buildpacks/microsoft-openjdk`

The Paketo Microsoft OpenJDK Buildpack is a Cloud Native Buildpack that provides the Microsoft OpenJDK implementations of JREs and JDKs.

This buildpack is designed to work in collaboration with other buildpacks which request contributions of JREs and JDKs.

## Behavior

This buildpack will participate if any of the following conditions are met

* Another buildpack requires `jdk`
Expand All @@ -20,36 +22,42 @@ The buildpack will do the following if a JRE is requested:
* Contributes a JRE to a layer with all commands on `$PATH`
* Contributes `$JAVA_HOME` configured to the layer
* Contributes `-XX:ActiveProcessorCount` to the layer
* Contributes `-XX:+ExitOnOutOfMemoryError` to the layer
* Contributes `$MALLOC_ARENA_MAX` to the layer
* Disables JVM DNS caching if link-local DNS is available
* If `metadata.build = true`
* Marks layer as `build` and `cache`
* If `metadata.launch = true`
* Marks layer as `launch`
* Contributes `jvmkill` to a layer marked `launch`
* Contributes Memory Calculator to a layer marked `launch`
* Contributes Heap Dump helper to a layer marked `launch`

## Configuration
| Environment Variable | Description
| -------------------- | -----------
| `$BP_JVM_VERSION` | Configure the JVM version (e.g. `11`, `16`). The buildpack will download JDK and JRE assets that are compatible with this version of the JVM specification. Since the buildpack only ships a single version of each supported line, updates to the buildpack can change the exact version of the JDK or JRE. In order to hold the JDK and JRE versions stable, the buildpack version itself must be stable.<p/>Buildpack releases (and the dependency versions for each release) can be found [here][bpv]. Few users will use this buildpack directly, instead consuming a language buildpack like `paketo-buildpacks/java` who's releases (and the individual buildpack versions and dependency versions for each release) can be found [here](https://github.com/paketo-buildpacks/java/releases). Finally, some users will will consume builders like `paketobuildpacks/builder:base` who's releases can be found [here](https://hub.docker.com/r/paketobuildpacks/builder/tags?page=1&name=base). To determine the individual buildpack versions and dependency versions for each builder release use the [`pack inspect-builder <image>`](https://buildpacks.io/docs/reference/pack/pack_inspect-builder/) functionality.
| `$BP_JVM_TYPE` | Configure the JVM type that is provided at runtime, i.e. a JDK or JRE - accepts values "JDK" or "JRE" (default). If a JRE type is requested but not available, a JDK will be provided.
| `$BPL_JVM_HEAD_ROOM` | Configure the percentage of headroom the memory calculator will allocated. Defaults to `0`.
| `$BPL_JVM_LOADED_CLASS_COUNT` | Configure the number of classes that will be loaded at runtime. Defaults to 35% of the number of classes.
| `$BPL_JVM_THREAD_COUNT` | Configure the number of user threads at runtime. Defaults to `250`.
| `$JAVA_TOOL_OPTIONS` | Configure the JVM launch flags

| Environment Variable | Description |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `$BP_JVM_VERSION` | Configure the JVM version (e.g. `11`, `16`). The buildpack will download JDK and JRE assets that are compatible with this version of the JVM specification. Since the buildpack only ships a single version of each supported line, updates to the buildpack can change the exact version of the JDK or JRE. In order to hold the JDK and JRE versions stable, the buildpack version itself must be stable.<p/>Buildpack releases (and the dependency versions for each release) can be found [here][bpv]. Few users will use this buildpack directly, instead consuming a language buildpack like `paketo-buildpacks/java` who's releases (and the individual buildpack versions and dependency versions for each release) can be found [here](https://github.com/paketo-buildpacks/java/releases). Finally, some users will will consume builders like `paketobuildpacks/builder:base` who's releases can be found [here](https://hub.docker.com/r/paketobuildpacks/builder/tags?page=1&name=base). To determine the individual buildpack versions and dependency versions for each builder release use the [`pack inspect-builder <image>`](https://buildpacks.io/docs/reference/pack/pack_inspect-builder/) functionality. |
| `$BP_JVM_TYPE` | Configure the JVM type that is provided at runtime, i.e. a JDK or JRE - accepts values "JDK" or "JRE" (default). If a JRE type is requested but not available, a JDK will be provided. |
| `$BPL_JVM_HEAD_ROOM` | Configure the percentage of headroom the memory calculator will allocated. Defaults to `0`. |
| `$BPL_JVM_LOADED_CLASS_COUNT` | Configure the number of classes that will be loaded at runtime. Defaults to 35% of the number of classes. |
| `$BPL_JVM_THREAD_COUNT` | Configure the number of user threads at runtime. Defaults to `250`. |
| `$BPL_HEAP_DUMP_PATH` | Configure the location for writing heap dumps in the event of an OutOfMemoryError exception. Defaults to ``, which disables writing heap dumps. The path set must be writable by the JVM process. |
| `$JAVA_TOOL_OPTIONS` | Configure the JVM launch flags |

[bpv]: https://github.com/paketo-buildpacks/microsoft-openjdk/releases

## Bindings

The buildpack optionally accepts the following bindings:

### Type: `dependency-mapping`
|Key | Value | Description
|----------------------|---------|------------
|`<dependency-digest>` | `<uri>` | If needed, the buildpack will fetch the dependency with digest `<dependency-digest>` from `<uri>`

| Key | Value | Description |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------- |
| `<dependency-digest>` | `<uri>` | If needed, the buildpack will fetch the dependency with digest `<dependency-digest>` from `<uri>` |

## License

This buildpack is released under version 2.0 of the [Apache License][a].

[a]: http://www.apache.org/licenses/LICENSE-2.0
Expand Down
6 changes: 6 additions & 0 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ description = "the number of threads in memory calculation"
default = "250"
launch = true

[[metadata.configurations]]
name = "BPL_HEAP_DUMP_PATH"
description = "write heap dumps on error to this path"
default = ""
launch = true

[[metadata.configurations]]
name = "BP_JVM_VERSION"
description = "the Java version"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/paketo-buildpacks/microsoft-openjdk
go 1.15

require (
github.com/paketo-buildpacks/libjvm v1.28.0
github.com/paketo-buildpacks/libjvm v1.29.0
github.com/paketo-buildpacks/libpak v1.52.2
)
Loading

0 comments on commit cb023b2

Please sign in to comment.