Accepting request 1231655 from home:ojkastl_buildservice:Branch_devel_kubic
backport patch to fix login problems OBS-URL: https://build.opensuse.org/request/show/1231655 OBS-URL: https://build.opensuse.org/package/show/devel:kubic/perses-cli?expand=0&rev=9
This commit is contained in:
commit
83af581ba2
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
23
_service
Normal file
23
_service
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<services>
|
||||||
|
<service name="obs_scm" mode="manual">
|
||||||
|
<param name="url">https://github.com/perses/perses/</param>
|
||||||
|
<param name="scm">git</param>
|
||||||
|
<param name="exclude">.git</param>
|
||||||
|
<param name="revision">v0.49.0</param>
|
||||||
|
<param name="versionformat">@PARENT_TAG@</param>
|
||||||
|
<param name="changesgenerate">enable</param>
|
||||||
|
<param name="versionrewrite-pattern">v(.*)</param>
|
||||||
|
<param name="filename">perses-cli</param>
|
||||||
|
</service>
|
||||||
|
<service name="set_version" mode="manual">
|
||||||
|
</service>
|
||||||
|
<service name="go_modules" mode="manual">
|
||||||
|
</service>
|
||||||
|
<!-- services below are running at buildtime -->
|
||||||
|
<service name="tar" mode="buildtime">
|
||||||
|
</service>
|
||||||
|
<service name="recompress" mode="buildtime">
|
||||||
|
<param name="file">*.tar</param>
|
||||||
|
<param name="compression">gz</param>
|
||||||
|
</service>
|
||||||
|
</services>
|
4
_servicedata
Normal file
4
_servicedata
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<servicedata>
|
||||||
|
<service name="tar_scm">
|
||||||
|
<param name="url">https://github.com/perses/perses/</param>
|
||||||
|
<param name="changesrevision">49fb6056c41c2f49a849ebb01d751be0400f1286</param></service></servicedata>
|
121
b04061023c941d879460d81e6e4c6019621dbc16.patch
Normal file
121
b04061023c941d879460d81e6e4c6019621dbc16.patch
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
From b04061023c941d879460d81e6e4c6019621dbc16 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Augustin Husson <husson.augustin@gmail.com>
|
||||||
|
Date: Tue, 12 Nov 2024 10:42:49 +0100
|
||||||
|
Subject: [PATCH] =?UTF-8?q?[BUGFIX]=C2=A0Fix=20login=20command=20avoiding?=
|
||||||
|
=?UTF-8?q?=20reusing=20previous=20config?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
|
||||||
|
---
|
||||||
|
.github/ISSUE_TEMPLATE/bug_report.yml | 2 +-
|
||||||
|
internal/cli/cmd/login/login.go | 29 +++++++++++++++------------
|
||||||
|
internal/cli/config/config.go | 23 +++++++++++++++++++++
|
||||||
|
3 files changed, 40 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
|
||||||
|
index f7fbce82d1..f27470fe29 100644
|
||||||
|
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
|
||||||
|
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
|
||||||
|
@@ -42,7 +42,7 @@ body:
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Perses configuration file
|
||||||
|
- description: Insert relevant configuration here. Don't forget to remove secrets.
|
||||||
|
+ description: Insert relevant configuration here. Don't forget to remove secrets. You can use the CLI to get it (all secret will be hidden). percli config --online
|
||||||
|
render: yaml
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
diff --git a/internal/cli/cmd/login/login.go b/internal/cli/cmd/login/login.go
|
||||||
|
index b09b7a42b6..831daf2c6e 100644
|
||||||
|
--- a/internal/cli/cmd/login/login.go
|
||||||
|
+++ b/internal/cli/cmd/login/login.go
|
||||||
|
@@ -90,20 +90,22 @@ func (o *option) Complete(args []string) error {
|
||||||
|
return fmt.Errorf("no URL has been provided neither found in the previous configuration")
|
||||||
|
}
|
||||||
|
|
||||||
|
- // create a new apiClient
|
||||||
|
- o.restConfig = config.Global.RestClientConfig
|
||||||
|
- o.restConfig.URL = o.url
|
||||||
|
- if o.restConfig.TLSConfig == nil {
|
||||||
|
- o.restConfig.TLSConfig = &secret.TLSConfig{}
|
||||||
|
+ // Create a new apiClient from scratch.
|
||||||
|
+ // We shouldn't use the previous context as for the moment we have a single config.
|
||||||
|
+ // So, switching from a Perses instance to another one without restarting from scratch the context/ the Perses client doesn't make sense.
|
||||||
|
+ o.restConfig = clientConfig.RestConfigClient{
|
||||||
|
+ URL: o.url,
|
||||||
|
+ TLSConfig: &secret.TLSConfig{
|
||||||
|
+ InsecureSkipVerify: o.insecureTLS,
|
||||||
|
+ },
|
||||||
|
}
|
||||||
|
- o.restConfig.TLSConfig.InsecureSkipVerify = o.insecureTLS
|
||||||
|
restClient, err := clientConfig.NewRESTClient(o.restConfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
o.apiClient = api.NewWithClient(restClient)
|
||||||
|
|
||||||
|
- // Finally get the API config, we will need for later
|
||||||
|
+ // Finally, get the API config; we will need it for later
|
||||||
|
cfg, err := o.apiClient.Config()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
@@ -173,9 +175,10 @@ func (o *option) Execute() error {
|
||||||
|
o.accessToken = token.AccessToken
|
||||||
|
o.refreshToken = token.RefreshToken
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- o.restConfig.Authorization = secret.NewBearerToken(o.accessToken)
|
||||||
|
- if writeErr := config.Write(&config.Config{
|
||||||
|
+ if len(o.accessToken) > 0 {
|
||||||
|
+ o.restConfig.Authorization = secret.NewBearerToken(o.accessToken)
|
||||||
|
+ }
|
||||||
|
+ if writeErr := config.WriteFromScratch(&config.Config{
|
||||||
|
RestClientConfig: o.restConfig,
|
||||||
|
RefreshToken: o.refreshToken,
|
||||||
|
}); writeErr != nil {
|
||||||
|
@@ -224,9 +227,9 @@ func (o *option) newLoginOption() (loginOption, error) {
|
||||||
|
|
||||||
|
func (o *option) selectAndSetProvider() error {
|
||||||
|
providers := o.remoteConfig.Security.Authentication.Providers
|
||||||
|
- // The first step is to collect the different providers and store it into items + modifiers.
|
||||||
|
- // items will be the selection items to display to users.
|
||||||
|
- // modifiers will be the action to save the different user input into option struct.
|
||||||
|
+ // The first step is to collect the different providers and store it into options and modifiers.
|
||||||
|
+ // Options will be the selection items to display to users.
|
||||||
|
+ // Modifiers will be the action to save the different user input into option struct.
|
||||||
|
modifiers := map[string]func(){}
|
||||||
|
var options []huh.Option[string]
|
||||||
|
|
||||||
|
diff --git a/internal/cli/config/config.go b/internal/cli/config/config.go
|
||||||
|
index e301642c79..645ce90a20 100644
|
||||||
|
--- a/internal/cli/config/config.go
|
||||||
|
+++ b/internal/cli/config/config.go
|
||||||
|
@@ -220,3 +220,26 @@ func Write(cfg *Config) error {
|
||||||
|
|
||||||
|
return os.WriteFile(filePath, data, 0600)
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+func WriteFromScratch(cfg *Config) error {
|
||||||
|
+ // this value has been set by the root command, and that will be the path where the config must be saved
|
||||||
|
+ filePath := Global.filePath
|
||||||
|
+ directory := filepath.Dir(filePath)
|
||||||
|
+
|
||||||
|
+ if _, err := os.Stat(directory); os.IsNotExist(err) {
|
||||||
|
+ mkdirError := os.Mkdir(directory, 0700)
|
||||||
|
+ if mkdirError != nil {
|
||||||
|
+ return err
|
||||||
|
+ }
|
||||||
|
+ } else if err != nil {
|
||||||
|
+ return err
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ data, err := json.Marshal(cfg)
|
||||||
|
+
|
||||||
|
+ if err != nil {
|
||||||
|
+ return err
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return os.WriteFile(filePath, data, 0600)
|
||||||
|
+}
|
3
perses-cli-0.47.1.obscpio
Normal file
3
perses-cli-0.47.1.obscpio
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e27334cec41c04e791321c636a74667c2fb9de662f8bff841d1f776b490833b8
|
||||||
|
size 10247181
|
3
perses-cli-0.49.0.obscpio
Normal file
3
perses-cli-0.49.0.obscpio
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3eeeaf3e117145da6ee895d71e4adabe94bd988c11b64cd15a2ec452f10c9ac6
|
||||||
|
size 10706445
|
30
perses-cli.changes
Normal file
30
perses-cli.changes
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Dec 17 09:32:55 UTC 2024 - Johannes Kastl <opensuse_buildservice@ojkastl.de>
|
||||||
|
|
||||||
|
- backport patch b04061023c941d879460d81e6e4c6019621dbc16.patch to
|
||||||
|
fix failing logins
|
||||||
|
https://github.com/perses/perses/pull/2416
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Nov 12 06:52:05 UTC 2024 - opensuse_buildservice@ojkastl.de
|
||||||
|
|
||||||
|
- Update to version 0.49.0:
|
||||||
|
CLI-related changes:
|
||||||
|
* [DOC] better wording for `percli dac`'s commands helpers
|
||||||
|
(#2350)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 11 07:27:36 UTC 2024 - opensuse_buildservice@ojkastl.de
|
||||||
|
|
||||||
|
- Update to version 0.48.0:
|
||||||
|
https://github.com/perses/perses/releases/tag/v0.48.0
|
||||||
|
CLI-related changes:
|
||||||
|
* [DOC] Add links in the CLI doc (#2276)
|
||||||
|
* [ENHANCEMENT] Ignore Not Found errors in percli delete command
|
||||||
|
(#2184)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 10 06:52:18 UTC 2024 - Johannes Kastl <opensuse_buildservice@ojkastl.de>
|
||||||
|
|
||||||
|
- new package perses-cli: CLI for the Perses observability
|
||||||
|
visualisation project
|
4
perses-cli.obsinfo
Normal file
4
perses-cli.obsinfo
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name: perses-cli
|
||||||
|
version: 0.49.0
|
||||||
|
mtime: 1730801076
|
||||||
|
commit: 49fb6056c41c2f49a849ebb01d751be0400f1286
|
122
perses-cli.spec
Normal file
122
perses-cli.spec
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
#
|
||||||
|
# spec file for package perses-cli
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define executable_name percli
|
||||||
|
|
||||||
|
Name: perses-cli
|
||||||
|
Version: 0.49.0
|
||||||
|
Release: 0
|
||||||
|
Summary: CLI for the Perses observability visualisation project
|
||||||
|
License: Apache-2.0
|
||||||
|
URL: https://github.com/perses/perses
|
||||||
|
Source: %{name}-%{version}.tar.gz
|
||||||
|
Source1: vendor.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM https://github.com/perses/perses/pull/2416
|
||||||
|
Patch1: https://github.com/perses/perses/commit/b04061023c941d879460d81e6e4c6019621dbc16.patch
|
||||||
|
BuildRequires: bash-completion
|
||||||
|
BuildRequires: fish
|
||||||
|
BuildRequires: go1.22 >= 1.22.5
|
||||||
|
BuildRequires: zsh
|
||||||
|
Provides: percli = %{version}
|
||||||
|
|
||||||
|
%description
|
||||||
|
Perses, a Cloud Native Computing Foundation sandbox project, is a dashboard
|
||||||
|
tool to visualize observability data from Prometheus/Thanos/Jaeger.
|
||||||
|
|
||||||
|
This package contains the CLI.
|
||||||
|
|
||||||
|
%package -n %{name}-bash-completion
|
||||||
|
Summary: Bash Completion for %{name}
|
||||||
|
Group: System/Shells
|
||||||
|
Requires: %{name} = %{version}
|
||||||
|
Requires: bash-completion
|
||||||
|
Supplements: (%{name} and bash-completion)
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description -n %{name}-bash-completion
|
||||||
|
Bash command line completion support for %{name}.
|
||||||
|
|
||||||
|
%package -n %{name}-fish-completion
|
||||||
|
Summary: Fish Completion for %{name}
|
||||||
|
Group: System/Shells
|
||||||
|
Requires: %{name} = %{version}
|
||||||
|
Supplements: (%{name} and fish)
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description -n %{name}-fish-completion
|
||||||
|
Fish command line completion support for %{name}.
|
||||||
|
|
||||||
|
%package -n %{name}-zsh-completion
|
||||||
|
Summary: Zsh Completion for %{name}
|
||||||
|
Group: System/Shells
|
||||||
|
Requires: %{name} = %{version}
|
||||||
|
Supplements: (%{name} and zsh)
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description -n %{name}-zsh-completion
|
||||||
|
zsh command line completion support for %{name}.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p 1 -a 1
|
||||||
|
|
||||||
|
%build
|
||||||
|
COMMIT_HASH="$(sed -n 's/commit: \(.*\)/\1/p' %_sourcedir/%{name}.obsinfo)"
|
||||||
|
|
||||||
|
DATE_FMT="+%%Y-%%m-%%dT%%H:%%M:%%SZ"
|
||||||
|
BUILD_DATE=$(date -u -d "@${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u "${DATE_FMT}")
|
||||||
|
go build \
|
||||||
|
-mod=vendor \
|
||||||
|
-buildmode=pie \
|
||||||
|
-ldflags=" \
|
||||||
|
-X github.com/prometheus/common/version.Version=%{version} \
|
||||||
|
-X github.com/prometheus/common/version.Commit=${COMMIT_HASH} \
|
||||||
|
-X github.com/prometheus/common/version.Branch=main \
|
||||||
|
-X github.com/prometheus/common/version.BuildDate=${BUILD_DATE}" \
|
||||||
|
-o bin/%{executable_name} ./cmd/%{executable_name}
|
||||||
|
|
||||||
|
%install
|
||||||
|
# Install the binary.
|
||||||
|
install -D -m 0755 bin/%{executable_name} %{buildroot}/%{_bindir}/%{executable_name}
|
||||||
|
|
||||||
|
# create the bash completion file
|
||||||
|
mkdir -p %{buildroot}%{_datarootdir}/bash-completion/completions/
|
||||||
|
%{buildroot}/%{_bindir}/%{executable_name} completion bash > %{buildroot}%{_datarootdir}/bash-completion/completions/%{executable_name}
|
||||||
|
|
||||||
|
# create the fish completion file
|
||||||
|
mkdir -p %{buildroot}%{_datarootdir}/fish/vendor_completions.d/
|
||||||
|
%{buildroot}/%{_bindir}/%{executable_name} completion fish > %{buildroot}%{_datarootdir}/fish/vendor_completions.d/%{executable_name}.fish
|
||||||
|
|
||||||
|
# create the zsh completion file
|
||||||
|
mkdir -p %{buildroot}%{_datarootdir}/zsh/site-functions/
|
||||||
|
%{buildroot}/%{_bindir}/%{executable_name} completion zsh > %{buildroot}%{_datarootdir}/zsh/site-functions/_%{executable_name}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc README.md
|
||||||
|
%license LICENSE
|
||||||
|
%{_bindir}/%{executable_name}
|
||||||
|
|
||||||
|
%files -n %{name}-bash-completion
|
||||||
|
%{_datarootdir}/bash-completion/completions/%{executable_name}
|
||||||
|
|
||||||
|
%files -n %{name}-fish-completion
|
||||||
|
%{_datarootdir}/fish/vendor_completions.d/%{executable_name}.fish
|
||||||
|
|
||||||
|
%files -n %{name}-zsh-completion
|
||||||
|
%{_datarootdir}/zsh/site-functions/_%{executable_name}
|
||||||
|
|
||||||
|
%changelog
|
3
vendor.tar.gz
Normal file
3
vendor.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a713a978bddcffa0d5e479eb2f79bcb8a57e7ff3218cc28974979cf333d21996
|
||||||
|
size 11539421
|
Loading…
x
Reference in New Issue
Block a user