* [PR PATCH] RFC: k9s: remove code that checks for new versions.
@ 2021-03-26 16:44 Gottox
2021-03-26 16:50 ` leahneukirchen
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Gottox @ 2021-03-26 16:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 541 bytes --]
There is a new pull request by Gottox against master on the void-packages repository
https://github.com/Gottox/void-packages k9s-no-connecting-to-github
https://github.com/void-linux/void-packages/pull/29762
RFC: k9s: remove code that checks for new versions.
This PR adds a patch to `k9s` that prevents the program to connect to github once per hour to check for new versions. We track that with void anyway and in my opinion it's an antifeature.
A patch file from https://github.com/void-linux/void-packages/pull/29762.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-k9s-no-connecting-to-github-29762.patch --]
[-- Type: text/x-diff, Size: 3398 bytes --]
From ee3b9f4c282033b3c3c22483025c0ac0ecbc3fb7 Mon Sep 17 00:00:00 2001
From: Enno Boland <gottox@voidlinux.org>
Date: Fri, 26 Mar 2021 17:30:57 +0100
Subject: [PATCH] k9s: remove code that checks for new versions.
---
srcpkgs/k9s/patches/no-phoning-home.diff | 89 ++++++++++++++++++++++++
srcpkgs/k9s/template | 2 +-
2 files changed, 90 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/k9s/patches/no-phoning-home.diff
diff --git a/srcpkgs/k9s/patches/no-phoning-home.diff b/srcpkgs/k9s/patches/no-phoning-home.diff
new file mode 100644
index 000000000000..45373c6f1081
--- /dev/null
+++ b/srcpkgs/k9s/patches/no-phoning-home.diff
@@ -0,0 +1,89 @@
+diff --git a/internal/model/cluster_info.go b/internal/model/cluster_info.go
+index 05564a07..ee04ae87 100644
+--- internal/model/cluster_info.go
++++ internal/model/cluster_info.go
+@@ -2,10 +2,6 @@ package model
+
+ import (
+ "context"
+- "encoding/json"
+- "errors"
+- "io/ioutil"
+- "net/http"
+ "time"
+
+ "github.com/derailed/k9s/internal/client"
+@@ -94,22 +90,6 @@ func NewClusterInfo(f dao.Factory, version string) *ClusterInfo {
+ return &c
+ }
+
+-func (c *ClusterInfo) fetchK9sLatestRev() string {
+- rev, ok := c.cache.Get(k9sLatestRevKey)
+- if ok {
+- return rev.(string)
+- }
+-
+- latestRev, err := fetchLastestRev()
+- if err != nil {
+- log.Error().Msgf("k9s latest rev fetch failed")
+- } else {
+- c.cache.Add(k9sLatestRevKey, latestRev, cacheExpiry)
+- }
+-
+- return latestRev
+-}
+-
+ // Reset resets context and reload.
+ func (c *ClusterInfo) Reset(f dao.Factory) {
+ c.cluster, c.data = NewCluster(f), NewClusterMeta()
+@@ -123,7 +103,7 @@ func (c *ClusterInfo) Refresh() {
+ data.Cluster = c.cluster.ClusterName()
+ data.User = c.cluster.UserName()
+ data.K9sVer = c.version
+- v1, v2 := NewSemVer(data.K9sVer), NewSemVer(c.fetchK9sLatestRev())
++ v1, v2 := NewSemVer(data.K9sVer), NewSemVer(data.K9sVer)
+ data.K9sVer, data.K9sLatest = v1.String(), v2.String()
+ if v1.IsCurrent(v2) {
+ data.K9sLatest = ""
+@@ -178,41 +158,3 @@ func (c *ClusterInfo) fireNoMetaChanged(data ClusterMeta) {
+ l.ClusterInfoUpdated(data)
+ }
+ }
+-
+-// Helpers...
+-
+-func fetchLastestRev() (string, error) {
+- log.Debug().Msgf("Fetching latest k9s rev...")
+- ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
+- defer cancel()
+-
+- req, err := http.NewRequestWithContext(ctx, http.MethodGet, k9sGitURL, nil)
+- if err != nil {
+- return "", err
+- }
+- resp, err := http.DefaultClient.Do(req)
+- if err != nil {
+- return "", err
+- }
+- defer func() {
+- if resp.Body != nil {
+- _ = resp.Body.Close()
+- }
+- }()
+-
+- b, err := ioutil.ReadAll(resp.Body)
+- if err != nil {
+- return "", err
+- }
+- m := make(map[string]interface{}, 20)
+- if err := json.Unmarshal(b, &m); err != nil {
+- return "", err
+- }
+-
+- if v, ok := m["name"]; ok {
+- log.Debug().Msgf("K9s latest rev: %q", v.(string))
+- return v.(string), nil
+- }
+-
+- return "", errors.New("No version found")
+-}
diff --git a/srcpkgs/k9s/template b/srcpkgs/k9s/template
index da44bfaf06d7..579c9f2d541c 100644
--- a/srcpkgs/k9s/template
+++ b/srcpkgs/k9s/template
@@ -1,7 +1,7 @@
# Template file for 'k9s'
pkgname=k9s
version=0.24.4
-revision=1
+revision=2
build_style=go
go_import_path="github.com/derailed/k9s"
go_ldflags="-X ${go_import_path}/cmd.version=${version}"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: k9s: remove code that checks for new versions.
2021-03-26 16:44 [PR PATCH] RFC: k9s: remove code that checks for new versions Gottox
@ 2021-03-26 16:50 ` leahneukirchen
2021-03-26 16:52 ` ericonr
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2021-03-26 16:50 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 230 bytes --]
New comment by leahneukirchen on void-packages repository
https://github.com/void-linux/void-packages/pull/29762#issuecomment-808367889
Comment:
Not against it in principle, but also not fond of updating that patch when needed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: k9s: remove code that checks for new versions.
2021-03-26 16:44 [PR PATCH] RFC: k9s: remove code that checks for new versions Gottox
2021-03-26 16:50 ` leahneukirchen
@ 2021-03-26 16:52 ` ericonr
2021-03-29 12:16 ` [PR PATCH] [Updated] " Gottox
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ericonr @ 2021-03-26 16:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
New comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/29762#issuecomment-808368546
Comment:
I assume it can't be made to not do this via a config option we could put into the default config file?
Anyway, as long as our update check for it is verified to be working, I'm not against patching this. It's intrusive and unnecessary.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Updated] RFC: k9s: remove code that checks for new versions.
2021-03-26 16:44 [PR PATCH] RFC: k9s: remove code that checks for new versions Gottox
2021-03-26 16:50 ` leahneukirchen
2021-03-26 16:52 ` ericonr
@ 2021-03-29 12:16 ` Gottox
2022-05-14 2:17 ` github-actions
2022-05-29 2:13 ` [PR PATCH] [Closed]: " github-actions
4 siblings, 0 replies; 6+ messages in thread
From: Gottox @ 2021-03-29 12:16 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
There is an updated pull request by Gottox against master on the void-packages repository
https://github.com/Gottox/void-packages k9s-no-connecting-to-github
https://github.com/void-linux/void-packages/pull/29762
RFC: k9s: remove code that checks for new versions.
This PR adds a patch to `k9s` that prevents the program to connect to github once per hour to check for new versions. We track that with void anyway and in my opinion it's an antifeature.
A patch file from https://github.com/void-linux/void-packages/pull/29762.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-k9s-no-connecting-to-github-29762.patch --]
[-- Type: text/x-diff, Size: 3398 bytes --]
From ee3b9f4c282033b3c3c22483025c0ac0ecbc3fb7 Mon Sep 17 00:00:00 2001
From: Enno Boland <gottox@voidlinux.org>
Date: Fri, 26 Mar 2021 17:30:57 +0100
Subject: [PATCH] k9s: remove code that checks for new versions.
---
srcpkgs/k9s/patches/no-phoning-home.diff | 89 ++++++++++++++++++++++++
srcpkgs/k9s/template | 2 +-
2 files changed, 90 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/k9s/patches/no-phoning-home.diff
diff --git a/srcpkgs/k9s/patches/no-phoning-home.diff b/srcpkgs/k9s/patches/no-phoning-home.diff
new file mode 100644
index 000000000000..45373c6f1081
--- /dev/null
+++ b/srcpkgs/k9s/patches/no-phoning-home.diff
@@ -0,0 +1,89 @@
+diff --git a/internal/model/cluster_info.go b/internal/model/cluster_info.go
+index 05564a07..ee04ae87 100644
+--- internal/model/cluster_info.go
++++ internal/model/cluster_info.go
+@@ -2,10 +2,6 @@ package model
+
+ import (
+ "context"
+- "encoding/json"
+- "errors"
+- "io/ioutil"
+- "net/http"
+ "time"
+
+ "github.com/derailed/k9s/internal/client"
+@@ -94,22 +90,6 @@ func NewClusterInfo(f dao.Factory, version string) *ClusterInfo {
+ return &c
+ }
+
+-func (c *ClusterInfo) fetchK9sLatestRev() string {
+- rev, ok := c.cache.Get(k9sLatestRevKey)
+- if ok {
+- return rev.(string)
+- }
+-
+- latestRev, err := fetchLastestRev()
+- if err != nil {
+- log.Error().Msgf("k9s latest rev fetch failed")
+- } else {
+- c.cache.Add(k9sLatestRevKey, latestRev, cacheExpiry)
+- }
+-
+- return latestRev
+-}
+-
+ // Reset resets context and reload.
+ func (c *ClusterInfo) Reset(f dao.Factory) {
+ c.cluster, c.data = NewCluster(f), NewClusterMeta()
+@@ -123,7 +103,7 @@ func (c *ClusterInfo) Refresh() {
+ data.Cluster = c.cluster.ClusterName()
+ data.User = c.cluster.UserName()
+ data.K9sVer = c.version
+- v1, v2 := NewSemVer(data.K9sVer), NewSemVer(c.fetchK9sLatestRev())
++ v1, v2 := NewSemVer(data.K9sVer), NewSemVer(data.K9sVer)
+ data.K9sVer, data.K9sLatest = v1.String(), v2.String()
+ if v1.IsCurrent(v2) {
+ data.K9sLatest = ""
+@@ -178,41 +158,3 @@ func (c *ClusterInfo) fireNoMetaChanged(data ClusterMeta) {
+ l.ClusterInfoUpdated(data)
+ }
+ }
+-
+-// Helpers...
+-
+-func fetchLastestRev() (string, error) {
+- log.Debug().Msgf("Fetching latest k9s rev...")
+- ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
+- defer cancel()
+-
+- req, err := http.NewRequestWithContext(ctx, http.MethodGet, k9sGitURL, nil)
+- if err != nil {
+- return "", err
+- }
+- resp, err := http.DefaultClient.Do(req)
+- if err != nil {
+- return "", err
+- }
+- defer func() {
+- if resp.Body != nil {
+- _ = resp.Body.Close()
+- }
+- }()
+-
+- b, err := ioutil.ReadAll(resp.Body)
+- if err != nil {
+- return "", err
+- }
+- m := make(map[string]interface{}, 20)
+- if err := json.Unmarshal(b, &m); err != nil {
+- return "", err
+- }
+-
+- if v, ok := m["name"]; ok {
+- log.Debug().Msgf("K9s latest rev: %q", v.(string))
+- return v.(string), nil
+- }
+-
+- return "", errors.New("No version found")
+-}
diff --git a/srcpkgs/k9s/template b/srcpkgs/k9s/template
index da44bfaf06d7..579c9f2d541c 100644
--- a/srcpkgs/k9s/template
+++ b/srcpkgs/k9s/template
@@ -1,7 +1,7 @@
# Template file for 'k9s'
pkgname=k9s
version=0.24.4
-revision=1
+revision=2
build_style=go
go_import_path="github.com/derailed/k9s"
go_ldflags="-X ${go_import_path}/cmd.version=${version}"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: k9s: remove code that checks for new versions.
2021-03-26 16:44 [PR PATCH] RFC: k9s: remove code that checks for new versions Gottox
` (2 preceding siblings ...)
2021-03-29 12:16 ` [PR PATCH] [Updated] " Gottox
@ 2022-05-14 2:17 ` github-actions
2022-05-29 2:13 ` [PR PATCH] [Closed]: " github-actions
4 siblings, 0 replies; 6+ messages in thread
From: github-actions @ 2022-05-14 2:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
New comment by github-actions[bot] on void-packages repository
https://github.com/void-linux/void-packages/pull/29762#issuecomment-1126614070
Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Closed]: RFC: k9s: remove code that checks for new versions.
2021-03-26 16:44 [PR PATCH] RFC: k9s: remove code that checks for new versions Gottox
` (3 preceding siblings ...)
2022-05-14 2:17 ` github-actions
@ 2022-05-29 2:13 ` github-actions
4 siblings, 0 replies; 6+ messages in thread
From: github-actions @ 2022-05-29 2:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
There's a closed pull request on the void-packages repository
RFC: k9s: remove code that checks for new versions.
https://github.com/void-linux/void-packages/pull/29762
Description:
This PR adds a patch to `k9s` that prevents the program to connect to github once per hour to check for new versions. We track that with void anyway and in my opinion it's an antifeature.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-29 2:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 16:44 [PR PATCH] RFC: k9s: remove code that checks for new versions Gottox
2021-03-26 16:50 ` leahneukirchen
2021-03-26 16:52 ` ericonr
2021-03-29 12:16 ` [PR PATCH] [Updated] " Gottox
2022-05-14 2:17 ` github-actions
2022-05-29 2:13 ` [PR PATCH] [Closed]: " github-actions
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).