-
Notifications
You must be signed in to change notification settings - Fork 164
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
add support for anystack buildpacks #776
Conversation
b12a330
to
59883f2
Compare
Codecov Report
@@ Coverage Diff @@
## main #776 +/- ##
==========================================
+ Coverage 68.54% 69.41% +0.86%
==========================================
Files 93 117 +24
Lines 4130 5074 +944
==========================================
+ Hits 2831 3522 +691
- Misses 951 1185 +234
- Partials 348 367 +19
Continue to review full report at Codecov.
|
pkg/cnb/buildpack_validation.go
Outdated
@@ -16,7 +17,9 @@ func (bl BuildpackLayerInfo) supports(buildpackApis []string, id string, mixins | |||
} | |||
|
|||
for _, s := range bl.Stacks { | |||
if s.ID == id { | |||
iaAnystack := s.ID == "*" && api.MustParse(bl.API).Compare(api.MustParse("0.5")) >= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MustParse will panic on a not parseable input which is actually an underlying user input. api.NewVersion
is probably safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already pull in semver to parse buildpack versions. Could we use that instead of adding another dependency on the lifecycle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya good call
83504bf
to
ed7e942
Compare
pkg/cnb/buildpack_validation.go
Outdated
return err | ||
} | ||
|
||
isAnystack := s.ID == "*" && buildpackVersion.Compare(anyStackMinimumVersion) >= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe pull this out to method?
pkg/cnb/buildpack_validation.go
Outdated
@@ -15,8 +16,19 @@ func (bl BuildpackLayerInfo) supports(buildpackApis []string, id string, mixins | |||
return errors.Errorf("unsupported buildpack api: %s, expecting: %s", bl.API, strings.Join(buildpackApis, ", ")) | |||
} | |||
|
|||
anyStackMinimumVersion, err := semver.NewVersion("0.5") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could MustParse this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And pull it out as var
ed7e942
to
a9c9e0b
Compare
@@ -46,3 +54,7 @@ func present(haystack []string, needle string) bool { | |||
} | |||
return false | |||
} | |||
|
|||
func isAnystack(stackId string, buildpackVersion *semver.Version) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
a9c9e0b
to
1d48b57
Compare
Closes #741 |
No description provided.