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

[SECENG-582] Make policy decisions locally #740

Merged
merged 13 commits into from
Jun 29, 2022

Conversation

sagar-connect
Copy link
Contributor

@sagar-connect sagar-connect commented Jun 28, 2022

Checklist

=========

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked for similar issues and haven't found anything relevant.
  • This is not a security issue (which should be reported here: https://circleci.com/security/)
  • I have read Contribution Guidelines.

Changes

=======

  • imported circle-policy-agent to the project to use cpa for local policy evaluations
  • Extended decide sub-command to also perform policy evaluations locally
  • redeclared org-id flag in decide subcommand to make it optional flag
  • added tests to verify changes
  • minor flag help text update for org-id
  • rename test.yaml to test.yml

Rationale

=========

The current implementation of decide subcommand performs policy decision using policy-service
This PR extends decide subcommand to perform policy evaluation locally using imported circle-policy-agent

Considerations

==============

  • Extended the existing subcommand instead of creating a new subcommand, the local vs remote execution based on whether --policy flag is provided or not
  • --policy flag can be used to provide either of a policy file or directory containing policy files

@sagar-connect sagar-connect changed the base branch from master to SECENG-600-remote-policy-decision June 28, 2022 02:28
@codecov
Copy link

codecov bot commented Jun 28, 2022

Codecov Report

Merging #740 (d6cd3b2) into master (897ebaf) will increase coverage by 0.21%.
The diff coverage is 70.00%.

@@            Coverage Diff             @@
##           master     #740      +/-   ##
==========================================
+ Coverage   31.59%   31.81%   +0.21%     
==========================================
  Files          44       44              
  Lines        5295     5322      +27     
==========================================
+ Hits         1673     1693      +20     
- Misses       3376     3379       +3     
- Partials      246      250       +4     
Impacted Files Coverage Δ
cmd/policy/policy.go 79.29% <70.00%> (-0.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 897ebaf...d6cd3b2. Read the comment docs.

Base automatically changed from SECENG-600-remote-policy-decision to master June 28, 2022 13:40
@sagar-connect sagar-connect marked this pull request as ready for review June 28, 2022 13:46
@sagar-connect sagar-connect requested a review from a team as a code owner June 28, 2022 13:46
cmd/policy/cpa_utils.go Outdated Show resolved Hide resolved
cmd/policy/cpa_utils.go Outdated Show resolved Hide resolved
cmd/policy/cpa_utils.go Outdated Show resolved Hide resolved
cmd/policy/testdata/test0/config.yml Outdated Show resolved Hide resolved
cmd/policy/policy.go Show resolved Hide resolved
@sagar-connect sagar-connect merged commit 0510d31 into master Jun 29, 2022
@sagar-connect sagar-connect deleted the SECENG-582-make-decision-locally branch June 29, 2022 19:03
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