Repository navigation
feat(volume): add Resize, GetAction and ListActions tasks - #23
Conversation
Part of kestra-io#10 (Block Storage Actions slice).
jymaire
left a comment
There was a problem hiding this comment.
Kestra Plugin Code Review
Business Requirements — met
Issue #22 asks for volume Resize, GetAction and ListActions on /v2/volumes/{id}/actions. All three are implemented. Endpoints, payloads and response envelopes match DigitalOcean's OpenAPI spec (POST .../actions with type=resize, GET .../actions/{action_id} returning action, GET .../actions returning a paginated actions array). The 1-16384 range is checked before any call. Shrinking is left to the API, and its 422 reason is surfaced.
Kestra Guidelines — 1 finding
- 🟡
Resize.java:76[Guidelines] Region required but optional in the API
Checked and fine:
- All three tasks reuse the shared
AbstractDigitalOceanTaskhelpers (request/requestJson/fetchAllPages) as Attach/Detach do. Each call uses a scopedHttpClient, andListActionsreuses one client across pages. There is no raw HTTP client. kestraVersion=1.3.39: only 1.3/2.0-stable core APIs are used (Property,HttpRequest,HttpClient), with no Ion reads and noVoidOutput. No 2.0 compatibility concern.package-info,metadata/volume.yaml(only thebodytext changed, no invented fields) anddoc/io.kestra.plugin.digitalocean.mdare updated. No new sub-package, so no new icon or metadata file is needed.AGENTS.mdchange is appropriate: it lists onlyResize,GetActionandListActions, all in this diff, and documents the newVolumeActionOutput. Its text also changed in the open PR #25 (see below).- Examples are full flows with
secret(). Tests are unconditional WireMock tests and include the happy path per task. I ranResizeTest,GetActionTestandListActionsTestlocally: 12/12 pass.
Security (OWASP Top 10:2025 + KPS) — 0 findings
✅ No issues found. The token is a secret property with @ToString.Exclude inherited from the base class, path segments are URL-encoded, and no secret is logged or output.
Performance — 0 findings
✅ No issues found. Pagination is capped by the shared MAX_PAGES guard, and FetchType.STORE is inherited from the shared list task.
Overlap with other open PRs
- PR #29 (bearer-token fix in
request()/fetchAllPages()): no file conflict. These tasks go through the same helpers, so they pick up the fix automatically once #29 merges. - PR #25 (same author) also edits
AGENTS.mdanddoc/io.kestra.plugin.digitalocean.md. Expect a textual conflict in those two files for whichever PR merges second.
Verdict: Recommend merge after the author considers the one suggestion above. Nothing blocking. (Posted as a COMMENT review. Approval is left to the maintainers.)
fdelbrayelle
left a comment
There was a problem hiding this comment.
Kestra Plugin Code Review
Business Requirements — met
Issue #22 asks for volume Resize, GetAction and ListActions on /v2/volumes/{id}/actions. All three are present, with the 1 to 16384 range checked before the call and the API's 422 reason surfaced.
Previous Review Follow-up — 1 of 1 addressed
Baseline: 18054d1701 (review by jymaire, kestra-io member).
- ✅
Resize.java:76Region required but optional in the API:@NotNullremoved, region rendered withorElse(null)and only added to the payload when set (VolumeActionPayload.buildResize), covered byomitsRegionWhenNotSet. The existing thread is left open for its author to resolve.
Kestra Guidelines — 1 finding
- 🟢
Resize.java:73[Guidelines] Region description does not say it is optional
Security (OWASP Top 10:2025 + KPS) — 0 findings
✅ No issues found. The delta only touches the optional region field. No .github, Gradle or build files changed in this PR, so the pending fork workflow run was safe to approve.
Performance — 0 findings
✅ No issues found
Verdict: APPROVE
QA report: volume Resize, GetAction, ListActions (head
|
| # | Flow | Scope | 1.3.42 | 2.0.5 |
|---|---|---|---|---|
| 1 | digitalocean_resize_volume (Resize @example) |
new | ✅ SUCCESS | ✅ SUCCESS |
| 2 | digitalocean_volume_action_status (GetAction @example) |
new | ✅ SUCCESS | ✅ SUCCESS |
| 3 | digitalocean_list_volume_actions (ListActions @example) |
new | ✅ SUCCESS | ✅ SUCCESS |
| 4 | qa_resize_no_region_wait: Resize without region + LoopUntil on GetAction |
new | ✅ SUCCESS | ✅ SUCCESS |
| 5 | qa_resize_shrink_422: shrink rejected by the API |
new, negative | ✅ FAILED as expected | ✅ FAILED as expected |
| 6 | qa_resize_out_of_range: sizeGigabytes: 20000 |
new, negative | ✅ FAILED as expected | ✅ FAILED as expected |
| 7 | qa_get_action_not_found: GetAction on a missing volume |
new, negative | ✅ FAILED as expected | ✅ FAILED as expected |
| 8 | qa_list_actions_paged: 2-page result, FETCH/FETCH_ONE/STORE |
new | ✅ SUCCESS | ✅ SUCCESS |
| 9 | qa_attach_nonregression: existing Attach, then GetAction on its action |
non-regression | ✅ SUCCESS | ✅ SUCCESS |
Requests the mock received (the same on both versions):
- Resize with region:
{"type":"resize","size_gigabytes":200,"region":"nyc3"} - Resize without region (flow 4):
{"type":"resize","size_gigabytes":150}. Theregionkey is absent, so the fix from the previous review works end to end. - Flow 6 sent no request: the 1 to 16384 range is checked before the call.
- Every request carried the expected bearer token. Pebble-rendered
volumeId,sizeGigabytes(INT input) andactionId(fromoutputs.resize_volume.actionId) all rendered correctly.
Editor: flow 4 (Resize with no region) shows as valid in the 1.3.42 and 2.0.5 editors (1.3, 2.0). The new tasks have documentation pages (Resize, GetAction, ListActions).
Flow 1: digitalocean_resize_volume (✅ SUCCESS on both)
Flow YAML
id: digitalocean_resize_volume
namespace: company.team
tasks:
- id: resize_volume
type: io.kestra.plugin.digitalocean.volume.Resize
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
sizeGigabytes: 200
region: "nyc3"| Task | Status | 1.3.42 | 2.0.5 |
|---|---|---|---|
resize_volume |
SUCCESS | 0.81s | 0.23s |
| Total | SUCCESS | 1.46s | 0.28s |
Logs synthesis: one INFO line per run, no warning or error.
Outputs synthesis (1.3): actionId: 72531857, status: in-progress, type: resize_volume.
Flow 2: digitalocean_volume_action_status (✅ SUCCESS on both)
Flow YAML
id: digitalocean_volume_action_status
namespace: company.team
tasks:
- id: resize_volume
type: io.kestra.plugin.digitalocean.volume.Resize
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
sizeGigabytes: 300
region: "nyc3"
- id: get_action
type: io.kestra.plugin.digitalocean.volume.GetAction
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
actionId: "{{ outputs.resize_volume.actionId }}"
- id: log_status
type: io.kestra.plugin.core.log.Log
message: "Resize is {{ outputs.get_action.status }}"| Task | Status | 1.3.42 | 2.0.5 |
|---|---|---|---|
resize_volume |
SUCCESS | 0.23s | 0.10s |
get_action |
SUCCESS | 0.05s | 0.03s |
log_status |
SUCCESS | 0.05s | 0.04s |
| Total | SUCCESS | 0.89s | 0.32s |
Logs synthesis: Resize is in-progress.
Outputs synthesis (1.3, 2.0): get_action returned actionId (the same as Resize's), status: in-progress, type: resize_volume, startedAt, region: nyc3. completedAt is absent while the action is in progress.
Flow 3: digitalocean_list_volume_actions (✅ SUCCESS on both)
Flow YAML
id: digitalocean_list_volume_actions
namespace: company.team
tasks:
- id: list_actions
type: io.kestra.plugin.digitalocean.volume.ListActions
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
- id: log_total
type: io.kestra.plugin.core.log.Log
message: "Found {{ outputs.list_actions.total }} action(s) on the volume"| Task | Status | 1.3.42 | 2.0.5 |
|---|---|---|---|
list_actions |
SUCCESS | 0.53s | 0.04s |
log_total |
SUCCESS | 0.04s | 0.02s |
| Total | SUCCESS | 0.93s | 0.13s |
Logs synthesis: Found 3 action(s) on the volume.
Outputs synthesis (1.3): rows holds the 3 raw actions (the seeded attach and the two resizes from flows 1 and 2), size: 3, total: 3. The request used per_page=200.
Flow 4: qa_resize_no_region_wait (✅ SUCCESS on both)
Flow YAML
id: qa_resize_no_region_wait
namespace: qa.digitalocean
inputs:
- id: volume_id
type: STRING
defaults: 82a48a18-873f-11e6-96bf-000f53315a41
- id: size
type: INT
defaults: 150
tasks:
- id: resize_volume
type: io.kestra.plugin.digitalocean.volume.Resize
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
baseUrl: http://qa-digitalocean23-mock:8080
volumeId: "{{ inputs.volume_id }}"
sizeGigabytes: "{{ inputs.size }}"
- id: wait_for_resize
type: io.kestra.plugin.core.flow.LoopUntil
condition: "{{ outputs.get_action.status != 'in-progress' }}"
checkFrequency:
interval: PT2S
maxDuration: PT25S
tasks:
- id: get_action
type: io.kestra.plugin.digitalocean.volume.GetAction
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
baseUrl: http://qa-digitalocean23-mock:8080
volumeId: "{{ inputs.volume_id }}"
actionId: "{{ outputs.resize_volume.actionId }}"
- id: list_actions
type: io.kestra.plugin.digitalocean.volume.ListActions
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
baseUrl: http://qa-digitalocean23-mock:8080
volumeId: "{{ inputs.volume_id }}"
- id: summary
type: io.kestra.plugin.core.log.Log
message: "Resize {{ outputs.get_action.status }} at {{ outputs.get_action.completedAt }}, region={{ outputs.get_action.region ?? 'none' }}; {{ outputs.list_actions.total }} action(s) in history"| Task | Status | 1.3.42 | 2.0.5 |
|---|---|---|---|
resize_volume |
SUCCESS | 0.06s | 0.04s |
wait_for_resize (3 iterations) |
SUCCESS | 6.00s | 6.05s |
get_action |
SUCCESS | 0.05s | 0.04s |
list_actions |
SUCCESS | 0.05s | 0.03s |
summary |
SUCCESS | 0.05s | 0.03s |
| Total | SUCCESS | 6.33s | 6.30s |
Logs synthesis (1.3): Resize completed at 2026-10-13T08:00:16Z, region=none; 2 action(s) in history. The request body had no region key, and since the mock returned none, the region output is absent rather than wrong.
Outputs synthesis (1.3): the final get_action returned status: completed with completedAt set; list_actions returned size: 2, total: 2.
Flow 5: qa_resize_shrink_422 (✅ FAILED as expected on both)
Flow YAML
id: qa_resize_shrink_422
namespace: qa.digitalocean
tasks:
- id: shrink_volume
type: io.kestra.plugin.digitalocean.volume.Resize
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: 82a48a18-873f-11e6-96bf-000f53315a41
sizeGigabytes: 50
region: nyc3Gantt (1.3, 2.0): shrink_volume FAILED in 0.08s / 0.07s.
Logs synthesis (1.3, 2.0): DigitalOcean API request failed with HTTP 422: new size must be larger than the current size (150 GiB), so the API's reason reaches the user. Kestra's HTTP client logs a second, raw error line with the response body; that comes from the core HTTP client.
Outputs synthesis: none (task failed).
Flow 6: qa_resize_out_of_range (✅ FAILED as expected on both)
Flow YAML
id: qa_resize_out_of_range
namespace: qa.digitalocean
inputs:
- id: size
type: INT
defaults: 20000
tasks:
- id: resize_too_big
type: io.kestra.plugin.digitalocean.volume.Resize
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: range-check-volume
sizeGigabytes: "{{ inputs.size }}"Gantt (1.3, 2.0): resize_too_big FAILED in 0.03s / 0.02s.
Logs synthesis (1.3): sizeGigabytes must be between 1 and 16384, got 20000. The mock received no request for this volume.
Outputs synthesis: none.
Flow 7: qa_get_action_not_found (✅ FAILED as expected on both)
Flow YAML
id: qa_get_action_not_found
namespace: qa.digitalocean
tasks:
- id: get_missing
type: io.kestra.plugin.digitalocean.volume.GetAction
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: missing-volume
actionId: "123"Gantt (1.3, 2.0): get_missing FAILED in 0.06s / 0.03s.
Logs synthesis (1.3): DigitalOcean API returned HTTP 404: resource not found. Verify baseUrl (e.g. https://api.digitalocean.com) and the id used in the request are correct. The resource you were accessing could not be found.
Outputs synthesis: none.
Flow 8: qa_list_actions_paged (✅ SUCCESS on both)
Flow YAML
id: qa_list_actions_paged
namespace: qa.digitalocean
tasks:
- id: list_fetch
type: io.kestra.plugin.digitalocean.volume.ListActions
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: paged-volume
perPage: 3
- id: list_fetch_one
type: io.kestra.plugin.digitalocean.volume.ListActions
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: paged-volume
fetchType: FETCH_ONE
- id: list_store
type: io.kestra.plugin.digitalocean.volume.ListActions
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: paged-volume
fetchType: STORE
- id: read_store
type: io.kestra.plugin.core.log.Log
message: "rows={{ outputs.list_fetch.rows | length }} total={{ outputs.list_fetch.total }} first={{ outputs.list_fetch_one.row.id }} stored={{ outputs.list_store.size }} {{ outputs.list_store.uri }}"| Task | Status | 1.3.42 | 2.0.5 |
|---|---|---|---|
list_fetch |
SUCCESS | 0.06s | 0.06s |
list_fetch_one |
SUCCESS | 0.06s | 0.04s |
list_store |
SUCCESS | 0.08s | 0.07s |
read_store |
SUCCESS | 0.04s | 0.04s |
| Total | SUCCESS | 0.41s | 0.36s |
Logs synthesis (1.3): rows=5 total=5 first=68212728 stored=0 kestra:///…/list-store/….ion. The mock served 3 actions on page 1 and 2 on page 2 (links.pages.next). Each task followed the next link once, and perPage: 3 was sent as per_page=3.
Outputs synthesis (2.0): FETCH returned 5 rows and total: 5. FETCH_ONE returned the first action as row, with size: 1 and total: 5. STORE returned uri and total: 5; the stored file has all 5 actions on both versions. STORE reports size: 0. That value comes from the shared toPageOutput in AbstractDigitalOceanTask, which this PR does not change, so it is outside this PR's scope.
Flow 9: qa_attach_nonregression (✅ SUCCESS on both)
Flow YAML
id: qa_attach_nonregression
namespace: qa.digitalocean
tasks:
- id: attach
type: io.kestra.plugin.digitalocean.volume.Attach
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: 7724db7c-e098-11e5-b522-000f53304e51
dropletId: "11612190"
region: nyc1
- id: get_attach_action
type: io.kestra.plugin.digitalocean.volume.GetAction
apiToken: "{{ secret('DIGITALOCEAN_TOKEN') }}"
volumeId: 7724db7c-e098-11e5-b522-000f53304e51
actionId: "{{ outputs.attach.actionId }}"| Task | Status | 1.3.42 | 2.0.5 |
|---|---|---|---|
attach |
SUCCESS | 0.06s | 0.04s |
get_attach_action |
SUCCESS | 0.04s | 0.04s |
| Total | SUCCESS | 0.17s | 0.18s |
Logs synthesis: no warning or error. Attach still posts {"type":"attach","droplet_id":11612190,"region":"nyc1"} after the shared VolumeActionPayload change.
Outputs synthesis (1.3): attach returned actionId and status: in-progress. GetAction read that action back: type: attach_volume, region: nyc1.
Timeout notes
None. Every execution finished within 30 s; the longest was flow 4, at about 6.3 s.
Result
QA: PASS. The three new tasks behave as described on Kestra 1.3.42 and 2.0.5. QA found no new issue. The Low already raised on Resize.java:73 (the region description) is still open and is not repeated here.
jymaire
left a comment
There was a problem hiding this comment.
All good for me, thanks for the contribution!
What changes are being made and why?
Closes #22 (part of #10). This is the Block Storage Actions slice, after Snapshots (#17) and Billing (#18).
The plugin could attach and detach a volume, but not grow one, and an action's status could only be seen at request time. This adds three tasks on
/v2/volumes/{id}/actions:volume.Resize: grows a volume (DigitalOcean only resizes upwards, up to 16 TiB)volume.GetAction: reads one action's current status, e.g. theactionIdreturned byResize,AttachorDetachvolume.ListActions: lists every action run on a volumeResizefollows the same pattern asAttachandDetach: it returns the action's initial status without waiting.GetActionis what lets a flow wait for it, for example inside aLoopUntil(see the flow below).sizeGigabytesis checked against the API's 1 to 16384 range before calling it, andregionis optional, as inAttachandDetach: it is only sent when set.Endpoints and fields taken from DigitalOcean's OpenAPI spec, plus the docs and metadata entries for the new tasks.
How the changes have been QAed?
region, the size range rejected before any call, the API's reason surfaced when trying to shrink (422), 404 and 429, reading an in-progress action withoutregion_slug, and one per task rendering its properties from Pebble expressions. The full suite passes (140/140, rebased onmainafter feat(snapshot): add snapshot tasks and volume CreateSnapshot #17), and breaking the resize body, the GetAction path or the region fallback makes the matching tests fail.baseUrlpoints to the mock; drop it to hit the real API):The loop polled the action four times until it was
completed. A second flow trying to shrink the volume to 50 GiB failed withDigitalOcean API request failed with HTTP 422: new size must be larger than the current size (200 GiB).Before / after
Plugin list: the Volumes group gains
Resize,GetActionandListActions. The screenshots were taken before #17 landed, soCreateSnapshotis not in them.Editor: the released plugin rejects
volume.Resize, this branch validates it.The demo flow running end to end.
Setup Instructions
A DigitalOcean API token in a
DIGITALOCEAN_TOKENsecret, with theblock_storage_action:createscope forResizeandblock_storage_action:readforGetActionandListActions.Contributor Checklist ✅