Skip to content

feat: add SnapshotVariables for releases and runbook snapshots#430

Open
justin-newman wants to merge 2 commits into
OctopusDeploy:mainfrom
justin-newman:feat/snapshot-variables
Open

feat: add SnapshotVariables for releases and runbook snapshots#430
justin-newman wants to merge 2 commits into
OctopusDeploy:mainfrom
justin-newman:feat/snapshot-variables

Conversation

@justin-newman

@justin-newman justin-newman commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Adds two package-level client functions that refresh ("re-snapshot") the variable snapshot on an existing release or runbook snapshot, by POSTing to the server's snapshot-variables endpoints:

  • releases.SnapshotVariables(client, spaceID, releaseID) (*Release, error)POST /api/{spaceId}/releases/{releaseId}/snapshot-variables
  • runbooks.SnapshotVariables(client, spaceID, snapshotID) (*RunbookSnapshot, error)POST /api/{spaceId}/runbookSnapshots/{snapshotId}/snapshot-variables

Both follow the existing package conventions: validate parameters, expand a uritemplates template, and call newclient.Post. Each mirrors its neighbouring function's validation-error style — releases.SnapshotVariables uses CreateInvalidParameterError (like GetReleaseDeploymentTemplate); runbooks.SnapshotVariables uses CreateRequiredParameterIsEmptyOrNilError (like GetSnapshot).

Two new URI templates are added in uritemplates/links.go. Changes are purely additive (+86 lines, no existing behaviour modified).

Why

Requested during review of OctopusDeploy/cli#589: the new octopus release update-variables and octopus runbook snapshot update-variables commands should call the go client rather than hand-rolling the HTTP request, so the capability is reusable outside the CLI.

Consumer / ordering

OctopusDeploy/cli#589 depends on this PR. Once this merges and a version is tagged, cli#589 will bump its go-octopusdeploy dependency to that version and drop its temporary local replace directive — so cli#589 can be approved/merged as soon as this lands.

Tests

Added validation unit tests for both functions (release_service_test.go, runbook_service_test.go) covering the client/spaceID/id required-parameter checks, following the existing test conventions in each package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant