From ca711517a2d794e36267ef4fd3867137b8e83285 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Wed, 6 Apr 2022 23:33:36 +0100 Subject: [PATCH 01/11] fix: enable self updating CLI --- cmd/rhoas/main.go | 6 ++ go.mod | 6 ++ go.sum | 27 ++++++++- pkg/cmd/root/root.go | 2 - pkg/core/cmdutil/selfupdate.go | 56 +++++++++++++++++++ pkg/core/config/type.go | 1 + pkg/core/localize/locales/en/cmd/main.en.toml | 5 +- 7 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 pkg/core/cmdutil/selfupdate.go diff --git a/cmd/rhoas/main.go b/cmd/rhoas/main.go index 977b2e1c17..1b1d2cc1ae 100644 --- a/cmd/rhoas/main.go +++ b/cmd/rhoas/main.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/redhat-developer/app-services-cli/pkg/cmd/root" + "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/servicecontext" @@ -178,6 +179,11 @@ func executeCommandWithTelemetry(rootCmd *cobra.Command, cmdFactory *factory.Fac if cmd.Runnable() && !cmd.Hidden { commandPath = cmd.CommandPath() } + updated, err := cmdutil.DoSelfUpdateOnceADay(cmdFactory.Logger, cmdFactory.Config) + fmt.Print(updated) + if err != nil { + cmdFactory.Logger.Errorf(cmdFactory.Localizer.MustLocalize("main.update.error", localize.NewEntry("Error", err))) + } } err = rootCmd.Execute() diff --git a/go.mod b/go.mod index 4af5130325..dbad1ff5ef 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/MakeNowJust/heredoc v1.0.0 github.com/Nerzal/gocloak/v7 v7.11.0 github.com/aerogear/charmil v0.8.3 + github.com/blang/semver v3.5.1+incompatible github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect github.com/briandowns/spinner v1.18.1 github.com/coreos/go-oidc/v3 v3.1.0 @@ -28,14 +29,19 @@ require ( github.com/redhat-developer/app-services-sdk-go/registryinstance v0.3.1 github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1 github.com/redhat-developer/service-binding-operator v0.9.0 + github.com/rhysd/go-github-selfupdate v1.2.3 github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 + github.com/ulikunitz/xz v0.5.10 // indirect github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a + golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect + golang.org/x/net v0.0.0-20220403103023-749bd193bc2b // indirect golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a golang.org/x/text v0.3.7 golang.org/x/tools v0.1.7 // indirect + google.golang.org/protobuf v1.28.0 // indirect gopkg.in/segmentio/analytics-go.v3 v3.1.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.22.4 diff --git a/go.sum b/go.sum index b5ecf7def2..438fd5d818 100644 --- a/go.sum +++ b/go.sum @@ -120,6 +120,7 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= @@ -355,8 +356,11 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo= +github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8= github.com/google/go-github/v39 v39.2.0 h1:rNNM311XtPOz5rDdsJXAp2o8F67X9FnROXTvto3aSnQ= github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -438,6 +442,8 @@ github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8= +github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= @@ -563,6 +569,7 @@ github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= @@ -638,6 +645,8 @@ github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1 h1:3sUmQ3nAa github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1/go.mod h1:w6MhtwfivfTB0KUpRFBiXfZROOvPeigGsR6RZt7F1Qg= github.com/redhat-developer/service-binding-operator v0.9.0 h1:CS+eEtzu/PtWuyvYQFQpZXd6ukSuFtN+U0EKKtTsvlA= github.com/redhat-developer/service-binding-operator v0.9.0/go.mod h1:D415gZQiz5Q8zyRbmrNrlieb6Xp73oFtCb+nCuTL6GA= +github.com/rhysd/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag= +github.com/rhysd/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -704,6 +713,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw= +github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE= github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -714,6 +725,9 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= @@ -797,11 +811,13 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o= +golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -894,9 +910,12 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220403103023-749bd193bc2b h1:vI32FkLJNAWtGD4BwkThwEy6XS7ZLLMHkSkYfF8M0W0= +golang.org/x/net v0.0.0-20220403103023-749bd193bc2b/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1125,6 +1144,7 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -1210,8 +1230,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 663e8e6eea..cfd9f398dc 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -40,8 +40,6 @@ func NewRootCommand(f *factory.Factory, version string) *cobra.Command { cmd.Version = version - // pflag.CommandLine.AddGoFlagSet(flag.CommandLine) - // Child commands cmd.AddCommand(login.NewLoginCmd(f)) cmd.AddCommand(logout.NewLogoutCommand(f)) diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go new file mode 100644 index 0000000000..0d9d29a9a3 --- /dev/null +++ b/pkg/core/cmdutil/selfupdate.go @@ -0,0 +1,56 @@ +package cmdutil + +import ( + "time" + + "github.com/blang/semver" + "github.com/redhat-developer/app-services-cli/internal/build" + "github.com/redhat-developer/app-services-cli/pkg/core/config" + "github.com/redhat-developer/app-services-cli/pkg/core/logging" + "github.com/rhysd/go-github-selfupdate/selfupdate" +) + +func DoSelfUpdate(logger logging.Logger) (bool, error) { + version := build.Version + if build.IsDevBuild() { + // TODO uncomment later + //return false, nil + version = "0.0.0" + } + + v := semver.MustParse(version) + latest, err := selfupdate.UpdateSelf(v, build.RepositoryOwner+"/"+build.RepositoryName) + if err != nil { + return false, err + } + if latest.Version.Equals(v) { + // latest version is the same as current version. It means current binary is up to date. + logger.Debug("Current binary is the latest version", version) + } else { + logger.Info("Successfully updated RHOAS CLI to latest version", latest.Version) + logger.Info("Release notes:\n", latest.ReleaseNotes) + return true, err + } + + return false, nil +} + +func DoSelfUpdateOnceADay(logger logging.Logger, loader config.IConfig) (bool, error) { + cfg, err := loader.Load() + if err != nil { + return false, err + } + logger.Debug("Last updated cli", cfg.LastUpdated) + + if cfg.LastUpdated < time.Now().AddDate(0, 0, -1).UnixMilli() { + logger.Debug("Updating CLI") + return DoSelfUpdate(logger) + } + + cfg.LastUpdated = time.Now().UnixMilli() + err = loader.Save(cfg) + if err != nil { + return false, err + } + return false, nil +} diff --git a/pkg/core/config/type.go b/pkg/core/config/type.go index fa06e6fc42..ce143b6287 100644 --- a/pkg/core/config/type.go +++ b/pkg/core/config/type.go @@ -24,6 +24,7 @@ type Config struct { Insecure bool `json:"insecure,omitempty" doc:"Enables insecure communication with the server. This disables verification of TLS certificates and host names."` Scopes []string `json:"scopes,omitempty" doc:"OpenID scope. If this option is used it will replace completely the default scopes. Can be repeated multiple times to specify multiple scopes."` Telemetry string `json:"telemetry,omitempty" doc:"Flag used to enable telemetry for user."` + LastUpdated int64 `json:"last_updated,omitempty" doc:"Timestamp of the last update cli"` } // ServiceConfigMap is a map of configs for the application services diff --git a/pkg/core/localize/locales/en/cmd/main.en.toml b/pkg/core/localize/locales/en/cmd/main.en.toml index 6919eeeadf..bad8361d91 100644 --- a/pkg/core/localize/locales/en/cmd/main.en.toml +++ b/pkg/core/localize/locales/en/cmd/main.en.toml @@ -2,4 +2,7 @@ one = 'Error when initializing configuration: "{{.Error}}"' [main.context.error] -one = 'Error when initializing service contexts: "{{.Error}}"' \ No newline at end of file +one = 'Error when initializing service contexts: "{{.Error}}"' + +[main.update.error] +one = 'Error when updating cli: "{{.Error}}"' From 24e374b11a0d14c51b626bf7e0f68e7f886a15a7 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Wed, 6 Apr 2022 23:45:33 +0100 Subject: [PATCH 02/11] fix: reorder self update method --- pkg/core/cmdutil/selfupdate.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index 0d9d29a9a3..d1ce5ce091 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -44,13 +44,17 @@ func DoSelfUpdateOnceADay(logger logging.Logger, loader config.IConfig) (bool, e if cfg.LastUpdated < time.Now().AddDate(0, 0, -1).UnixMilli() { logger.Debug("Updating CLI") - return DoSelfUpdate(logger) - } - cfg.LastUpdated = time.Now().UnixMilli() - err = loader.Save(cfg) - if err != nil { - return false, err + updated, err := DoSelfUpdate(logger) + if err != nil { + return false, err + } + cfg.LastUpdated = time.Now().UnixMilli() + err = loader.Save(cfg) + if err != nil { + return false, err + } + return updated, nil } return false, nil } From 7c888a333208dc2c709c303d221eec5c36981744 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Fri, 8 Apr 2022 12:59:37 +0100 Subject: [PATCH 03/11] fix: remove fmt --- cmd/rhoas/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/rhoas/main.go b/cmd/rhoas/main.go index 1b1d2cc1ae..e5ea13db88 100644 --- a/cmd/rhoas/main.go +++ b/cmd/rhoas/main.go @@ -179,9 +179,8 @@ func executeCommandWithTelemetry(rootCmd *cobra.Command, cmdFactory *factory.Fac if cmd.Runnable() && !cmd.Hidden { commandPath = cmd.CommandPath() } - updated, err := cmdutil.DoSelfUpdateOnceADay(cmdFactory.Logger, cmdFactory.Config) - fmt.Print(updated) - if err != nil { + _, err1 := cmdutil.DoSelfUpdateOnceADay(cmdFactory.Logger, cmdFactory.Config) + if err1 != nil { cmdFactory.Logger.Errorf(cmdFactory.Localizer.MustLocalize("main.update.error", localize.NewEntry("Error", err))) } } From 00ae50e45ed0a48eba3a3141de4ef7d06cc0c6f7 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Mon, 11 Apr 2022 14:57:06 +0100 Subject: [PATCH 04/11] fix: add update confirmation --- cmd/rhoas/main.go | 2 +- pkg/core/cmdutil/selfupdate.go | 69 ++++++++++++++------- pkg/core/localize/locales/en/common.en.toml | 11 ++++ 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/cmd/rhoas/main.go b/cmd/rhoas/main.go index e5ea13db88..f319235c10 100644 --- a/cmd/rhoas/main.go +++ b/cmd/rhoas/main.go @@ -179,7 +179,7 @@ func executeCommandWithTelemetry(rootCmd *cobra.Command, cmdFactory *factory.Fac if cmd.Runnable() && !cmd.Hidden { commandPath = cmd.CommandPath() } - _, err1 := cmdutil.DoSelfUpdateOnceADay(cmdFactory.Logger, cmdFactory.Config) + _, err1 := cmdutil.DoSelfUpdateOnceADay(cmdFactory) if err1 != nil { cmdFactory.Logger.Errorf(cmdFactory.Localizer.MustLocalize("main.update.error", localize.NewEntry("Error", err))) } diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index d1ce5ce091..3b7b56ebbc 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -3,54 +3,81 @@ package cmdutil import ( "time" + "github.com/AlecAivazis/survey/v2" "github.com/blang/semver" "github.com/redhat-developer/app-services-cli/internal/build" - "github.com/redhat-developer/app-services-cli/pkg/core/config" - "github.com/redhat-developer/app-services-cli/pkg/core/logging" + "github.com/redhat-developer/app-services-cli/pkg/core/localize" + "github.com/redhat-developer/app-services-cli/pkg/shared/factory" "github.com/rhysd/go-github-selfupdate/selfupdate" ) -func DoSelfUpdate(logger logging.Logger) (bool, error) { +// DoSelfUpdate checks for updates and prompts the user to update if there is a newer version available +func DoSelfUpdate(f *factory.Factory) (bool, error) { version := build.Version + // TODO temp if build.IsDevBuild() { - // TODO uncomment later - //return false, nil version = "0.0.0" } v := semver.MustParse(version) - latest, err := selfupdate.UpdateSelf(v, build.RepositoryOwner+"/"+build.RepositoryName) + versionToUpdate, found, err := selfupdate.DefaultUpdater().DetectLatest(version) + + if found && versionToUpdate.Version.Equals(v) { + // latest version is the same as current version. It means current binary is up to date. + f.Logger.Debug("Current binary is the latest version", version) + return false, nil + } + + promptConfirmName := &survey.Confirm{ + Message: f.Localizer.MustLocalize("common.selfupdate.confirm"), + } + + var confirmUpdate bool + err = survey.AskOne(promptConfirmName, &confirmUpdate) if err != nil { return false, err } - if latest.Version.Equals(v) { - // latest version is the same as current version. It means current binary is up to date. - logger.Debug("Current binary is the latest version", version) - } else { - logger.Info("Successfully updated RHOAS CLI to latest version", latest.Version) - logger.Info("Release notes:\n", latest.ReleaseNotes) - return true, err + + if !confirmUpdate { + return false, nil } - return false, nil + latest, err := selfupdate.UpdateSelf(v, build.RepositoryOwner+"/"+build.RepositoryName) + if err != nil { + return false, err + } + + f.Logger.Info(f.Localizer.MustLocalize("common.selfupdate.success", localize.NewEntry("Version", latest.Version))) + return true, err + } -func DoSelfUpdateOnceADay(logger logging.Logger, loader config.IConfig) (bool, error) { - cfg, err := loader.Load() +func DoSelfUpdateOnceADay(f *factory.Factory) (bool, error) { + if !f.IOStreams.CanPrompt() { + // Do not prompt if we are not in interactive mode + return false, nil + } + + if build.IsDevBuild() { + return false, nil + } + + cfg, err := f.Config.Load() + + logger := f.Logger + if err != nil { return false, err } - logger.Debug("Last updated cli", cfg.LastUpdated) + logger.Debug("Checking for updates. Last check was done:", cfg.LastUpdated) if cfg.LastUpdated < time.Now().AddDate(0, 0, -1).UnixMilli() { - logger.Debug("Updating CLI") - - updated, err := DoSelfUpdate(logger) + updated, err := DoSelfUpdate(f) if err != nil { return false, err } cfg.LastUpdated = time.Now().UnixMilli() - err = loader.Save(cfg) + err = f.Config.Save(cfg) if err != nil { return false, err } diff --git a/pkg/core/localize/locales/en/common.en.toml b/pkg/core/localize/locales/en/common.en.toml index 2c52984fe5..d16f9e5bbe 100644 --- a/pkg/core/localize/locales/en/common.en.toml +++ b/pkg/core/localize/locales/en/common.en.toml @@ -21,3 +21,14 @@ You can also disable telemetry by setting the "RHOAS_TELEMETRY" environment vari [common.telemetry.question] one = 'Do you agree to send anonymous data' + +[common.selfupdate.confirm] +one = ''' +New version of the RHOAS CLI detected. +Do you want CLI to be updated to the latest version now? + +NOTE: You might need to run the CLI as root to make sure that binary file can be updated. +''' + +[common.selfupdate.success] +one = 'RHOAS CLI updated to version {{.Version}}' \ No newline at end of file From 7ac26d3dd459dfeca54acd8786f4f509a50a5b02 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Mon, 11 Apr 2022 14:58:56 +0100 Subject: [PATCH 05/11] fix: remove temp check --- pkg/core/cmdutil/selfupdate.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index 3b7b56ebbc..4c31cc2ca0 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -14,10 +14,6 @@ import ( // DoSelfUpdate checks for updates and prompts the user to update if there is a newer version available func DoSelfUpdate(f *factory.Factory) (bool, error) { version := build.Version - // TODO temp - if build.IsDevBuild() { - version = "0.0.0" - } v := semver.MustParse(version) versionToUpdate, found, err := selfupdate.DefaultUpdater().DetectLatest(version) From 5a939fcb11310177d1cc21a75629289680a1e4f4 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Mon, 11 Apr 2022 15:11:35 +0100 Subject: [PATCH 06/11] fix: add comment --- pkg/core/cmdutil/selfupdate.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index 4c31cc2ca0..ae18d18a67 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -48,6 +48,7 @@ func DoSelfUpdate(f *factory.Factory) (bool, error) { } +// DoSelfUpdate checks for updates once per day and prompts the user to update if there is a newer version available func DoSelfUpdateOnceADay(f *factory.Factory) (bool, error) { if !f.IOStreams.CanPrompt() { // Do not prompt if we are not in interactive mode From 566f9cf4a8b9ebce7b19498a3461d861f1e3a4f6 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Mon, 11 Apr 2022 15:15:55 +0100 Subject: [PATCH 07/11] fix: return if not possible to determine update --- pkg/core/cmdutil/selfupdate.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index ae18d18a67..5caa77dc5b 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -17,7 +17,9 @@ func DoSelfUpdate(f *factory.Factory) (bool, error) { v := semver.MustParse(version) versionToUpdate, found, err := selfupdate.DefaultUpdater().DetectLatest(version) - + if err != nil { + return false, err + } if found && versionToUpdate.Version.Equals(v) { // latest version is the same as current version. It means current binary is up to date. f.Logger.Debug("Current binary is the latest version", version) From 2c6fa89ab13c35225a800691f49d3a38c7c05fea Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Mon, 11 Apr 2022 15:26:08 +0100 Subject: [PATCH 08/11] fix: use our own package until we get upstream fixed --- go-github-selfupdate | 1 + go.mod | 2 +- go.sum | 6 ++++-- pkg/core/cmdutil/selfupdate.go | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 160000 go-github-selfupdate diff --git a/go-github-selfupdate b/go-github-selfupdate new file mode 160000 index 0000000000..406b6c89a1 --- /dev/null +++ b/go-github-selfupdate @@ -0,0 +1 @@ +Subproject commit 406b6c89a1ed4576e363fdc01ba39d4f0cf2c06f diff --git a/go.mod b/go.mod index dbad1ff5ef..a4a84e0b90 100644 --- a/go.mod +++ b/go.mod @@ -29,11 +29,11 @@ require ( github.com/redhat-developer/app-services-sdk-go/registryinstance v0.3.1 github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1 github.com/redhat-developer/service-binding-operator v0.9.0 - github.com/rhysd/go-github-selfupdate v1.2.3 github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 github.com/ulikunitz/xz v0.5.10 // indirect + github.com/wtrocki/go-github-selfupdate v1.2.4 // indirect github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect diff --git a/go.sum b/go.sum index 438fd5d818..8c09825d83 100644 --- a/go.sum +++ b/go.sum @@ -645,8 +645,8 @@ github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1 h1:3sUmQ3nAa github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1/go.mod h1:w6MhtwfivfTB0KUpRFBiXfZROOvPeigGsR6RZt7F1Qg= github.com/redhat-developer/service-binding-operator v0.9.0 h1:CS+eEtzu/PtWuyvYQFQpZXd6ukSuFtN+U0EKKtTsvlA= github.com/redhat-developer/service-binding-operator v0.9.0/go.mod h1:D415gZQiz5Q8zyRbmrNrlieb6Xp73oFtCb+nCuTL6GA= -github.com/rhysd/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag= -github.com/rhysd/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg= +github.com/wtrocki/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag= +github.com/wtrocki/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -730,6 +730,8 @@ github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= +github.com/wtrocki/go-github-selfupdate v1.2.4 h1:dFm8Ge+wHJ3ahS3OE05tsNI6w+W/YdJre7k2dNO6uMk= +github.com/wtrocki/go-github-selfupdate v1.2.4/go.mod h1:sXGbZniTJbQoWzXGdfVTgPWLEBEq5SX6jxO7q+J7ymo= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index 5caa77dc5b..b9bcf8e7a0 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -8,7 +8,7 @@ import ( "github.com/redhat-developer/app-services-cli/internal/build" "github.com/redhat-developer/app-services-cli/pkg/core/localize" "github.com/redhat-developer/app-services-cli/pkg/shared/factory" - "github.com/rhysd/go-github-selfupdate/selfupdate" + "github.com/wtrocki/go-github-selfupdate/selfupdate" ) // DoSelfUpdate checks for updates and prompts the user to update if there is a newer version available From 377a6341892e7ad8dbf6d7ea9793df610cc4c9e2 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Mon, 11 Apr 2022 15:26:40 +0100 Subject: [PATCH 09/11] fix: demete submodule --- go-github-selfupdate | 1 - 1 file changed, 1 deletion(-) delete mode 160000 go-github-selfupdate diff --git a/go-github-selfupdate b/go-github-selfupdate deleted file mode 160000 index 406b6c89a1..0000000000 --- a/go-github-selfupdate +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 406b6c89a1ed4576e363fdc01ba39d4f0cf2c06f From bf1312cbbf0738e01c259480250af27b42c291b2 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Tue, 12 Apr 2022 10:21:16 +0100 Subject: [PATCH 10/11] fix: update message to include version --- cmd/rhoas/main.go | 6 +++--- pkg/core/cmdutil/selfupdate.go | 7 ++++--- pkg/core/localize/locales/en/common.en.toml | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/rhoas/main.go b/cmd/rhoas/main.go index f319235c10..5813f1740c 100644 --- a/cmd/rhoas/main.go +++ b/cmd/rhoas/main.go @@ -179,9 +179,9 @@ func executeCommandWithTelemetry(rootCmd *cobra.Command, cmdFactory *factory.Fac if cmd.Runnable() && !cmd.Hidden { commandPath = cmd.CommandPath() } - _, err1 := cmdutil.DoSelfUpdateOnceADay(cmdFactory) - if err1 != nil { - cmdFactory.Logger.Errorf(cmdFactory.Localizer.MustLocalize("main.update.error", localize.NewEntry("Error", err))) + _, newErr := cmdutil.DoSelfUpdateOnceADay(cmdFactory) + if newErr != nil { + cmdFactory.Logger.Errorf(cmdFactory.Localizer.MustLocalize("main.update.error", localize.NewEntry("Error", newErr))) } } err = rootCmd.Execute() diff --git a/pkg/core/cmdutil/selfupdate.go b/pkg/core/cmdutil/selfupdate.go index b9bcf8e7a0..ae97a773ef 100644 --- a/pkg/core/cmdutil/selfupdate.go +++ b/pkg/core/cmdutil/selfupdate.go @@ -14,9 +14,10 @@ import ( // DoSelfUpdate checks for updates and prompts the user to update if there is a newer version available func DoSelfUpdate(f *factory.Factory) (bool, error) { version := build.Version + slug := build.RepositoryOwner + "/" + build.RepositoryName v := semver.MustParse(version) - versionToUpdate, found, err := selfupdate.DefaultUpdater().DetectLatest(version) + versionToUpdate, found, err := selfupdate.DefaultUpdater().DetectLatest(slug) if err != nil { return false, err } @@ -27,7 +28,7 @@ func DoSelfUpdate(f *factory.Factory) (bool, error) { } promptConfirmName := &survey.Confirm{ - Message: f.Localizer.MustLocalize("common.selfupdate.confirm"), + Message: f.Localizer.MustLocalize("common.selfupdate.confirm", localize.NewEntry("Version", versionToUpdate.Version.String())), } var confirmUpdate bool @@ -40,7 +41,7 @@ func DoSelfUpdate(f *factory.Factory) (bool, error) { return false, nil } - latest, err := selfupdate.UpdateSelf(v, build.RepositoryOwner+"/"+build.RepositoryName) + latest, err := selfupdate.UpdateSelf(v, slug) if err != nil { return false, err } diff --git a/pkg/core/localize/locales/en/common.en.toml b/pkg/core/localize/locales/en/common.en.toml index d16f9e5bbe..5a57091016 100644 --- a/pkg/core/localize/locales/en/common.en.toml +++ b/pkg/core/localize/locales/en/common.en.toml @@ -24,10 +24,10 @@ one = 'Do you agree to send anonymous data' [common.selfupdate.confirm] one = ''' -New version of the RHOAS CLI detected. -Do you want CLI to be updated to the latest version now? +RHOAS CLI can be updated to {{.Version}}. +Do you want to update now? -NOTE: You might need to run the CLI as root to make sure that binary file can be updated. +NOTE: You might need to run command as root to update RHOAS CLI binary. ''' [common.selfupdate.success] From a129d767699e1d23c3997e1f30f3fa91c6116462 Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Tue, 12 Apr 2022 10:28:53 +0100 Subject: [PATCH 11/11] fix: update package with fix --- go.mod | 2 +- go.sum | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a4a84e0b90..37bf3df423 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 github.com/ulikunitz/xz v0.5.10 // indirect - github.com/wtrocki/go-github-selfupdate v1.2.4 // indirect + github.com/wtrocki/go-github-selfupdate v1.2.4 github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect diff --git a/go.sum b/go.sum index 8c09825d83..baa9d58a6c 100644 --- a/go.sum +++ b/go.sum @@ -645,8 +645,6 @@ github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1 h1:3sUmQ3nAa github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1/go.mod h1:w6MhtwfivfTB0KUpRFBiXfZROOvPeigGsR6RZt7F1Qg= github.com/redhat-developer/service-binding-operator v0.9.0 h1:CS+eEtzu/PtWuyvYQFQpZXd6ukSuFtN+U0EKKtTsvlA= github.com/redhat-developer/service-binding-operator v0.9.0/go.mod h1:D415gZQiz5Q8zyRbmrNrlieb6Xp73oFtCb+nCuTL6GA= -github.com/wtrocki/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag= -github.com/wtrocki/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=