Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v6
Expand All @@ -30,7 +30,7 @@ jobs:
cache: false

- name: Lint
uses: golangci/golangci-lint-action@v8
uses: golangci/golangci-lint-action@v9
with:
args: --build-tags integration --timeout=5m

Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v6
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.22
FROM alpine:3.23
LABEL maintainer="metal-stack authors <[email protected]>"
COPY bin/metalctlv2-linux-amd64 /metalctl
ENTRYPOINT ["/metalctl"]
2 changes: 1 addition & 1 deletion cmd/admin/v2/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c *image) Update(rq *adminv2.ImageServiceUpdateRequest) (*apiv2.Image, err

req := &adminv2.ImageServiceUpdateRequest{
Id: viper.GetString("id"),
Url: pointer.Pointer(viper.GetString("url")),
Url: new(viper.GetString("url")),
Description: pointer.PointerOrNil(viper.GetString("description")),
ExpiresAt: expiresAt,
Features: imageFeaturesFromString(viper.GetStringSlice("features")),
Expand Down
1 change: 0 additions & 1 deletion cmd/admin/v2/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func (c *tenant) List() ([]*apiv2.Tenant, error) {
req := &adminv2.TenantServiceListRequest{
Name: pointer.PointerOrNil(viper.GetString("name")),
Login: pointer.PointerOrNil(viper.GetString("id")),
Email: pointer.PointerOrNil(viper.GetString("email")),
}

resp, err := c.c.Client.Adminv2().Tenant().List(ctx, req)
Expand Down
3 changes: 1 addition & 2 deletions cmd/admin/v2/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/metal-stack/cli/cmd/sorters"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -57,7 +56,7 @@ func (c *token) List() ([]*apiv2.Token, error) {
req := &adminv2.TokenServiceListRequest{}

if viper.IsSet("user") {
req.User = pointer.Pointer(viper.GetString("user"))
req.User = new(viper.GetString("user"))
}

resp, err := c.c.Client.Adminv2().Token().List(ctx, req)
Expand Down
7 changes: 3 additions & 4 deletions cmd/api/v2/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/metal-stack/cli/pkg/helpers"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -70,11 +69,11 @@ func newIPCmd(c *config.Config) *cobra.Command {
CreateRequestFromCLI: func() (*apiv2.IPServiceCreateRequest, error) {
return &apiv2.IPServiceCreateRequest{
Project: c.GetProject(),
Name: pointer.Pointer(viper.GetString("name")),
Description: pointer.Pointer(viper.GetString("description")),
Name: new(viper.GetString("name")),
Description: new(viper.GetString("description")),
Network: viper.GetString("network"),
// Labels: viper.GetStringSlice("tags"), // FIXME implement
Type: pointer.Pointer(ipStaticToType(viper.GetBool("static"))),
Type: new(ipStaticToType(viper.GetBool("static"))),
AddressFamily: addressFamilyToType(viper.GetString("addressfamily")),
}, nil
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/api/v2/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ func (c *project) Convert(r *apiv2.Project) (string, *apiv2.ProjectServiceCreate
Description: r.Description,
}, &apiv2.ProjectServiceUpdateRequest{
Project: r.Uuid,
Name: pointer.Pointer(r.Name),
Description: pointer.Pointer(r.Description),
Name: new(r.Name),
Description: new(r.Description),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/api/v2/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func newTokenCmd(c *config.Config) *cobra.Command {
return nil, fmt.Errorf("unknown role: %s", roleString)
}

adminRole = pointer.Pointer(apiv2.AdminRole(role))
adminRole = new(apiv2.AdminRole(role))
}

return &apiv2.TokenServiceCreateRequest{
Expand Down
1 change: 0 additions & 1 deletion cmd/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (c *Test[R]) TestCmd(t *testing.T) {
}

for _, format := range outputFormats(c) {
format := format
t.Run(fmt.Sprintf("%v", format.Args()), func(t *testing.T) {
_, out, conf := c.newMockConfig(t)

Expand Down
2 changes: 1 addition & 1 deletion cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (c *Config) NewRequestContext() (context.Context, context.CancelFunc) {
timeout = pointer.Pointer(30 * time.Second)
}
if viper.IsSet("timeout") {
timeout = pointer.Pointer(viper.GetDuration("timeout"))
timeout = new(viper.GetDuration("timeout"))
}

return context.WithTimeout(context.Background(), *timeout)
Expand Down
5 changes: 2 additions & 3 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/cli/cmd/config"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"google.golang.org/protobuf/types/known/durationpb"
Expand Down Expand Up @@ -69,7 +68,7 @@ func (l *login) login() error {
if viper.IsSet("context") {
newCtx.Name = viper.GetString("context")
}
newCtx.ApiURL = pointer.Pointer(l.c.GetApiURL())
newCtx.ApiURL = new(l.c.GetApiURL())
ctxs.Contexts = append(ctxs.Contexts, &newCtx)
ctx = &newCtx
}
Expand Down Expand Up @@ -131,7 +130,7 @@ func (l *login) login() error {
tokenResp, err := mc.Apiv2().Token().Create(context.Background(), &apiv2.TokenServiceCreateRequest{
Description: "admin access issues by metal cli",
Expires: durationpb.New(3 * time.Hour),
AdminRole: pointer.Pointer(apiv2.AdminRole((apiv2.AdminRole_value[viper.GetString("admin-role")]))),
AdminRole: new(apiv2.AdminRole((apiv2.AdminRole_value[viper.GetString("admin-role")]))),
})
if err != nil {
return fmt.Errorf("unable to issue admin token: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"log/slog"
"os"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"github.com/spf13/viper"
"golang.org/x/net/context"
)

func Execute() {
Expand Down
7 changes: 1 addition & 6 deletions cmd/tableprinters/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/fatih/color"
"github.com/metal-stack/api/go/enum"
apiv2 "github.com/metal-stack/api/go/metalstack/api/v2"
"github.com/metal-stack/metal-lib/pkg/pointer"
)

func (t *TablePrinter) HealthTable(data []*apiv2.Health, wide bool) ([]string, [][]string, error) {
Expand All @@ -31,13 +30,11 @@ func (t *TablePrinter) HealthTable(data []*apiv2.Health, wide bool) ([]string, [
)

for _, h := range data {
h := h
for _, s := range h.Services {
s := s

name, err := enum.GetStringValue(s.Name)
if err != nil {
name = pointer.Pointer("service status unknown")
name = new("service status unknown")
}
message := "All systems operational"
if s.Message != "" {
Expand All @@ -53,7 +50,6 @@ func (t *TablePrinter) HealthTable(data []*apiv2.Health, wide bool) ([]string, [

var partitions []partitionStatus
for id, p := range s.Partitions {
p := p

partitions = append(partitions, partitionStatus{
ID: id,
Expand All @@ -66,7 +62,6 @@ func (t *TablePrinter) HealthTable(data []*apiv2.Health, wide bool) ([]string, [
})

for i, status := range partitions {
status := status

prefix := "├"
if i == len(partitions)-1 {
Expand Down
1 change: 0 additions & 1 deletion cmd/tableprinters/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func (t *TablePrinter) IPTable(data []*apiv2.IP, wide bool) ([]string, [][]strin
}

for _, ip := range data {
ip := ip

var t string

Expand Down
49 changes: 25 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,66 +1,67 @@
module github.com/metal-stack/cli

go 1.25
go 1.26

require (
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.18.0
github.com/google/go-cmp v0.7.0
github.com/metal-stack/api v0.0.35
github.com/metal-stack/api v0.0.51
github.com/metal-stack/metal-lib v0.23.5
github.com/metal-stack/v v1.0.3
github.com/spf13/afero v1.15.0
github.com/spf13/cobra v1.10.1
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
golang.org/x/net v0.46.0
google.golang.org/protobuf v1.36.10
golang.org/x/net v0.50.0
google.golang.org/protobuf v1.36.11
sigs.k8s.io/yaml v1.6.0
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 // indirect
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1 // indirect
connectrpc.com/connect v1.19.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/clipperhouse/displaywidth v0.6.2 // indirect
github.com/clipperhouse/stringish v0.1.1 // indirect
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-openapi/errors v0.22.3 // indirect
github.com/go-openapi/strfmt v0.24.0 // indirect
github.com/go-openapi/errors v0.22.6 // indirect
github.com/go-openapi/strfmt v0.25.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/goccy/go-yaml v1.18.0 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.18.1 // indirect
github.com/klauspost/connect-compress/v2 v2.1.0 // indirect
github.com/klauspost/compress v1.18.4 // indirect
github.com/klauspost/connect-compress/v2 v2.1.1 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.20 // indirect
github.com/minio/minlz v1.0.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
github.com/olekukonko/errors v1.1.0 // indirect
github.com/olekukonko/ll v0.1.2 // indirect
github.com/olekukonko/tablewriter v1.1.0 // indirect
github.com/olekukonko/errors v1.2.0 // indirect
github.com/olekukonko/ll v0.1.6 // indirect
github.com/olekukonko/tablewriter v1.1.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.mongodb.org/mongo-driver v1.17.4 // indirect
go.mongodb.org/mongo-driver v1.17.9 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.34.1 // indirect
k8s.io/apimachinery v0.35.1 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
)
Loading