Skip to content

Commit

Permalink
Use buildpack-packager to bundle Credhub CLI
Browse files Browse the repository at this point in the history
Use the binary provided by libbuildpack rather than reinventing the
buildpack-packaging wheel
  • Loading branch information
andy-paine committed May 6, 2020
1 parent 674b2de commit d2889d4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions CREDHUB_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.0
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# env-map-buildpack
# credhub-buildpack

Allows for fetching of secrets at runtime from CredHub into environment variables for apps. Requires bundling with `credhub` CLI.
Allows for fetching of secrets at runtime from CredHub into environment variables for apps.

## Background

When deploying applications to Cloud Foundry, sometimes it is not possible to modify those applications to read secrets such as credentials from CredHub directly. This buildpack utilizes the `profile.d` directory to supply a script that will export environment variables based CredHub variable lookups. Any scripts present in the `profile.d` directory will be `source`d when the application starts up.

## Usage

> Note: This is currently non-functional until the `credhub` CLI is bundled with it.
To use this buildpack, include [https://github.com/andy-paine/credhub-buildpack](https://github.com/andy-paine/credhub-buildpack) anywhere but the last element in the `buildpacks` field in your Cloud Foundry manifest, for example:
```yaml
buildpacks:
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
17 changes: 17 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
language: credhub
default_versions: []
dependency_deprecation_dates: []
dependencies: []

include_files:
- README.md
- VERSION
- manifest.yml
- bin/detect
- bin/supply
- bin/finalize
- bin/release
- bin/fetch_credhub_credentials.sh
- credhub
pre_package: scripts/download-credhub.sh
5 changes: 5 additions & 0 deletions scripts/download-credhub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

version="$(cat CREDHUB_VERSION)"
curl -sLo credhub.tgz "https://github.com/cloudfoundry-incubator/credhub-cli/releases/download/$version/credhub-linux-$version.tgz"
tar -xvf credhub.tgz
4 changes: 4 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

go get -u github.com/cloudfoundry/libbuildpack/packager/buildpack-packager
buildpack-packager build -stack cflinuxfs3

0 comments on commit d2889d4

Please sign in to comment.