Skip to content

Show job GUID in service command progress hints - #3876

Open
johha wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:job-guid-service-hints
Open

johha wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:job-guid-service-hints

Conversation

@johha

@johha johha commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Note: This PR targets main. Backport for v8: #3877.

Description of the Change

Async service operations (create/update/delete/bind/unbind, and their keys) are carried out by a Cloud Controller job. The CLI has no first-class concept of a job - there is no cf jobs command - so once a command returns on the no-wait path, the user has no handle to the operation that is still running server-side. The job GUID is the only identifier that lets anyone inspect that work (via cf curl v3/jobs/<guid>), and today it is shown only when a job fails or times out (JobFailedError, JobTimeoutError).

This change surfaces the job GUID on the in-progress path as well. When a service command returns while the operation is still running (no --wait), it now prints an extra line after the existing status hint:

Delete in progress. Use 'cf services' or 'cf service my-si' to check operation status.
Job (87154c19-e709-4062-bc84-87f0cd2c3dd3) is being processed.
OK

Implementation:

  • Add a JobGUID field to PollJobEvent at both the ccv3 and v7action layers, mirroring how State/Err/Warnings are already threaded through those two structs. It is populated from the already-existing ccv3.Job.GUID.
  • shared.WaitForResult now returns the observed job GUID: (bool, error) → (bool, string, error) (internal helper, not a user-facing CLI change).
  • Add a small shared.DisplayJobHint(ui, jobGUID) helper that prints Job (<guid>) is being processed. and no-ops on an empty GUID.
  • Call it from the in-progress branch of the 11 service commands: bind-route-service, bind-service, cleanup-outdated-service-bindings, create-service, create-service-key, delete-service, delete-service-key, unbind-route-service, unbind-service, update-service, upgrade-service.

The hint is deliberately emitted per call site rather than centrally inside WaitForResult, because it is interleaved with each command's own command-specific text (e.g. the TIP: ...restage line in bind-service) and because delete/delete-org/delete-space intentionally do not show it. Those three delete commands always wait to completion (no no-wait path), so they only pick up the new return signature (_, _, err) and print nothing new.

No new flags, no reworded or removed existing output, and warning de-duplication behavior is unchanged.

Why Is This PR Valuable?

With recent CF API changes, service deletions and other async operations can take significantly longer depending on the service broker. Users increasingly hit "is it even being processed?", "why is it taking so long?", and "why did it fail?" - and the returned error alone is often not enough. The job GUID is the single traceable key to that information. It also helps operators: when a user reports "a command hangs forever" without -v logs or resource GUIDs, the job GUID is frequently the only thread an operator has to trace the operation in Cloud Controller.

Applicable Issues

How Urgent Is The Change?

Not urgent. Quality-of-life / supportability improvement.

Other Relevant Parties

CF operators who triage long-running or stuck service operations; users of the service lifecycle commands listed above.


Note: this PR was developed with AI assistance, with manual review and testing by the author.

Async service operations run as CC jobs with no CLI-visible
handle. When a command returns before the job finishes
(no --wait provided), print the job GUID so users and operators can
trace it via 'cf curl v3/jobs/<guid>' which is the only key to that
job's status and warnings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant