For this buildpack to work locally, the following needs to be installed:
- go
- pack
- docker
-
Bundle this repository into
.tgz
file:./jam-darwin pack \ --buildpack ./buildpack.toml \ --version 1.0.0 \ --output ./datadog-trace.tgz
The
jam
executable is provided by Paketo to package its buildpacks (latest versions in the link). -
Create a
package.toml
in the project's root directory configure the build imageecho echo "[buildpack] uri = './${packageName}' [platform] os = 'linux'" > package.toml
-
Create the buildpack docker image using
pack
, referencingpackage.toml
pack package-buildpack \ "datadog/datadog-trace:1.0.0" \ --config ./package.toml \ --format image
Running sudo ./build/package-image.sh
in the project root directory will achieve the same results.
For pack
to know that the user wants attach the Datadog trace agent to their application, a binding needs to be provided along with Datadog buildpack image was created prior.
-
Create a binding using the following command
mkdir binding echo 'DatadogTrace' > binding/type
Within the directory
./binding
, additional files can be added to configure the agent (see README for more details). -
Build the image
pack build <CONTAINER_NAME> \ --buildpack paketo-buildpacks/java \ --buildpack datadog/datadog-trace:1.0.0 \ --volume "<PATH>/<TO>/binding:/platform/bindings/DatadogTrace"
When the running the docker image using docker run <CONTAINER_NAME>
, the container shell should display logs from the Datadog tracer, indicating that the agent is correctly attached.
Run go test ./...
to test run all unit tests for each of the directories.
The buildpack is published by creating a release. When a release is created, a Github workflow will run in the background to package and publish the repo as a Docker image under Github Packages (see publish.yml).
The naming convention for tags should be period seperated numbers (e.g. 0.1.0
, instead of v0.1.0
). Otherwise, the packager, jam
, will not be able to parse the tag value.