simplified service update message to user (#587)

```bash
➜  client git:(master) ✗ ./kn service update summary-fn --untag sync1
Using kn config file: /Users/maximilien/.kn/config.yaml
Updating Service 'summary-fn' in namespace 'default':

  0.089s Ready to serve.

Service 'summary-fn' with latest revision 'summary-fn-nxqwb-41' (unchanged) is available at URL:
http://summary-fn-default.kndemo-267179.sjc03.containers.appdomain.cloud

➜  client git:(master) ✗ ./kn service update summary-fn --image docker.io/drmax/summary-fn:latest
Using kn config file: /Users/maximilien/.kn/config.yaml
Updating Service 'summary-fn' in namespace 'default':

  0.091s The Configuration is still working to reflect the latest desired specification.
  6.317s Ready to serve.

Service 'summary-fn' updated to latest revision 'summary-fn-jfjcy-42' is available at URL:
http://summary-fn-default.kndemo-267179.sjc03.containers.appdomain.cloud
```
This commit is contained in:
dr.max 2020-01-10 07:16:56 -08:00 committed by Knative Prow Robot
parent 6ab9980e16
commit 3c23f6ad4e
1 changed files with 6 additions and 3 deletions

View File

@ -59,15 +59,18 @@ func showUrl(client serving_kn_v1alpha1.KnServingClient, serviceName string, ori
if err != nil {
return fmt.Errorf("cannot fetch service '%s' in namespace '%s' for extracting the URL: %v", serviceName, client.Namespace(), err)
}
url := service.Status.URL.String()
if url == "" {
url = service.Status.DeprecatedDomain
}
revisionUpdateStatus := ""
newRevision := service.Status.LatestReadyRevisionName
if originalRevision != "" && originalRevision == newRevision {
revisionUpdateStatus = " (unchanged)"
fmt.Fprintf(out, "Service '%s' with latest revision '%s' (unchanged) is available at URL:\n%s\n", serviceName, newRevision, url)
} else {
fmt.Fprintf(out, "Service '%s' %s to latest revision '%s' is available at URL:\n%s\n", serviceName, what, newRevision, url)
}
fmt.Fprintf(out, "Service '%s' %s with latest revision '%s'%s and URL:\n%s\n", serviceName, what, newRevision, revisionUpdateStatus, url)
return nil
}