From 4365e28236b373e36d1b19fe3377f83a0a3a3987 Mon Sep 17 00:00:00 2001 From: Forest Eckhardt Date: Thu, 23 Apr 2020 16:25:52 -0400 Subject: [PATCH] add CNB path to detect context Co-authored-by: Daniel Thornton --- build.go | 6 +++--- detect.go | 6 ++++++ detect_test.go | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.go b/build.go index bec1e4b9..17c02043 100644 --- a/build.go +++ b/build.go @@ -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 diff --git a/detect.go b/detect.go index 07f26515..6721454d 100644 --- a/detect.go +++ b/detect.go @@ -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 @@ -117,6 +122,7 @@ func Detect(f DetectFunc, options ...Option) { result, err := f(DetectContext{ WorkingDir: dir, + CNBPath: cnbPath, BuildpackInfo: buildpackInfo.Buildpack, }) if err != nil { diff --git a/detect_test.go b/detect_test.go index e9d35f38..88277004 100644 --- a/detect_test.go +++ b/detect_test.go @@ -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",