Skip to content

Commit

Permalink
add CNB path to detect context
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Thornton <[email protected]>
  • Loading branch information
ForestEckhardt and dwillist committed Apr 23, 2020
1 parent fecca40 commit 4365e28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ type BuildContext struct {
// buildpack.toml included in the buildpack contents.
BuildpackInfo BuildpackInfo

// CNBPath is the absolute path location of the buildpack contents, eg.
// `/layers/io.buildpacks.example`. This path is useful for finding the
// buildpack.toml or any other files included in the buildpack.
// CNBPath is the absolute path location of the buildpack contents.
// This path is useful for finding the buildpack.toml or any other
// files included in the buildpack.
CNBPath string

// Layers provides access to layers managed by the buildpack. It can be used
Expand Down
6 changes: 6 additions & 0 deletions detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ type DetectContext struct {
// the lifecycle.
WorkingDir string

// CNBPath is the absolute path location of the buildpack contents.
// This path is useful for finding the buildpack.toml or any other
// files included in the buildpack.
CNBPath string

// BuildpackInfo includes the details of the buildpack parsed from the
// buildpack.toml included in the buildpack contents.
BuildpackInfo BuildpackInfo
Expand Down Expand Up @@ -117,6 +122,7 @@ func Detect(f DetectFunc, options ...Option) {

result, err := f(DetectContext{
WorkingDir: dir,
CNBPath: cnbPath,
BuildpackInfo: buildpackInfo.Buildpack,
})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ clear-env = false

Expect(context).To(Equal(packit.DetectContext{
WorkingDir: tmpDir,
CNBPath: cnbDir,
BuildpackInfo: packit.BuildpackInfo{
ID: "some-id",
Name: "some-name",
Expand Down

0 comments on commit 4365e28

Please sign in to comment.