diff --git a/build.go b/build.go index 70b6032..5a5ab19 100644 --- a/build.go +++ b/build.go @@ -226,10 +226,10 @@ func Build(build BuildFunc, config Config) { config.logger.Debugf("Buildpack Plan: %+v", ctx.Plan) if ctx.StackID, ok = os.LookupEnv(EnvStackID); !ok { - config.exitHandler.Error(fmt.Errorf("CNB_STACK_ID not set")) - return + config.logger.Debug("CNB_STACK_ID not set") + } else { + config.logger.Debugf("Stack: %s", ctx.StackID) } - config.logger.Debugf("Stack: %s", ctx.StackID) result, err := build(ctx) if err != nil { diff --git a/build_test.go b/build_test.go index db87978..7a951ca 100644 --- a/build_test.go +++ b/build_test.go @@ -253,19 +253,6 @@ version = "1.1.1" } }) - it("doesn't receive CNB_STACK_ID", func() { - Expect(os.Unsetenv("CNB_STACK_ID")).To(Succeed()) - - libcnb.Build(buildFunc, - libcnb.NewConfig( - libcnb.WithArguments([]string{commandPath, layersPath, platformPath, buildpackPlanPath}), - libcnb.WithExitHandler(exitHandler), - libcnb.WithLogger(log.NewDiscard())), - ) - - Expect(exitHandler.Calls[0].Arguments.Get(0)).To(MatchError("CNB_STACK_ID not set")) - }) - context("has a build environment", func() { var ctx libcnb.BuildContext diff --git a/detect.go b/detect.go index b435d87..a5e044e 100644 --- a/detect.go +++ b/detect.go @@ -185,10 +185,10 @@ func Detect(detect DetectFunc, config Config) { config.logger.Debugf("Platform Environment: %s", ctx.Platform.Environment) if ctx.StackID, ok = os.LookupEnv(EnvStackID); !ok { - config.exitHandler.Error(fmt.Errorf("CNB_STACK_ID not set")) - return + config.logger.Debug("CNB_STACK_ID not set") + } else { + config.logger.Debugf("Stack: %s", ctx.StackID) } - config.logger.Debugf("Stack: %s", ctx.StackID) result, err := detect(ctx) if err != nil { diff --git a/detect_test.go b/detect_test.go index 5cb065b..552631b 100644 --- a/detect_test.go +++ b/detect_test.go @@ -175,19 +175,6 @@ version = "1.1.1" }) }) - it("doesn't receive CNB_STACK_ID", func() { - Expect(os.Unsetenv("CNB_STACK_ID")).To(Succeed()) - - libcnb.Detect(detectFunc, - libcnb.NewConfig( - libcnb.WithArguments([]string{commandPath, platformPath, buildPlanPath}), - libcnb.WithExitHandler(exitHandler), - libcnb.WithLogger(log.NewDiscard())), - ) - - Expect(exitHandler.Calls[0].Arguments.Get(0)).To(MatchError("CNB_STACK_ID not set")) - }) - context("errors if required env vars are not set", func() { for _, e := range []string{"CNB_PLATFORM_DIR", "CNB_BUILD_PLAN_PATH"} { // We need to do this assignment because of the way that spec binds variables diff --git a/generate.go b/generate.go index 69ee605..600b13c 100644 --- a/generate.go +++ b/generate.go @@ -179,10 +179,10 @@ func Generate(generate GenerateFunc, config Config) { config.logger.Debugf("Buildpack Plan: %+v", ctx.Plan) if ctx.StackID, ok = os.LookupEnv(EnvStackID); !ok { - config.exitHandler.Error(fmt.Errorf("CNB_STACK_ID not set")) - return + config.logger.Debug("CNB_STACK_ID not set") + } else { + config.logger.Debugf("Stack: %s", ctx.StackID) } - config.logger.Debugf("Stack: %s", ctx.StackID) result, err := generate(ctx) if err != nil { diff --git a/generate_test.go b/generate_test.go index 925b99e..54a77d2 100644 --- a/generate_test.go +++ b/generate_test.go @@ -235,19 +235,6 @@ version = "1.1.1" } }) - it("doesn't receive CNB_STACK_ID", func() { - Expect(os.Unsetenv("CNB_STACK_ID")).To(Succeed()) - - libcnb.Generate(generateFunc, - libcnb.NewConfig( - libcnb.WithArguments([]string{commandPath, outputPath, platformPath, buildpackPlanPath}), - libcnb.WithExitHandler(exitHandler), - libcnb.WithLogger(log.NewDiscard())), - ) - - Expect(exitHandler.Calls[0].Arguments.Get(0)).To(MatchError("CNB_STACK_ID not set")) - }) - context("has a build environment", func() { var ctx libcnb.GenerateContext