Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:

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

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: false
Expand All @@ -34,7 +34,7 @@ jobs:
uses: crate-ci/typos@master

- 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 @@ -62,12 +62,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Fetch tags # fetch-tags does not work
run: git fetch --prune --unshallow --tags

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'

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 <info@metal-stack.io>"
COPY bin/metalctl-linux-amd64 /metalctl
ENTRYPOINT ["/metalctl"]
2 changes: 1 addition & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.25
FROM golang:1.26
WORKDIR /work
COPY go.* .
RUN go mod download
Expand Down
21 changes: 10 additions & 11 deletions cmd/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/metal-stack/metal-go/api/client/audit"
"github.com/metal-stack/metal-go/api/models"
"github.com/metal-stack/metal-go/test/client"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/metal-stack/metal-lib/pkg/testcommon"

"github.com/stretchr/testify/mock"
Expand Down Expand Up @@ -79,22 +78,22 @@ func Test_AuditCmd_MultiResult(t *testing.T) {
auditTrace2,
auditTrace1,
},
wantTable: pointer.Pointer(`
wantTable: new(`
TIME REQUEST ID COMPONENT DETAIL PATH CODE USER
2022-05-19 01:03:03 b5817ef7-980a-41ef-9ed3-741a143870b0 test POST /v1/audit 403 b-user
2022-05-19 01:02:03 c40ad996-e1fd-4511-a7bf-418219cb8d91 example GET /v1/audit 200 a-user
`),
wantWideTable: pointer.Pointer(`
wantWideTable: new(`
TIME REQUEST ID COMPONENT DETAIL PATH CODE USER TENANT BODY
2022-05-19 01:03:03 b5817ef7-980a-41ef-9ed3-741a143870b0 test POST /v1/audit 403 b-user b-tenant {"c": "d"}
2022-05-19 01:02:03 c40ad996-e1fd-4511-a7bf-418219cb8d91 example GET /v1/audit 200 a-user a-tenant {"a": "b"}
`),
template: pointer.Pointer(`{{ date "02/01/2006" .timestamp }} {{ .rqid }}`),
wantTemplate: pointer.Pointer(`
template: new(`{{ date "02/01/2006" .timestamp }} {{ .rqid }}`),
wantTemplate: new(`
19/05/2022 b5817ef7-980a-41ef-9ed3-741a143870b0
19/05/2022 c40ad996-e1fd-4511-a7bf-418219cb8d91
`),
wantMarkdown: pointer.Pointer(`
wantMarkdown: new(`
| TIME | REQUEST ID | COMPONENT | DETAIL | PATH | CODE | USER |
|---------------------|--------------------------------------|-----------|--------|-----------|------|--------|
| 2022-05-19 01:03:03 | b5817ef7-980a-41ef-9ed3-741a143870b0 | test | POST | /v1/audit | 403 | b-user |
Expand Down Expand Up @@ -154,19 +153,19 @@ TIME REQUEST ID COMPONENT DETAIL PA
want: []*models.V1AuditResponse{
auditTrace1,
},
wantTable: pointer.Pointer(`
wantTable: new(`
TIME REQUEST ID COMPONENT DETAIL PATH CODE USER
2022-05-19 01:02:03 c40ad996-e1fd-4511-a7bf-418219cb8d91 example GET /v1/audit 200 a-user
`),
wantWideTable: pointer.Pointer(`
wantWideTable: new(`
TIME REQUEST ID COMPONENT DETAIL PATH CODE USER TENANT BODY
2022-05-19 01:02:03 c40ad996-e1fd-4511-a7bf-418219cb8d91 example GET /v1/audit 200 a-user a-tenant {"a": "b"}
`),
template: pointer.Pointer(`{{ date "02/01/2006" .timestamp }} {{ .rqid }}`),
wantTemplate: pointer.Pointer(`
template: new(`{{ date "02/01/2006" .timestamp }} {{ .rqid }}`),
wantTemplate: new(`
19/05/2022 c40ad996-e1fd-4511-a7bf-418219cb8d91
`),
wantMarkdown: pointer.Pointer(`
wantMarkdown: new(`
| TIME | REQUEST ID | COMPONENT | DETAIL | PATH | CODE | USER |
|---------------------|--------------------------------------|-----------|--------|-----------|------|--------|
| 2022-05-19 01:02:03 | c40ad996-e1fd-4511-a7bf-418219cb8d91 | example | GET | /v1/audit | 200 | a-user |`),
Expand Down
5 changes: 2 additions & 3 deletions cmd/filesystemlayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/metal-stack/metal-go/api/models"
"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/metal-stack/metalctl/cmd/sorters"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -175,8 +174,8 @@ func (c *fslCmd) filesystemTry() error {

func (c *fslCmd) filesystemMatch() error {
match := models.V1FilesystemLayoutMatchRequest{
Machine: pointer.Pointer(viper.GetString("machine")),
Filesystemlayout: pointer.Pointer(viper.GetString("filesystemlayout")),
Machine: new(viper.GetString("machine")),
Filesystemlayout: new(viper.GetString("filesystemlayout")),
}

resp, err := c.client.Filesystemlayout().MatchFilesystemLayout(fsmodel.NewMatchFilesystemLayoutParams().WithBody(&match), nil)
Expand Down
77 changes: 38 additions & 39 deletions cmd/filesystemlayout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
fsmodel "github.com/metal-stack/metal-go/api/client/filesystemlayout"
"github.com/metal-stack/metal-go/api/models"
"github.com/metal-stack/metal-go/test/client"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/metal-stack/metal-lib/pkg/testcommon"
"github.com/spf13/afero"

Expand All @@ -25,51 +24,51 @@ var (
Description: "fsl 1",
Disks: []*models.V1Disk{
{
Device: pointer.Pointer("/dev/sda"),
Device: new("/dev/sda"),
Partitions: []*models.V1DiskPartition{
{
Gpttype: pointer.Pointer("ef00"),
Gpttype: new("ef00"),
Label: "efi",
Number: pointer.Pointer(int64(1)),
Size: pointer.Pointer(int64(1000)),
Number: new(int64(1)),
Size: new(int64(1000)),
},
},
Wipeonreinstall: pointer.Pointer(true),
Wipeonreinstall: new(true),
},
},
Filesystems: []*models.V1Filesystem{
{
Createoptions: []string{"-F 32"},
Device: pointer.Pointer("/dev/sda1"),
Format: pointer.Pointer("vfat"),
Device: new("/dev/sda1"),
Format: new("vfat"),
Label: "efi",
Mountoptions: []string{"noexec"},
Path: "/boot/efi",
},
{
Createoptions: []string{},
Device: pointer.Pointer("tmpfs"),
Format: pointer.Pointer("tmpfs"),
Device: new("tmpfs"),
Format: new("tmpfs"),
Label: "",
Mountoptions: []string{"noexec"},
Path: "/tmp",
},
},
ID: pointer.Pointer("1"),
ID: new("1"),
Logicalvolumes: []*models.V1LogicalVolume{
{
Lvmtype: pointer.Pointer("linear"),
Name: pointer.Pointer("varlib"),
Size: pointer.Pointer(int64(5000)),
Volumegroup: pointer.Pointer("lvm"),
Lvmtype: new("linear"),
Name: new("varlib"),
Size: new(int64(5000)),
Volumegroup: new("lvm"),
},
},
Name: "fsl1",
Raid: []*models.V1Raid{},
Volumegroups: []*models.V1VolumeGroup{
{
Devices: []string{"/dev/nvme0n1"},
Name: pointer.Pointer("lvm"),
Name: new("lvm"),
Tags: []string{},
},
},
Expand All @@ -84,43 +83,43 @@ var (
Description: "fsl 2",
Disks: []*models.V1Disk{
{
Device: pointer.Pointer("/dev/sda"),
Device: new("/dev/sda"),
Partitions: []*models.V1DiskPartition{
{
Gpttype: pointer.Pointer("ef00"),
Gpttype: new("ef00"),
Label: "efi",
Number: pointer.Pointer(int64(1)),
Size: pointer.Pointer(int64(1000)),
Number: new(int64(1)),
Size: new(int64(1000)),
},
},
Wipeonreinstall: pointer.Pointer(true),
Wipeonreinstall: new(true),
},
},
Filesystems: []*models.V1Filesystem{
{
Createoptions: []string{},
Device: pointer.Pointer("tmpfs"),
Format: pointer.Pointer("tmpfs"),
Device: new("tmpfs"),
Format: new("tmpfs"),
Label: "",
Mountoptions: []string{"noexec"},
Path: "/tmp",
},
},
ID: pointer.Pointer("2"),
ID: new("2"),
Logicalvolumes: []*models.V1LogicalVolume{
{
Lvmtype: pointer.Pointer("linear"),
Name: pointer.Pointer("varlib"),
Size: pointer.Pointer(int64(5000)),
Volumegroup: pointer.Pointer("lvm"),
Lvmtype: new("linear"),
Name: new("varlib"),
Size: new(int64(5000)),
Volumegroup: new("lvm"),
},
},
Name: "fsl2",
Raid: []*models.V1Raid{},
Volumegroups: []*models.V1VolumeGroup{
{
Devices: []string{"/dev/nvme0n1"},
Name: pointer.Pointer("lvm"),
Name: new("lvm"),
Tags: []string{},
},
},
Expand Down Expand Up @@ -148,24 +147,24 @@ func Test_FilesystemLayoutCmd_MultiResult(t *testing.T) {
fsl1,
fsl2,
},
wantTable: pointer.Pointer(`
wantTable: new(`
ID DESCRIPTION FILESYSTEMS SIZES IMAGES
1 fsl 1 /tmp tmpfs size1 os-image *
/boot/efi /dev/sda1
2 fsl 2 /tmp tmpfs size1 os-image *
`),
wantWideTable: pointer.Pointer(`
wantWideTable: new(`
ID DESCRIPTION FILESYSTEMS SIZES IMAGES
1 fsl 1 /tmp tmpfs size1 os-image *
/boot/efi /dev/sda1
2 fsl 2 /tmp tmpfs size1 os-image *
`),
template: pointer.Pointer("{{ .id }} {{ .name }}"),
wantTemplate: pointer.Pointer(`
template: new("{{ .id }} {{ .name }}"),
wantTemplate: new(`
1 fsl1
2 fsl2
`),
wantMarkdown: pointer.Pointer(`
wantMarkdown: new(`
| ID | DESCRIPTION | FILESYSTEMS | SIZES | IMAGES |
|----|-------------|----------------------|-------|------------|
| 1 | fsl 1 | /tmp tmpfs | size1 | os-image * |
Expand Down Expand Up @@ -275,21 +274,21 @@ func Test_FilesystemLayoutCmd_SingleResult(t *testing.T) {
},
},
want: fsl1,
wantTable: pointer.Pointer(`
wantTable: new(`
ID DESCRIPTION FILESYSTEMS SIZES IMAGES
1 fsl 1 /tmp tmpfs size1 os-image *
/boot/efi /dev/sda1
`),
wantWideTable: pointer.Pointer(`
wantWideTable: new(`
ID DESCRIPTION FILESYSTEMS SIZES IMAGES
1 fsl 1 /tmp tmpfs size1 os-image *
/boot/efi /dev/sda1
`),
template: pointer.Pointer("{{ .id }} {{ .name }}"),
wantTemplate: pointer.Pointer(`
template: new("{{ .id }} {{ .name }}"),
wantTemplate: new(`
1 fsl1
`),
wantMarkdown: pointer.Pointer(`
wantMarkdown: new(`
| ID | DESCRIPTION | FILESYSTEMS | SIZES | IMAGES |
|----|-------------|----------------------|-------|------------|
| 1 | fsl 1 | /tmp tmpfs | size1 | os-image * |
Expand Down
2 changes: 1 addition & 1 deletion cmd/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func firewallResponseToCreate(r *models.V1FirewallResponse) *models.V1FirewallCr
for _, s := range allocation.Networks {
ips = append(ips, s.Ips...)
networks = append(networks, &models.V1MachineAllocationNetwork{
Autoacquire: pointer.Pointer(len(s.Ips) == 0),
Autoacquire: new(len(s.Ips) == 0),
Networkid: s.Networkid,
})
}
Expand Down
Loading