cloudfoundry / java-buildpack

Cloud Foundry buildpack for running Java applications
Apache License 2.0
437 stars 2.58k forks source link

Add default functionality & refactor packaging #957

Closed dmikusa closed 2 years ago

dmikusa commented 2 years ago
  1. Adds an environment variable that can be used by operations teams to set default values. Operator defaults override buildpack defaults, but are overridden by application developer values. Operator defaults are set by exposing an environment variable of the pattern JBP_DEFAULT_<config-file>='<inline-yaml>'. So to set a default Java version, JBP_DEFAULT_OPEN_JDK_JRE='{ jre: { version: 11.+ }}'.

  2. Adds config/packaging.yml. This contains the list of component data. Each component gets a name, CVE notes link and release notes link. This information is used by the rake versions command to generate a nice set of release notes for each package. This information was refactored out of the scripts (was previously hard-coded).

  3. Each config/<jre>.yml file has been given a jre.version_lines property. This is a list of the supported version lines for that JRE. It defaults to using pattern matching to pick the latest 1.8, 11 and 17 versions. If you are packaging your own version of the buildpack and want to limit the version lines included, perhaps to reduce the size of the generated buildpack file, you can edit this list and remove entries. Theh package script will only include what is listed in this array.

  4. When pinning versions, the packaging script will now update each config/<jre>yml file's jre.version_lines list with the pinned versions, in addition to jre.version. This allows you to have a list of every version line bundled with the buildpack when a release is cut (previously, only 1.8 was committed to source control). This helps when rebuilding a version of the Java buildpack at a later date, as you'll have the exact set of Java versions which should be included.

  5. You may change the default version of Java that is selected during a build of the Java buildpack by setting the config/<jre>.yml file's jre.version value. This needs to match one of the entries in jre.version_lines. Then follow the standard packaging steps the the buildpack that's generated will use the selected version of Java by default.

Resolves #938 #892 #886

Signed-off-by: Daniel Mikusa dmikusa@vmware.com