Publish operations for platform hub policies#408
Merged
denys-octopus merged 2 commits intomas/modify-platform-hub-policiesfrom Mar 11, 2026
Merged
Publish operations for platform hub policies#408denys-octopus merged 2 commits intomas/modify-platform-hub-policiesfrom
denys-octopus merged 2 commits intomas/modify-platform-hub-policiesfrom
Conversation
Use single instance of validator for policy validations
shaun-od
approved these changes
Mar 11, 2026
shaun-od
left a comment
There was a problem hiding this comment.
LGTM, again the comment about previous PR and owners approval
|
|
||
| var getValidator = sync.OnceValues(buildValidator) | ||
|
|
||
| func buildValidator() (*validator.Validate, error) { |
There was a problem hiding this comment.
will this break if someone changes something on the validator
Contributor
Author
There was a problem hiding this comment.
We need pointer validator, because validator methods expect receiver to be a pointer.
I don't think there is a risk of validator being compromised
- Validator instance is designed to be have immutable cache (didn't dig deep to confirm that)
- Validator is private member, which can be accessed only within our package
| } | ||
|
|
||
| // Publish publishes a Platform Hub policy version. | ||
| func Publish(client newclient.Client, gitRef string, slug string, version string) (PlatformHubPolicyVersion, error) { |
There was a problem hiding this comment.
I assume we are returning the version by value as you "can't" modify it
Contributor
Author
There was a problem hiding this comment.
Yes, we intentionally return a data object, because policy version is immutable structure in the Octopus Deploy
1463f2e
into
mas/modify-platform-hub-policies
6 checks passed
denys-octopus
added a commit
that referenced
this pull request
Mar 11, 2026
* Add GetBySlug and Update operations to platform hub policies * Add Get operation, return collection of policies * Publish operations for platform hub policies (#408)
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.
Background
We want to allow user to manage compliance policies via go-client.
Part of MAS-6
I want to publish a new version of a policy in Platform Hub
I want to read the versions of a policy in Platform Hub
I want to activate a version of a policy in Platform Hub
I want to deactivate a version of a policy in Platform Hub
Result
Introduce
Publish,GetVersions,ActivateVersionandDeactivateVersionfunctions in theplatformhubpoliciespackage