Fix multi-stack buildpack deletion in Initialize()#126
Merged
tnikolova82 merged 1 commit intomainfrom Apr 9, 2026
Merged
Conversation
When CF has the same buildpack registered for multiple stacks (e.g. cflinuxfs4 and cflinuxfs5), the single 'cf delete-buildpack -f <name>' call fails with 'Multiple buildpacks named X found. Specify a stack name by using a -s flag.' Fix by iterating over all resources from the /v3/buildpacks API response and issuing separate delete-buildpack calls per resource, using the -s flag when the resource has a non-empty stack. This handles three cases: - Stackless/any-stack buildpacks (no -s flag) - Single-stack buildpacks (-s <stack>) - Multi-stack buildpacks (one -s <stack> call per stack)
tnikolova82
added a commit
to cloudfoundry/ruby-buildpack
that referenced
this pull request
Apr 9, 2026
Replace vendored switchblade patch with upstream fix from cloudfoundry/switchblade#126, released as v0.9.5.
This was referenced Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Initialize()to handle CF environments with multiple stacks (e.g. cflinuxfs4 + cflinuxfs5) sharing the same buildpack name/v3/buildpacksresources and issue per-resourcedelete-buildpackcalls with-s <stack>when stack is non-emptyProblem
When CF has both cflinuxfs4 and cflinuxfs5 deployed, buildpacks like
ruby_buildpackare registered once per stack. The current code callscf delete-buildpack -f <name>without-s, causing:This breaks all buildpack integration tests on CF environments with multiple stacks.
Fix
Instead of a single
delete-buildpackcall, loop over all resources from the/v3/buildpacks?names=<name>response. For each resource:stack != "":delete-buildpack -f <name> -s <stack>stack == "":delete-buildpack -f <name>(for any-stack/stackless buildpacks)History
-s <stack>on every delete-sflag entirely-sper resourceTests
-sdelete calls)-sdelete call)internal/cloudfoundrypass