Skip to content

Commit

Permalink
Merge pull request #1234 from buildpacks/jkutner/fix-any-stack
Browse files Browse the repository at this point in the history
Allow wildcard "any" stack
  • Loading branch information
jromero authored Jul 21, 2021
2 parents 5bde87f + 359df6c commit 4c340df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/dist/buildpack_descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (b *BuildpackDescriptor) EnsureStackSupport(stackID string, providedMixins

func (b *BuildpackDescriptor) findMixinsForStack(stackID string) ([]string, error) {
for _, s := range b.Stacks {
if s.ID == stackID {
if s.ID == stackID || s.ID == "*" {
return s.Mixins, nil
}
}
Expand Down
16 changes: 16 additions & 0 deletions internal/dist/buildpack_descriptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ func testBuildpackDescriptor(t *testing.T, when spec.G, it spec.S) {
h.AssertNil(t, bp.EnsureStackSupport("some.stack.id", providedMixins, false))
})

it("works with wildcard stack", func() {
bp := dist.BuildpackDescriptor{
Info: dist.BuildpackInfo{
ID: "some.buildpack.id",
Version: "some.buildpack.version",
},
Stacks: []dist.Stack{{
ID: "*",
Mixins: []string{"mixinA", "build:mixinB", "run:mixinD"},
}},
}

providedMixins := []string{"mixinA", "build:mixinB", "mixinC"}
h.AssertNil(t, bp.EnsureStackSupport("some.stack.id", providedMixins, false))
})

it("returns an error with any missing (and non-ignored) mixins", func() {
bp := dist.BuildpackDescriptor{
Info: dist.BuildpackInfo{
Expand Down

0 comments on commit 4c340df

Please sign in to comment.