Fix CF CLI installation to use system version when available #859
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 a critical issue in the CF CLI installation logic that causes integration test failures in BBL-based CI environments.
Problem
When running integration tests against a real CF environment (not Docker), the current
util::tools::cf::install()function:.bin/cf, even when CF CLI is already available in the systemcf-space/loginscriptNo API endpoint set. Use 'cf login' or 'cf api' to target an endpoint.This only affects the nodejs-buildpack because:
Solution
This PR adds a check to detect if CF CLI is already installed before attempting to download it:
Additionally:
Testing
✅ Integration tests now pass in BBL environments (nodejs.buildpacks.ci.cloudfoundry.org)
✅ CF authentication is preserved throughout the test run
✅ System CF CLI v8.17.0 is detected and reused
✅ No "Installing cf" message appears when system CF is available
Related Issues
Fixes integration test failures in specs-edge-integration-master-cflinuxfs4 job
Related to PR #856 (reverted by github-config sync)
Matches the fix in r-buildpack (commit cce4022)
Follow-up Actions
Until the fix is merged in github-config, this PR should be maintained in the nodejs-buildpack to keep integration tests working.
Checklist
✅ Code follows the project's style guidelines
✅ Tests pass locally and in CI
✅ Documentation updated (inline comments added)
✅ Corresponding fix needs to be submitted to buildpacks-github-config