Skip to content

Commit

Permalink
fix(deps): update module github.com/hetznercloud/hcloud-go/v2 to v2.1…
Browse files Browse the repository at this point in the history
…1.0 (hetznercloud/fleeting-plugin-hetzner!98)

This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/hetznercloud/hcloud-go/v2](https://github.com/hetznercloud/hcloud-go) | require | minor | `v2.10.2` -> `v2.11.0` |

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-go (github.com/hetznercloud/hcloud-go/v2)</summary>

### [`v2.11.0`](https://github.com/hetznercloud/hcloud-go/releases/tag/v2.11.0)

[Compare Source](hetznercloud/hcloud-go@v2.10.2...v2.11.0)

##### Features

-   add truncated exponential backoff with full jitter ([#&#8203;459](hetznercloud/hcloud-go#459)) ([fd1f46c](hetznercloud/hcloud-go@fd1f46c))
-   allow configuring retry options ([#&#8203;488](hetznercloud/hcloud-go#488)) ([2db9575](hetznercloud/hcloud-go@2db9575))
-   **exp:** add sliceutil package ([#&#8203;489](hetznercloud/hcloud-go#489)) ([f4ad6bc](hetznercloud/hcloud-go@f4ad6bc))
-   **exp:** rename `*utils` package to `*util` ([#&#8203;487](hetznercloud/hcloud-go#487)) ([19da475](hetznercloud/hcloud-go@19da475))
-   respect cancelled contexts during retry sleep ([#&#8203;470](hetznercloud/hcloud-go#470)) ([756f605](hetznercloud/hcloud-go@756f605))
-   retry requests when the api gateway errors ([#&#8203;470](hetznercloud/hcloud-go#470)) ([756f605](hetznercloud/hcloud-go@756f605))
-   retry requests when the network timed out ([#&#8203;470](hetznercloud/hcloud-go#470)) ([756f605](hetznercloud/hcloud-go@756f605))
-   retry requests when the rate limit was reached ([#&#8203;470](hetznercloud/hcloud-go#470)) ([756f605](hetznercloud/hcloud-go@756f605))

##### Bug Fixes

-   **exp:** set capacity for each batch ([#&#8203;490](hetznercloud/hcloud-go#490)) ([57f53c1](hetznercloud/hcloud-go@57f53c1))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
  • Loading branch information
Hetzner Cloud Bot authored and jooola committed Jul 23, 2024
1 parent 37717f0 commit 77dceef
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 118 deletions.
4 changes: 2 additions & 2 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sshutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sshutil"
)

func (g *InstanceGroup) UploadSSHPublicKey(ctx context.Context, pub []byte) (sshKey *hcloud.SSHKey, err error) {
fingerprint, err := sshutils.GetPublicKeyFingerprint(pub)
fingerprint, err := sshutil.GetPublicKeyFingerprint(pub)
if err != nil {
return nil, fmt.Errorf("could not get ssh key fingerprint: %w", err)
}
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
require (
github.com/boumenot/gocover-cobertura v1.2.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hetznercloud/hcloud-go/v2 v2.10.2
github.com/hetznercloud/hcloud-go/v2 v2.11.0
github.com/stretchr/testify v1.9.0
gitlab.com/gitlab-org/fleeting/fleeting v0.0.0-20240723062336-da5f142b3c7d
go.uber.org/mock v0.4.0
Expand Down Expand Up @@ -46,11 +46,11 @@ require (
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/tidwall/transform v0.0.0-20201103190739-32f242e2dbde // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ github.com/hetznercloud/hcloud-go/v2 v2.9.0 h1:s0N6R7Zoi2DPfMtUF5o9VeUBzTtHVY6MI
github.com/hetznercloud/hcloud-go/v2 v2.9.0/go.mod h1:qtW/TuU7Bs16ibXl/ktJarWqU2LwHr7eGlwoilHxtgg=
github.com/hetznercloud/hcloud-go/v2 v2.10.2 h1:9gyTUPhfNbfbS40Spgij5mV5k37bOZgt8iHKCbfGs5I=
github.com/hetznercloud/hcloud-go/v2 v2.10.2/go.mod h1:xQ+8KhIS62W0D78Dpi57jsufWh844gUw1az5OUvaeq8=
github.com/hetznercloud/hcloud-go/v2 v2.11.0 h1:U1wD58/trMnKO6aHy2i2aguT5USwWbzC2hWj3r2sidE=
github.com/hetznercloud/hcloud-go/v2 v2.11.0/go.mod h1:dhix40Br3fDiBhwaSG/zgaYOFFddpfBm/6R1Zz0IiF0=
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
Expand Down Expand Up @@ -150,6 +152,8 @@ golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
Expand All @@ -174,6 +178,8 @@ golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -203,6 +209,8 @@ golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
4 changes: 2 additions & 2 deletions internal/instancegroup/instancegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"maps"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/actionutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/actionutil"

"gitlab.com/hetznercloud/fleeting-plugin-hetzner/internal/ippool"
"gitlab.com/hetznercloud/fleeting-plugin-hetzner/internal/utils"
Expand Down Expand Up @@ -170,7 +170,7 @@ func (g *instanceGroup) Increase(ctx context.Context, delta int) ([]int64, error
continue
}

results = append(results, newResourceActions(result.Server.ID, actionutils.AppendNext(result.Action, result.NextActions)...))
results = append(results, newResourceActions(result.Server.ID, actionutil.AppendNext(result.Action, result.NextActions)...))
}

for _, result := range results {
Expand Down
41 changes: 19 additions & 22 deletions internal/instancegroup/instancegroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutil"

"gitlab.com/hetznercloud/fleeting-plugin-hetzner/internal/testutils"
)
Expand All @@ -23,29 +23,34 @@ var (
}
)

func makeTestClient(endpoint string) *hcloud.Client {
return hcloud.NewClient(
hcloud.WithEndpoint(endpoint),
hcloud.WithRetryOpts(hcloud.RetryOpts{BackoffFunc: func(_ int) time.Duration { return 0 }, MaxRetries: 3}),
hcloud.WithPollBackoffFunc(func(_ int) time.Duration { return 0 }),
)
}

func TestInit(t *testing.T) {
server := httptest.NewServer(mockutils.Handler(t,
[]mockutils.Request{
server := httptest.NewServer(mockutil.Handler(t,
[]mockutil.Request{
testutils.GetLocationHel1Request,
testutils.GetServerTypeCPX11Request,
testutils.GetImageDebian12Request,
},
))

client := hcloud.NewClient(
hcloud.WithEndpoint(server.URL),
hcloud.WithBackoffFunc(func(_ int) time.Duration { return 0 }),
hcloud.WithPollBackoffFunc(func(_ int) time.Duration { return 0 }),
)
client := makeTestClient(server.URL)

group := New(client, "dummy", DefaultTestConfig)

err := group.Init(context.Background())
require.NoError(t, err)
}

func TestIncrease(t *testing.T) {
server := httptest.NewServer(mockutils.Handler(t,
[]mockutils.Request{
server := httptest.NewServer(mockutil.Handler(t,
[]mockutil.Request{
testutils.GetLocationHel1Request,
testutils.GetServerTypeCPX11Request,
testutils.GetImageDebian12Request,
Expand Down Expand Up @@ -94,11 +99,7 @@ func TestIncrease(t *testing.T) {
},
))

client := hcloud.NewClient(
hcloud.WithEndpoint(server.URL),
hcloud.WithBackoffFunc(func(_ int) time.Duration { return 0 }),
hcloud.WithPollBackoffFunc(func(_ int) time.Duration { return 0 }),
)
client := makeTestClient(server.URL)

group := New(client, "dummy", DefaultTestConfig)
err := group.Init(context.Background())
Expand All @@ -110,8 +111,8 @@ func TestIncrease(t *testing.T) {
}

func TestDecrease(t *testing.T) {
server := httptest.NewServer(mockutils.Handler(t,
[]mockutils.Request{
server := httptest.NewServer(mockutil.Handler(t,
[]mockutil.Request{
testutils.GetLocationHel1Request,
testutils.GetServerTypeCPX11Request,
testutils.GetImageDebian12Request,
Expand Down Expand Up @@ -150,11 +151,7 @@ func TestDecrease(t *testing.T) {
},
))

client := hcloud.NewClient(
hcloud.WithEndpoint(server.URL),
hcloud.WithBackoffFunc(func(_ int) time.Duration { return 0 }),
hcloud.WithPollBackoffFunc(func(_ int) time.Duration { return 0 }),
)
client := makeTestClient(server.URL)

group := New(client, "dummy", DefaultTestConfig)
err := group.Init(context.Background())
Expand Down
6 changes: 3 additions & 3 deletions internal/ippool/ippool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutil"
"github.com/hetznercloud/hcloud-go/v2/hcloud/schema"
)

Expand All @@ -27,7 +27,7 @@ func TestNextIP(t *testing.T) {
t.Run("empty", func(t *testing.T) {
ipPool := New("hel1", "instance-group=fleeting")

testServer := httptest.NewServer(mockutils.Handler(t, []mockutils.Request{
testServer := httptest.NewServer(mockutil.Handler(t, []mockutil.Request{
{
Method: "GET", Path: "/primary_ips?label_selector=instance-group%3Dfleeting&page=1",
Status: 200,
Expand All @@ -53,7 +53,7 @@ func TestNextIP(t *testing.T) {
datacenterHel1 := schema.Datacenter{Location: schema.Location{Name: "hel1"}}
datacenterFsn1 := schema.Datacenter{Location: schema.Location{Name: "fsn1"}}

testServer := httptest.NewServer(mockutils.Handler(t, []mockutils.Request{
testServer := httptest.NewServer(mockutil.Handler(t, []mockutil.Request{
{
Method: "GET", Path: "/primary_ips?label_selector=instance-group%3Dfleeting&page=1",
Status: 200,
Expand Down
10 changes: 5 additions & 5 deletions internal/testutils/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package testutils

import (
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutil"
"github.com/hetznercloud/hcloud-go/v2/hcloud/schema"
)

var (
GetLocationHel1Request = mockutils.Request{
GetLocationHel1Request = mockutil.Request{
Method: "GET", Path: "/locations?name=hel1",
Status: 200,
JSON: schema.LocationListResponse{
Expand All @@ -16,7 +16,7 @@ var (
},
},
}
GetServerTypeCPX11Request = mockutils.Request{
GetServerTypeCPX11Request = mockutil.Request{
Method: "GET", Path: "/server_types?name=cpx11",
Status: 200,
JSON: schema.ServerTypeListResponse{
Expand All @@ -25,7 +25,7 @@ var (
},
},
}
GetImageDebian12Request = mockutils.Request{
GetImageDebian12Request = mockutil.Request{
Method: "GET", Path: "/images?architecture=x86&include_deprecated=true&name=debian-12",
Status: 200,
JSON: schema.ImageListResponse{
Expand All @@ -34,7 +34,7 @@ var (
},
},
}
ListServerEmptyRequest = mockutils.Request{
ListServerEmptyRequest = mockutil.Request{
Method: "GET", Path: "/servers?label_selector=instance-group%3Dfleeting&page=1",
Status: 200,
JSON: schema.ServerListResponse{},
Expand Down
35 changes: 0 additions & 35 deletions internal/utils/actions.go

This file was deleted.

29 changes: 0 additions & 29 deletions internal/utils/actions_test.go

This file was deleted.

8 changes: 4 additions & 4 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"gitlab.com/gitlab-org/fleeting/fleeting/provider"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sshutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sshutil"

"gitlab.com/hetznercloud/fleeting-plugin-hetzner/internal/instancegroup"
"gitlab.com/hetznercloud/fleeting-plugin-hetzner/internal/utils"
Expand Down Expand Up @@ -71,7 +71,7 @@ func (g *InstanceGroup) Init(ctx context.Context, log hclog.Logger, settings pro
hcloud.WithHTTPClient(&http.Client{
Timeout: 15 * time.Second,
}),
hcloud.WithPollBackoffFunc(utils.ExponentialBackoffWithOpts(utils.ExponentialBackoffOpts{
hcloud.WithPollBackoffFunc(hcloud.ExponentialBackoffWithOpts(hcloud.ExponentialBackoffOpts{
Base: time.Second,
Multiplier: 2.0,
Cap: 5 * time.Second,
Expand All @@ -85,7 +85,7 @@ func (g *InstanceGroup) Init(ctx context.Context, log hclog.Logger, settings pro
// Prepare credentials
if !g.settings.UseStaticCredentials {
g.log.Info("generating ssh key")
sshPrivateKey, sshPublicKey, err := sshutils.GenerateKeyPair()
sshPrivateKey, sshPublicKey, err := sshutil.GenerateKeyPair()
if err != nil {
return info, err
}
Expand All @@ -98,7 +98,7 @@ func (g *InstanceGroup) Init(ctx context.Context, log hclog.Logger, settings pro
}
} else if len(g.settings.Key) > 0 {
g.log.Info("using static ssh key")
sshPublicKey, err := sshutils.GeneratePublicKey(g.settings.Key)
sshPublicKey, err := sshutil.GeneratePublicKey(g.settings.Key)
if err != nil {
return info, err
}
Expand Down
6 changes: 3 additions & 3 deletions provider_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"gitlab.com/gitlab-org/fleeting/fleeting/provider"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sshutils"
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/kit/sshutil"

"gitlab.com/hetznercloud/fleeting-plugin-hetzner/internal/utils"
)
Expand Down Expand Up @@ -51,7 +51,7 @@ func TestProvisioning(t *testing.T) {
t.Run("static credentials", func(t *testing.T) {
t.Parallel()

sshPrivateKey, _, err := sshutils.GenerateKeyPair()
sshPrivateKey, _, err := sshutil.GenerateKeyPair()
require.NoError(t, err)

integration.TestProvisioning(t,
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestProvisioning(t *testing.T) {
ctx := context.Background()
name := "fleeting-" + utils.GenerateRandomID()

sshPrivateKey, _, err := sshutils.GenerateKeyPair()
sshPrivateKey, _, err := sshutil.GenerateKeyPair()
require.NoError(t, err)

client := hcloud.NewClient(
Expand Down
Loading

0 comments on commit 77dceef

Please sign in to comment.