Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to Policy set API for PPRV #752

Merged
merged 7 commits into from
Jan 24, 2024
Merged

Changes to Policy set API for PPRV #752

merged 7 commits into from
Jan 24, 2024

Conversation

mrinalirao
Copy link
Contributor

@mrinalirao mrinalirao commented Aug 11, 2023

Description

Add support to the go-tfe client for creating sentinel policy sets that will be run within the agent against a pinned policy tool version. FYI: Pinned Policy Runtime version is now GA.

It also removes beta tags from old OPA tests as OPA is now in GA

Api's updated:

Policy set creation (Adds agent-enabled + policy-tool-version attribute)

Testing plan
Integration tests added

External links
JIRA

Output from tests
Needs the following env vars:
TFE_ADDRESS
TFE_TOKEN
Set ENABLE_BETA=1

envchain staging go test -run TestPolicySetsCreate -v ./... -tags=integration
=== RUN TestPolicySetsCreate
=== RUN TestPolicySetsCreate/with_valid_attributes
=== RUN TestPolicySetsCreate/with_kind_missing
=== RUN TestPolicySetsCreate/with_agent_enabled_missing
--- PASS: TestPolicySetsCreate (1.45s)
--- PASS: TestPolicySetsCreate/with_valid_attributes (0.25s)
--- PASS: TestPolicySetsCreate/with_kind_missing (0.32s)
--- PASS: TestPolicySetsCreate/with_agent_enabled_missing (0.23s)
PASS
ok github.com/hashicorp/go-tfe 2.317s
? github.com/hashicorp/go-tfe/examples/configuration_versions [no test files]
? github.com/hashicorp/go-tfe/examples/organizations [no test files]
? github.com/hashicorp/go-tfe/examples/registry_modules [no test files]
? github.com/hashicorp/go-tfe/examples/state_versions [no test files]
? github.com/hashicorp/go-tfe/examples/users [no test files]
? github.com/hashicorp/go-tfe/examples/workspaces [no test files]
? github.com/hashicorp/go-tfe/mocks [no test files]

envchain staging go test -run TestPolicySetsUpdate -v ./... -tags=integration
=== RUN TestPolicySetsUpdate
=== RUN TestPolicySetsUpdate/with_valid_attributes
--- PASS: TestPolicySetsUpdate (1.61s)
--- PASS: TestPolicySetsUpdate/with_valid_attributes (0.30s)
PASS
ok github.com/hashicorp/go-tfe 2.301s
? github.com/hashicorp/go-tfe/examples/configuration_versions [no test files]
? github.com/hashicorp/go-tfe/examples/organizations [no test files]
? github.com/hashicorp/go-tfe/examples/registry_modules [no test files]
? github.com/hashicorp/go-tfe/examples/state_versions [no test files]
? github.com/hashicorp/go-tfe/examples/users [no test files]
? github.com/hashicorp/go-tfe/examples/workspaces [no test files]
? github.com/hashicorp/go-tfe/mocks [no test files]

envchain staging go test -run TestPolicySetsList -v ./... -tags=integration
=== RUN TestPolicySetsList
=== RUN TestPolicySetsList/without_list_options
--- PASS: TestPolicySetsList (2.90s)
--- PASS: TestPolicySetsList/without_list_options (0.51s)
PASS
ok github.com/hashicorp/go-tfe 3.726s
? github.com/hashicorp/go-tfe/examples/configuration_versions [no test files]
? github.com/hashicorp/go-tfe/examples/organizations [no test files]
? github.com/hashicorp/go-tfe/examples/registry_modules [no test files]
? github.com/hashicorp/go-tfe/examples/state_versions [no test files]
? github.com/hashicorp/go-tfe/examples/users [no test files]
? github.com/hashicorp/go-tfe/examples/workspaces [no test files]
? github.com/hashicorp/go-tfe/mocks [no test files]

@mrinalirao mrinalirao force-pushed the mr/pprv_policyset_api branch 24 times, most recently from 63b6f80 to 27f1717 Compare August 14, 2023 07:45
@mrinalirao mrinalirao force-pushed the mr/pprv_policyset_api branch 4 times, most recently from d8bcdc1 to 4722fe7 Compare December 28, 2023 01:53
@mrinalirao mrinalirao marked this pull request as ready for review December 28, 2023 05:01
@mrinalirao mrinalirao requested a review from a team as a code owner December 28, 2023 05:01
@mrinalirao mrinalirao force-pushed the mr/pprv_policyset_api branch from 4722fe7 to e44d618 Compare January 22, 2024 02:01
@mrinalirao mrinalirao changed the title [DO NOT MERGE] Changes to Policy set API for PPRV Changes to Policy set API for PPRV Jan 22, 2024
@mrinalirao mrinalirao force-pushed the mr/pprv_policyset_api branch 4 times, most recently from 493c5b1 to 37e1663 Compare January 22, 2024 23:07
Copy link
Member

@nfagerlund nfagerlund left a comment

Choose a reason for hiding this comment

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

I haven't fully reviewed the code yet, but there was one glaring problem (in multiple places) that jumped out at me, and I wanted to send it back to you as soon as I could. I'll take another look once you've got that sorted out!

@mrinalirao mrinalirao force-pushed the mr/pprv_policyset_api branch 4 times, most recently from 31d8e2d to 0634384 Compare January 23, 2024 05:39
@mrinalirao mrinalirao force-pushed the mr/pprv_policyset_api branch from 424c1c1 to e90f6c0 Compare January 23, 2024 21:54
Copy link
Member

@nfagerlund nfagerlund left a comment

Choose a reason for hiding this comment

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

Ok, this is mostly looking good, other than one missing omitempty. My only other real concern at this point is making sure the doc comments are easy to understand. Comments inline.

@uturunku1 uturunku1 self-requested a review January 24, 2024 16:36
@mrinalirao mrinalirao merged commit a70b00f into main Jan 24, 2024
9 checks passed
@mrinalirao mrinalirao deleted the mr/pprv_policyset_api branch January 24, 2024 22:50
Copy link

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

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.

3 participants