From 3c23f6ad4e01a87e03be22012d097e1593699e59 Mon Sep 17 00:00:00 2001 From: "dr.max" Date: Fri, 10 Jan 2020 07:16:56 -0800 Subject: [PATCH] simplified service update message to user (#587) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```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 ``` --- pkg/kn/commands/service/service.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/kn/commands/service/service.go b/pkg/kn/commands/service/service.go index aa93bd32c..5b6fa3e55 100644 --- a/pkg/kn/commands/service/service.go +++ b/pkg/kn/commands/service/service.go @@ -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 }