From 2470d6c4c6b6a84db516ff2ba0779b330ed1c819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20St=C3=A1rek?= Date: Fri, 10 Jul 2026 14:26:50 +0200 Subject: [PATCH] IA-2848 Fix OTC CCE kubeconfig fetch and release versioning Bump gophertelekomcloud to v0.9.8-0.20260703083050-9dec68a8dcf7, which drops the Status.Conditions field. OTC's CCE API now returns status.conditions as an array, which the old SDK modelled as a single object, breaking cluster list parsing. That failure was printed to stdout and surfaced to kcon as the misleading "externalCluster not found". - services/sfs: adapt to the new shares.List signature ([]Turbo, error). - cmd/cce config: use RunE so failures exit non-zero and go to stderr, keeping stdout reserved for the kubeconfig payload. - .github/workflows: fix the version ldflags package path (otc-cli/cmd.Version -> github.com/ysoftdevs/otc-cli/cmd.Version) so tagged release builds report their real version instead of "dev". Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/main.yml | 4 ++-- cmd/cce_config.go | 5 +++-- go.mod | 2 +- go.sum | 4 ++-- services/sfs/root.go | 7 +------ 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c4ecb3..0125314 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: go-version: ${{ matrix.go-version }} - name: Build - run: go build -v -ldflags "-X otc-cli/cmd.Version=dev" ./... + run: go build -v -ldflags "-X github.com/ysoftdevs/otc-cli/cmd.Version=dev" ./... - name: Test run: go test -v ./... @@ -72,7 +72,7 @@ jobs: OUTPUT_NAME="${OUTPUT_NAME}.exe" fi VERSION="${{ github.event.release.tag_name }}" - go build -v -ldflags "-X otc-cli/cmd.Version=${VERSION}" -o ${OUTPUT_NAME} . + go build -v -ldflags "-X github.com/ysoftdevs/otc-cli/cmd.Version=${VERSION}" -o ${OUTPUT_NAME} . chmod +x ${OUTPUT_NAME} || true - name: Upload Release Asset diff --git a/cmd/cce_config.go b/cmd/cce_config.go index 68b9fc5..22ee46d 100644 --- a/cmd/cce_config.go +++ b/cmd/cce_config.go @@ -13,12 +13,13 @@ var configCmd = &cobra.Command{ Use: "config ", Args: cobra.ExactArgs(1), Short: "Print a kubeconfig for a CCE cluster", - Run: func(cmd *cobra.Command, args []string) { + RunE: func(cmd *cobra.Command, args []string) error { cceConfigArgs.ClusterName = args[0] if err := cce.Config(cceConfigArgs); err != nil { - fmt.Printf("Error printing kubeconfig for CCE cluster '%s': %s\n", args[0], err) + return fmt.Errorf("printing kubeconfig for CCE cluster '%s': %w", args[0], err) } + return nil }, } diff --git a/go.mod b/go.mod index 0402ebf..c939905 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.24.5 require ( github.com/chromedp/chromedp v0.14.2 github.com/jedib0t/go-pretty v4.3.0+incompatible - github.com/opentelekomcloud/gophertelekomcloud v0.9.5 + github.com/opentelekomcloud/gophertelekomcloud v0.9.8-0.20260703083050-9dec68a8dcf7 github.com/spf13/cobra v1.10.2 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 6ae4a05..f591978 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byF github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/opentelekomcloud/gophertelekomcloud v0.9.5 h1:wJMqv0xU6CcTVZAWVw2qig1j/hn7+5eulpF0A7LGWo0= -github.com/opentelekomcloud/gophertelekomcloud v0.9.5/go.mod h1:la8cQVYopRoEbNe2L7HlGTdLxUQOwIqHp1VHtjE/5qA= +github.com/opentelekomcloud/gophertelekomcloud v0.9.8-0.20260703083050-9dec68a8dcf7 h1:cf2lqasnVIqrFz+DW0m4gH79pdkYXlX00Lsuhi7dsek= +github.com/opentelekomcloud/gophertelekomcloud v0.9.8-0.20260703083050-9dec68a8dcf7/go.mod h1:la8cQVYopRoEbNe2L7HlGTdLxUQOwIqHp1VHtjE/5qA= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde h1:x0TT0RDC7UhAVbbWWBzr41ElhJx5tXPWkIHA2HWPRuw= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/services/sfs/root.go b/services/sfs/root.go index 7e0f5eb..fbaf74f 100644 --- a/services/sfs/root.go +++ b/services/sfs/root.go @@ -46,16 +46,11 @@ func List(args ListArgs) ([]ShareInfo, error) { return nil, fmt.Errorf("failed to create SFS Turbo client: %w", err) } - pages, err := shares.List(sfsClient, shares.ListOpts{}).AllPages() + allShares, err := shares.List(sfsClient, shares.ListOpts{}) if err != nil { return nil, fmt.Errorf("failed to list SFS Turbo shares: %w", err) } - allShares, err := shares.ExtractTurbos(pages) - if err != nil { - return nil, fmt.Errorf("failed to extract SFS Turbo shares: %w", err) - } - result := make([]ShareInfo, 0, len(allShares)) for _, s := range allShares { if args.Filter != "" && !strings.Contains(s.Name, args.Filter) {