Skip to content

Conversation

@colincasey
Copy link
Contributor

Warning

This is just an experiment. Do not merge!

Use Case

Let's say you're writing a CNB and, for the functionality your buildpack provides, you need to ensure one or more system packages are installed. Great! You can use heroku/deb-packages for that! One tiny problem though, the heroku/deb-packages CNB only supports configuration via project.toml. This means that your buildpack has to instruct users to manually add the required configuration for the packages it requires or it won't work. Wouldn't it be nice if your buildpack could instead just contribute the required configuration via the buildplan?

Solution

This PR exposes the same configuration structure that available to end users in project.toml to buildpack authors in a buildplan. To leverage this configuration, a participating CNB needs to do the following in the detect phase:

  • require the heroku/deb-packages buildplan and provide all necessary configuration under the metadata field.

Example

detect.sh
#!/usr/bin/env bash
build_plan="$2"

cat <<EOF >"$build_plan"
[[requires]]
name = "heroku/deb-packages"

[requires.metadata]
# add custom packages
install = ["mongodb-org-tools", "mongodb-org-shell"]

# register a custom source
[[requires.metadata.sources]]
uri = "https://repo.mongodb.org/apt/ubuntu"
suites = ["noble/mongodb-org/8.0"]
components = ["multiverse"]
arch = ["amd64", "arm64"]
signed_by = """-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGWgEhwBEADJpjwR+5n6na3tqZ6ueHsW/U8lvcvMFZ1DYNo+/JhrNjHkZ7HR
Wbc2IzWej1zqTtctSKZvrCkPGZxiDsKB5xta/NVtnpjSuV02Gp0F6hf0gnvark04
HnEFaV2w15Tyr8Z4KHRDbdja6h/24t4tR0KkRzxh5U7FwLL8BpK2drbTog9FBMy+
lqYDfOLHx6JDeOMC7eSNe/jJsAiuVcP/y+vQbLuMYAaMPSvJoidRIQ88oFLoUlVZ
NxRt3Z+7w5HMIN2laKp+ItxloPWGBdcHU4o2ZnWgsVT8Y/a+RED75DDbAQ6lS3fV
sSlmQLExcf75qOPy34XNv3gWP4tbfIXXt8olflF8hwHggmKZzEImnzEozPabDsN7
nkhHZEWhGcPRcuHbFOqcirV1sfsKK1gOsTbxS00iD3OivOFCQqujF196cal/utTd
WvyJvY2o35eE0WFcDdstU7UiP39usE+jk4jbQ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GaQZDpdqyQZiYpQEYw9xN+8g=
=J31U
-----END PGP PUBLIC KEY BLOCK-----
"""
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant