Skip to content

Commit

Permalink
Assume non-meta buildpacks without stacks use any stack
Browse files Browse the repository at this point in the history
Signed-off-by: Josh W Lewis <josh.lewis@salesforce.com>
  • Loading branch information
joshwlewis committed Feb 26, 2024
1 parent 85e9682 commit 03cfdef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/buildpack/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,22 @@ func (b *PackageBuilder) validate() error {

func (b *PackageBuilder) resolvedStacks() []dist.Stack {
stacks := b.buildpack.Descriptor().Stacks()
if len(stacks) == 0 && len(b.buildpack.Descriptor().Order()) == 0 {
// For non-meta-buildpacks using targets, not stacks: assume any stack
stacks = append(stacks, dist.Stack{ID: "*"})
}
for _, bp := range b.AllModules() {
bpd := bp.Descriptor()
bpdStacks := bp.Descriptor().Stacks()
if len(bpdStacks) == 0 && len(bpd.Order()) == 0 {
// For non-meta-buildpacks using targets, not stacks: assume any stack
bpdStacks = append(stacks, dist.Stack{ID: "*"})

Check failure on line 342 in pkg/buildpack/builder.go

View workflow job for this annotation

GitHub Actions / test (macos)

appendAssign: append result not assigned to the same slice (gocritic)

Check failure on line 342 in pkg/buildpack/builder.go

View workflow job for this annotation

GitHub Actions / test (linux)

appendAssign: append result not assigned to the same slice (gocritic)

Check failure on line 342 in pkg/buildpack/builder.go

View workflow job for this annotation

GitHub Actions / test (windows-lcow)

appendAssign: append result not assigned to the same slice (gocritic)

Check failure on line 342 in pkg/buildpack/builder.go

View workflow job for this annotation

GitHub Actions / test (windows-wcow)

appendAssign: append result not assigned to the same slice (gocritic)
}

if len(stacks) == 0 {
stacks = bpd.Stacks()
} else if len(bpd.Stacks()) > 0 { // skip over "meta-buildpacks"
stacks = stack.MergeCompatible(stacks, bpd.Stacks())
stacks = bpdStacks
} else if len(bpdStacks) > 0 { // skip over "meta-buildpacks"
stacks = stack.MergeCompatible(stacks, bpdStacks)
}
}

Expand Down

0 comments on commit 03cfdef

Please sign in to comment.