Skip to content

Commit 4c340df

Browse files
authored
Merge pull request #1234 from buildpacks/jkutner/fix-any-stack
Allow wildcard "any" stack
2 parents 5bde87f + 359df6c commit 4c340df

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

internal/dist/buildpack_descriptor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (b *BuildpackDescriptor) EnsureStackSupport(stackID string, providedMixins
5252

5353
func (b *BuildpackDescriptor) findMixinsForStack(stackID string) ([]string, error) {
5454
for _, s := range b.Stacks {
55-
if s.ID == stackID {
55+
if s.ID == stackID || s.ID == "*" {
5656
return s.Mixins, nil
5757
}
5858
}

internal/dist/buildpack_descriptor_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ func testBuildpackDescriptor(t *testing.T, when spec.G, it spec.S) {
3636
h.AssertNil(t, bp.EnsureStackSupport("some.stack.id", providedMixins, false))
3737
})
3838

39+
it("works with wildcard stack", func() {
40+
bp := dist.BuildpackDescriptor{
41+
Info: dist.BuildpackInfo{
42+
ID: "some.buildpack.id",
43+
Version: "some.buildpack.version",
44+
},
45+
Stacks: []dist.Stack{{
46+
ID: "*",
47+
Mixins: []string{"mixinA", "build:mixinB", "run:mixinD"},
48+
}},
49+
}
50+
51+
providedMixins := []string{"mixinA", "build:mixinB", "mixinC"}
52+
h.AssertNil(t, bp.EnsureStackSupport("some.stack.id", providedMixins, false))
53+
})
54+
3955
it("returns an error with any missing (and non-ignored) mixins", func() {
4056
bp := dist.BuildpackDescriptor{
4157
Info: dist.BuildpackInfo{

0 commit comments

Comments
 (0)