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

specific versions for opa and regal in CI #580

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/policy-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ jobs:

- name: Setup Regal
uses: StyraInc/[email protected]
with:
version: '0.29.0'

- name: Setup OPA
uses: open-policy-agent/setup-opa@v2
with:
version: latest
version: '0.70.0'

- name: Format
run: make policy-engine/rego/format/check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ getApprovalsCount(possibleApprovers) := result if {
# User approvals

checkApproval(approval) := result if {
principal := entities.getUser(input.principal.userId)

approval.countPrincipal == true
approval.approvalEntityType == "Narval::User"

principal := entities.getUser(input.principal.userId)
possibleApprovers = {
entity |
some entity in approval.entityIds
Expand All @@ -28,10 +28,10 @@ checkApproval(approval) := result if {
}

checkApproval(approval) := result if {
principal := entities.getUser(input.principal.userId)

approval.countPrincipal == false
approval.approvalEntityType == "Narval::User"

principal := entities.getUser(input.principal.userId)
possibleApprovers = {entity |
some entity in approval.entityIds
not lib.caseInsensitiveEqual(entity, principal.id)
Expand All @@ -42,10 +42,10 @@ checkApproval(approval) := result if {
# User group approvals

checkApproval(approval) := result if {
principal := entities.getUser(input.principal.userId)

approval.countPrincipal == true
approval.approvalEntityType == "Narval::UserGroup"

principal := entities.getUser(input.principal.userId)
possibleApprovers = {user |
some entity in approval.entityIds
users = entities.getUserGroup(entity).users
Expand All @@ -56,10 +56,10 @@ checkApproval(approval) := result if {
}

checkApproval(approval) := result if {
principal := entities.getUser(input.principal.userId)

approval.countPrincipal == false
approval.approvalEntityType == "Narval::UserGroup"

principal := entities.getUser(input.principal.userId)
possibleApprovers = {user |
some entity in approval.entityIds
users = entities.getUserGroup(entity).users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"chainId": chainAccount.chainId,
"classification": addressBookData.classification,
# we can default to 'managed' because its in accounts
# TODO: @ptroger add addressBookGroups when implemented

Check warning on line 31 in apps/policy-engine/src/resource/open-policy-agent/rego/armory/entities/buildChainAccount.rego

View workflow job for this annotation

GitHub Actions / Open Agent Policy CI

Avoid TODO comments. To learn more, see: https://docs.styra.com/regal/rules/style/todo-comment
"accountType": accountData.accountType,
"assignees": accountData.assignees,
"groups": accountData.groups,
Expand All @@ -55,10 +55,10 @@

# Get source information when there is only an account entry
buildIntentSourceChainAccount(intent) := source if {
chainAccount = parseChainAccount(intent.from)
getAddressBookEntry(intent.from) == null

chainAccount = parseChainAccount(intent.from)
accountData := getAccount(chainAccount.address)
getAddressBookEntry(intent.from) == null

source := {
"id": chainAccount.id,
Expand All @@ -84,7 +84,7 @@
"address": chainAccount.address,
"chainId": chainAccount.chainId,
"classification": addressBookData.classification,
# TODO: @ptroger add addressBookGroups when implemented

Check warning on line 87 in apps/policy-engine/src/resource/open-policy-agent/rego/armory/entities/buildChainAccount.rego

View workflow job for this annotation

GitHub Actions / Open Agent Policy CI

Avoid TODO comments. To learn more, see: https://docs.styra.com/regal/rules/style/todo-comment
}
}

Expand Down