Skip to content

Commit

Permalink
simplified service update message to user (#587)
Browse files Browse the repository at this point in the history
```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
```
  • Loading branch information
maximilien authored and knative-prow-robot committed Jan 10, 2020
1 parent 6ab9980 commit 3c23f6a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/kn/commands/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 3c23f6a

Please sign in to comment.