jenkinsci / jenkinsci/hetzner-cloud-plugin

Use actions to wait for async tasks completion

Open
#105 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
28
Forks
11
PR merge metrics
No merged PRs in 30d

Description

### What feature do you want to see added?

I noticed that this plugin is not waiting for actions (Hetzner Cloud API async task) to be completed, instead the plugin relies on fetching e.g. server over and over until something has changed.

This leads to users being rate limited by our API, and may introduce a lot of errors while performing changes (e.g. locking) which in turn requires to retry a lot request and hitting the rate limits again. Also, sometimes a new change (action) may only be performed once the previous change (action) is completed.

Note that our API has a different rate limit for actions than for other endpoints. This is because we expect users to wait for actions to complete by calling the actions endpoint more than the other, more expensive, resource endpoints. You should leverage that to reduce the chances to run into rate limits.

I recommend you to implement a actions wait function similar to:
- https://github.com/hetznercloud/hcloud-go/blob/v2.22.0/hcloud/action_waiter.go#L101-L120
- https://github.com/hetznercloud/hcloud-go/blob/v2.22.0/hcloud/action_waiter.go#L18-L99

This will allow you to wait for the actions returned by e.g. the create server endpoint, instead of calling `/servers/` repeatedly. This applies for all of the API resources that returns actions.

### Upstream changes

_No response_

### Are you interested in contributing this feature?

No, but I am happy to answer additional questions.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked hcloud-go action_waiter.go implementation and locating the plugin operations that receive actions from the Hetzner Cloud API. Map which resource operations currently poll resource endpoints, then verify that all applicable actions wait through the actions endpoint and avoid repeated resource fetching.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.