feat: add SnapshotVariables for releases and runbook snapshots#430
Open
justin-newman wants to merge 2 commits into
Open
feat: add SnapshotVariables for releases and runbook snapshots#430justin-newman wants to merge 2 commits into
justin-newman wants to merge 2 commits into
Conversation
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-variablesendpoints:releases.SnapshotVariables(client, spaceID, releaseID) (*Release, error)→POST /api/{spaceId}/releases/{releaseId}/snapshot-variablesrunbooks.SnapshotVariables(client, spaceID, snapshotID) (*RunbookSnapshot, error)→POST /api/{spaceId}/runbookSnapshots/{snapshotId}/snapshot-variablesBoth follow the existing package conventions: validate parameters, expand a
uritemplatestemplate, and callnewclient.Post. Each mirrors its neighbouring function's validation-error style —releases.SnapshotVariablesusesCreateInvalidParameterError(likeGetReleaseDeploymentTemplate);runbooks.SnapshotVariablesusesCreateRequiredParameterIsEmptyOrNilError(likeGetSnapshot).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-variablesandoctopus runbook snapshot update-variablescommands 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-octopusdeploydependency to that version and drop its temporary localreplacedirective — 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.