herokubuildpackpaketo

Configure container image labels using CNB Paketo Image-Labels-Buildpack and the lifecycle creator


We're using a CNB builder image inside a GitLab CI/CD pipeline in order to automatically build our application and bake it into an image.

Because we can't use docker in docker on our container orchestrator, we can not use the pack CLI und must resort to calling the cnb/lifecycle/creator directly.

We'd like to add additional labels to the produced image using the Paketo image-labels buildpack. The docs state that setting the variables prefixed with BP_OCI_XXX should suffice in order for the corresponding label to be set. When using the pack CLI, one can specify this using the --env flag. Simply setting the value as an environment variable doesn't seem to work.

How can I pass those configurations to the creator?


Solution

  • I found the answer in the platform specification: https://github.com/buildpacks/spec/blob/main/platform.md#user-provided-variables

    This means all env vars simply need to be created as key-value pairs (varname is the filename and value is the content of the file) inside the <platform>/env/ directory.