Fix CF CLI installation to reuse system version and use latest stable release #218
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.
What is this change about?
This PR fixes the CF CLI installation logic in the shared buildpack utility scripts to detect and reuse system-installed CF CLI instead of always downloading a new copy.
Problem
The current
util::tools::cf::install()function has two issues:Issue 1: Always downloads CF CLI even when already available
In CI environments (especially BBL-based pipelines), CF CLI is pre-installed in the Docker image and already authenticated via
cf-space/loginscript. However, the current code:.bindirectory and adds it to PATH.bin/cfIssue 2: Uses outdated CF CLI version
The code hardcodes
version=6.49.0(released in 2020), which:Impact
This issue affects all buildpacks that use these shared utility scripts during integration testing, particularly:
Exception: r-buildpack works because it manually added this fix locally on Nov 24, 2025.
Solution
Add a check before downloading CF CLI:
This ensures:
Testing
After this change syncs to buildpacks via the daily update-github-config workflow:
✅ Integration tests pass in BBL environments
✅ CF authentication is preserved throughout test runs
✅ System CF CLI v8+ is detected and reused
✅ "Installing cf" message only appears when CF is truly missing
Evidence of the problem
Before fix (nodejs-buildpack integration test output):
After fix (r-buildpack with local fix):
Related Work
Rollout Plan
Once merged, this fix will automatically sync to all buildpacks via the daily update-github-config GitHub Action workflow that runs at 09:10 UTC.
Checklist
✅ Change follows bash scripting best practices
✅ Tested locally with buildpack integration tests
✅ Backward compatible (doesn't break existing workflows)
✅ Fixes reported CI failures in multiple buildpacks