Skip to content

Commit

Permalink
deps: update module github.com/hetznercloud/hcloud-go/v2 to v2.8.0 (#176
Browse files Browse the repository at this point in the history
)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/hetznercloud/hcloud-go/v2](https://togithub.com/hetznercloud/hcloud-go)
| `v2.7.2` -> `v2.8.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.7.2/v2.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.7.2/v2.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

[Compare
Source](https://togithub.com/hetznercloud/hcloud-go/compare/v2.7.2...v2.8.0)

##### Features

- **error:** show internal correlation id in error messages
([#&#8203;411](https://togithub.com/hetznercloud/hcloud-go/issues/411))
([6c96d19](https://togithub.com/hetznercloud/hcloud-go/commit/6c96d19dacde736b52abd7b8fc8879c8f721f23b))
- implement actions waiter
([#&#8203;407](https://togithub.com/hetznercloud/hcloud-go/issues/407))
([1e3fa70](https://togithub.com/hetznercloud/hcloud-go/commit/1e3fa7033d8a1cea1c0a9007a6255798979f0771))
- require Go >= 1.21
([#&#8203;424](https://togithub.com/hetznercloud/hcloud-go/issues/424))
([d4f4000](https://togithub.com/hetznercloud/hcloud-go/commit/d4f40009016c3ed5bb14ef9ae16bcf6aefa90fee))

##### Bug Fixes

- improve error message format with correlation id
([#&#8203;430](https://togithub.com/hetznercloud/hcloud-go/issues/430))
([013477f](https://togithub.com/hetznercloud/hcloud-go/commit/013477f4227bdc69f376d8f13a875b09c32171f6))

</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 PR becomes conflicted, or you tick the
rebase/retry checkbox.

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

---

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

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/hetznercloud/packer-plugin-hcloud).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNDAuMTAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4zNDAuMTAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

---------

Co-authored-by: jo <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
renovate[bot] and jooola authored May 6, 2024
1 parent fda2f38 commit d22eb5c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 57 deletions.
28 changes: 9 additions & 19 deletions builder/hcloud/step_create_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,11 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
// instance id inside of the provisioners, used in step_provision.
state.Put(StateInstanceID, serverCreateResult.Server.ID)

if err := waitForAction(ctx, client, serverCreateResult.Action); err != nil {
if err := client.Action.WaitFor(ctx, serverCreateResult.Action); err != nil {
return errorHandler(state, ui, "Could not create server", err)
}
for _, nextAction := range serverCreateResult.NextActions {
if err := waitForAction(ctx, client, nextAction); err != nil {
return errorHandler(state, ui, "Could not create server", err)
}
if err := client.Action.WaitFor(ctx, serverCreateResult.NextActions...); err != nil {
return errorHandler(state, ui, "Could not create server", err)
}

if c.UpgradeServerType != "" {
Expand All @@ -143,7 +141,7 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
return errorHandler(state, ui, "Could not upgrade server type", err)
}

if err := waitForAction(ctx, client, serverChangeTypeAction); err != nil {
if err := client.Action.WaitFor(ctx, serverChangeTypeAction); err != nil {
return errorHandler(state, ui, "Could not upgrade server type", err)
}

Expand All @@ -153,7 +151,7 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
return errorHandler(state, ui, "Could not start server", err)
}

if err := waitForAction(ctx, client, serverPoweronAction); err != nil {
if err := client.Action.WaitFor(ctx, serverPoweronAction); err != nil {
return errorHandler(state, ui, "Could not start server", err)
}
}
Expand All @@ -169,7 +167,7 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
if err != nil {
return errorHandler(state, ui, "Could not reboot server", err)
}
if err := waitForAction(ctx, client, action); err != nil {
if err := client.Action.WaitFor(ctx, action); err != nil {
return errorHandler(state, ui, "Could not reboot server", err)
}
}
Expand Down Expand Up @@ -201,7 +199,7 @@ func setRescue(ctx context.Context, client *hcloud.Client, server *hcloud.Server
if err != nil {
return "", err
}
if err := waitForAction(ctx, client, action); err != nil {
if err := client.Action.WaitFor(ctx, action); err != nil {
return "", err
}
}
Expand All @@ -214,7 +212,7 @@ func setRescue(ctx context.Context, client *hcloud.Client, server *hcloud.Server
if err != nil {
return "", err
}
if err := waitForAction(ctx, client, res.Action); err != nil {
if err := client.Action.WaitFor(ctx, res.Action); err != nil {
return "", err
}
return res.RootPassword, nil
Expand All @@ -225,21 +223,13 @@ func setRescue(ctx context.Context, client *hcloud.Client, server *hcloud.Server
if err != nil {
return "", err
}
if err := waitForAction(ctx, client, action); err != nil {
if err := client.Action.WaitFor(ctx, action); err != nil {
return "", err
}
}
return "", nil
}

func waitForAction(ctx context.Context, client *hcloud.Client, action *hcloud.Action) error {
_, errCh := client.Action.WatchProgress(ctx, action)
if err := <-errCh; err != nil {
return err
}
return nil
}

func getImageWithSelectors(ctx context.Context, client *hcloud.Client, c *Config, serverType *hcloud.ServerType) (*hcloud.Image, error) {
var allImages []*hcloud.Image

Expand Down
28 changes: 20 additions & 8 deletions builder/hcloud/step_create_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ func TestStepCreateServer(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
},
Expand Down Expand Up @@ -95,9 +98,12 @@ func TestStepCreateServer(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
},
Expand Down Expand Up @@ -175,9 +181,12 @@ func TestStepCreateServer(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
},
Expand Down Expand Up @@ -258,9 +267,12 @@ func TestStepCreateServer(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
},
Expand Down
5 changes: 2 additions & 3 deletions builder/hcloud/step_create_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ func (s *stepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag)
state.Put(StateSnapshotID, result.Image.ID)
state.Put(StateSnapshotName, c.SnapshotName)

_, errCh := client.Action.WatchProgress(ctx, result.Action)
if err1 := <-errCh; err1 != nil {
return errorHandler(state, ui, "Could not create snapshot", err1)
if err := client.Action.WaitFor(ctx, result.Action); err != nil {
return errorHandler(state, ui, "Could not create snapshot", err)
}

oldSnap, found := state.GetOk(StateSnapshotIDOld)
Expand Down
40 changes: 26 additions & 14 deletions builder/hcloud/step_create_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ func TestStepCreateSnapshot(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
},
Expand Down Expand Up @@ -96,16 +99,19 @@ func TestStepCreateSnapshot(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": {
"id": 3,
"status": "error",
"error": {
"code": "action_failed",
"message": "Action failed"
"actions": [
{
"id": 3,
"status": "error",
"error": {
"code": "action_failed",
"message": "Action failed"
}
}
}
],
"meta": { "pagination": { "page": 1 }}
}`,
},
},
Expand Down Expand Up @@ -137,9 +143,12 @@ func TestStepCreateSnapshot(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
{"DELETE", "/images/20", nil,
Expand Down Expand Up @@ -177,9 +186,12 @@ func TestStepCreateSnapshot(t *testing.T) {
"action": { "id": 3, "status": "running" }
}`,
},
{"GET", "/actions/3", nil,
{"GET", "/actions?id=3&page=1&sort=status&sort=id", nil,
200, `{
"action": { "id": 3, "status": "success" }
"actions": [
{ "id": 3, "status": "success" }
],
"meta": { "pagination": { "page": 1 }}
}`,
},
{"DELETE", "/images/20", nil,
Expand Down
14 changes: 4 additions & 10 deletions builder/hcloud/step_shutdown_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ func (s *stepShutdownServer) Run(ctx context.Context, state multistep.StateBag)
return errorHandler(state, ui, "Error stopping server", err)
}

_, errCh := client.Action.WatchProgress(ctx, action)
for {
select {
case err1 := <-errCh:
if err1 == nil {
return multistep.ActionContinue
} else {
return errorHandler(state, ui, "Error stopping server", err)
}
}
if err := client.Action.WaitFor(ctx, action); err != nil {
return errorHandler(state, ui, "Error stopping server", err)
}

return multistep.ActionContinue
}

func (s *stepShutdownServer) Cleanup(state multistep.StateBag) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/hashicorp/hcl/v2 v2.20.1
github.com/hashicorp/packer-plugin-sdk v0.5.3
github.com/hetznercloud/hcloud-go/v2 v2.7.2
github.com/hetznercloud/hcloud-go/v2 v2.8.0
github.com/mitchellh/mapstructure v1.5.0
github.com/stretchr/testify v1.9.0
github.com/zclconf/go-cty v1.14.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ github.com/hashicorp/vault/api v1.10.0 h1:/US7sIjWN6Imp4o/Rj1Ce2Nr5bki/AXi9vAW3p
github.com/hashicorp/vault/api v1.10.0/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/hetznercloud/hcloud-go/v2 v2.7.2 h1:UlE7n1GQZacCfyjv9tDVUN7HZfOXErPIfM/M039u9A0=
github.com/hetznercloud/hcloud-go/v2 v2.7.2/go.mod h1:49tIV+pXRJTUC7fbFZ03s45LKqSQdOPP5y91eOnJo/k=
github.com/hetznercloud/hcloud-go/v2 v2.8.0 h1:vfbfL/JfV8dIZUX7ANHWEbKNqgFWsETqvt/EctvoFJ0=
github.com/hetznercloud/hcloud-go/v2 v2.8.0/go.mod h1:jvpP3qAWMIZ3WQwQLYa97ia6t98iPCgsJNwRts+Jnrk=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down

0 comments on commit d22eb5c

Please sign in to comment.