Introduce an (optional) Git buildpack into each language buildpack family. The buildpack
will be charged with providing git
metadata as build-time and run-time environment
variables.
Applications of any language may have a need for information extracted from
git
metadata. For example, the commit sha might be used as versioning
information when building a Go binary or used when running a Rails application.
A new git
buildpack will be developed to detect whether the .git
directory and
BP_GIT_LOAD
environment variable is present and set to true
, and then
read the directory to extract the following environment variables so that they
can be included in the built image.
GIT_COMMIT_SHA
The buildpack will detect if:
- The
.git
directory is present - The
BP_GIT_LOAD
environment variable is set totrue
.
The build process of the buildpack will find the values for the expected environment variables and add them to a layer for use at launch.
The git
buildpack can be added to each family buildpack or it can be added
separately at the beginning of each ordering defined in a builder.
For example:
[[order]]
[[order.group]]
id = "paketo-buildpacks/go"
version = "<version>"
[[order.group]]
id = "paketo-buildpacks/git"
version = "<version>"
optional = true
[[order]]
[[order.group]]
id = "paketo-buildpacks/ruby"
version = "<version>"
[[order.group]]
id = "paketo-buildpacks/git"
version = "<version>"
optional = true