Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates libcnb to support buildpacks API 0.7 #94

Merged
merged 1 commit into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ func Build(builder Builder, options ...Option) {
logger.Debugf("Buildpack: %+v", ctx.Buildpack)

API := strings.TrimSpace(ctx.Buildpack.API)
if API != "0.5" && API != "0.6" {
config.exitHandler.Error(errors.New("this version of libcnb is only compatible with buildpack APIs 0.5 and 0.6"))
if API != "0.5" && API != "0.6" && API != "0.7" {
config.exitHandler.Error(errors.New("this version of libcnb is only compatible with buildpack APIs 0.5, 0.6, and 0.7"))
return
}

Expand Down
4 changes: 2 additions & 2 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ test-key = "test-value"
Expect(os.RemoveAll(platformPath)).To(Succeed())
})

context("buildpack API is not 0.5 or 0.6", func() {
context("buildpack API is not 0.5, 0.6, or 0.7", func() {
it.Before(func() {
Expect(ioutil.WriteFile(filepath.Join(buildpackPath, "buildpack.toml"),
[]byte(`
Expand All @@ -203,7 +203,7 @@ version = "1.1.1"
)

Expect(exitHandler.Calls[0].Arguments.Get(0)).To(MatchError(
"this version of libcnb is only compatible with buildpack APIs 0.5 and 0.6",
"this version of libcnb is only compatible with buildpack APIs 0.5, 0.6, and 0.7",
))
})
})
Expand Down
4 changes: 2 additions & 2 deletions detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ func Detect(detector Detector, options ...Option) {
logger.Debugf("Buildpack: %+v", ctx.Buildpack)

API := strings.TrimSpace(ctx.Buildpack.API)
if API != "0.5" && API != "0.6" {
config.exitHandler.Error(errors.New("this version of libcnb is only compatible with buildpack API 0.5 and 0.6"))
if API != "0.5" && API != "0.6" && API != "0.7" {
config.exitHandler.Error(errors.New("this version of libcnb is only compatible with buildpack APIs 0.5, 0.6, and 0.7"))
return
}

Expand Down
4 changes: 2 additions & 2 deletions detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ test-key = "test-value"
Expect(os.RemoveAll(platformPath)).To(Succeed())
})

context("buildpack API is not 0.5 or 0.6", func() {
context("buildpack API is not 0.5, 0.6, or 0.7", func() {
it.Before(func() {
Expect(ioutil.WriteFile(filepath.Join(buildpackPath, "buildpack.toml"),
[]byte(`
Expand All @@ -157,7 +157,7 @@ version = "1.1.1"
)

Expect(exitHandler.Calls[0].Arguments.Get(0)).To(MatchError(
"this version of libcnb is only compatible with buildpack API 0.5 and 0.6",
"this version of libcnb is only compatible with buildpack APIs 0.5, 0.6, and 0.7",
))
})
})
Expand Down