Skip to content

Publish operations for platform hub policies#408

Merged
denys-octopus merged 2 commits intomas/modify-platform-hub-policiesfrom
mas/publish-platform-hub-policies
Mar 11, 2026
Merged

Publish operations for platform hub policies#408
denys-octopus merged 2 commits intomas/modify-platform-hub-policiesfrom
mas/publish-platform-hub-policies

Conversation

@denys-octopus
Copy link
Contributor

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, ActivateVersion and DeactivateVersion functions in the platformhubpolicies package

@denys-octopus denys-octopus changed the title Mas/publish platform hub policies Publish operations for platform hub policies Mar 10, 2026
Copy link

@shaun-od shaun-od left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, again the comment about previous PR and owners approval


var getValidator = sync.OnceValues(buildValidator)

func buildValidator() (*validator.Validate, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this break if someone changes something on the validator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we are returning the version by value as you "can't" modify it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we intentionally return a data object, because policy version is immutable structure in the Octopus Deploy

@denys-octopus denys-octopus merged commit 1463f2e into mas/modify-platform-hub-policies Mar 11, 2026
6 checks passed
@denys-octopus denys-octopus deleted the mas/publish-platform-hub-policies branch March 11, 2026 03:45
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)
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.

2 participants