53 Commits

Author SHA1 Message Date
Darko Draskovic
fd20e8486d hotfixpreqa: [CODE-4317]: Add bypassed to push rules (#4251)
* 4bfa64 Add bypasse check to push rule backfill violations method

* 3a0f13 Merge remote-tracking branch 'origin/main' into dd/push-rules-bypass

* 17d20c Add bypassed to user rules
2025-08-08 12:34:12 +00:00
Johannes Batzill
1a2b17df7d fix: [CODE-4318] Allow to bypass push rules via push (#4253) 2025-08-08 06:53:41 +00:00
Darko Draskovic
40d8af7dfe feat: [CODE-4055]: Add option to include/exclude repos in account/org/project rules (#3978)
* 094fa1 Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* d0f6b8 Renumber db migration

* 95cc4b Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* 528b64 Fix bool return func names

* 476a1b Rename RepoTargetFilter fields

* 70c41b Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* e8442a Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* bd7745 Fix migrations

* b336f3 Refactor forEachRuleMatchBranch to match repo name

* f8d446 Rename match branch funcs to match ref and use repo identifier instead of git uid

* 6ff336 Fix tests

* c0fee2 Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* 141b03 Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* 2832c6 Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* f74c2d Merge remote-tracking branch 'origin/main' into dd/exclude-repos

* 236a09 Refactor RepoTarget Matches function and add unit tests

* 5a1675 Merge remote-trac
2025-08-01 15:30:18 +00:00
Darko Draskovic
3c3ff0dc64 feat: [CODE-4083]: Validate users in the rule user IDs bypass list (#4006)
* Use global ValidateUsers and rename Validator's ValidateUsers to Validate

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Replace noop rules validator with a useful validator logic

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Move all validation into the single helper validateUsers

* Fix tests

* Fix linter issues

* Reuse common rules getRuleUsers to ensureAllUserIDsExist

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Merge remote-tracking branch 'origin/main' into dd/validate-user-bypass

* Add ctx arg to ValidateUsers method of rules Validator

* Use rules Validator as rules service dependency
2025-07-23 14:43:00 +00:00
Karan Saraswat
5517a24459 feat: [CODE-4077]: Add rule_type filter to the rules listing API (#4001)
* fixed default rule type filter

* added enum method in openapi/rules.go

* formatted openapi/rules.go file

* feat: [CODE-4077]: addressed review comments to create enum for RuleType

* feat: [CODE-4077]: Add rule_type filter to the rules listing API
2025-07-14 07:53:02 +00:00
Darko Draskovic
bdab4a14d2 feat: [CODE-3027]: Add secret scanning enable/disable to push rules (#3931)
* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Fix tests

* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Add PrintViolations to protection package

* Sort by size descending push objects in git svc

* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Add map[int64]PushProtection to push rules in/out

* Properly backfill rules

* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Add backfill violations

* Merge remote-tracking branch 'origin/main' into dd/secret-scan-rules

* Remove objects suffix from push protection related structs

* Optimize db settings fetch

* Add secret scanning enabled to push rules
2025-07-08 14:23:48 +00:00
Darko Draskovic
4da9145ba6 fix: [CODE-3027]: Rename push_objects json key name to push (#3960) 2025-07-01 18:33:55 +00:00
Darko Draskovic
f1500ca67a feat: [CODE-3027]: Add support for push rules (#3898)
* Fix isRepoOwner bug
* Remove AllowBypass and always allow bypass
* Merge remote-tracking branch 'origin/main' into dd/push-rules-commiter-verification
* Rename commit objects to push objects
* Merge remote-tracking branch 'origin/main' into dd/push-rules-commiter-verification
* Add push protection check to pre-receive
* Add CommitObjectsVerifyOutput
* Add pushRuleSet
* Merge remote-tracking branch 'origin/main' into dd/push-rules-commiter-verification
* Add PushProtection interface to protection package
* Add support for push rules
2025-06-24 15:52:48 +00:00
Darko Draskovic
60bc0a7d79 feat: [CODE-3788]: Add tag rule type (#3761)
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Use strings builder
* Add rule type string slice flatten for sqlite
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Revert to force update
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Add separate life cycle rules for tags and branches
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Remove reflection
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Rename GetRuleInfos to GetBranchRuleInfos
* Add update tag pre-receive violation
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Merge remote-tracking branch 'origin/main' into dd/tag-rules
* Add unit tests for tagRuleSet
* Add pre-receive tag protection rule
* Rename funcs, export interfaces and further generalize/reuse rule set funcs
* Extract common rule set funcs in set_common.go
* Use ruleTypes ...types.RuleType in ListAllRepoRules store func
* Merge remote-tracking branch 'origin/main'
2025-05-20 15:24:30 +00:00
Abhinav Singh
a4616af1fb fix: [CODE-1944]: add failure ignored flag for check (#3647)
* fix: [CODE-1944]: add failure ignored flag for check
* fix: [CODE-1944]: add failure ignored flag for check
* fix: [CODE-1944]: add failure ignored flag for check
2025-04-21 21:01:58 +00:00
Johannes Batzill
9d5ceb0033 fix: [CODE-3379]: Remove PR author from default reviewer evaluation (#3578) 2025-03-20 19:33:56 +00:00
Johannes Batzill
9882bf0ae4 feat: [CODE-3372]: Return default reviewers in 'Users' field of branch protection rules (#3571) 2025-03-18 18:29:31 +00:00
Darko Draskovic
cad0fbdf98 feat: [CODE-3256]: Add merge verify rule info related to minimum required approvals count for default reviewers (#3483)
* Merge remote-tracking branch 'origin/main' into dd/merge-verify-rules
* Replace princiapl ids with infos in merge verify response
* Populate DefaultReviewerApprovalsResponse with principal ids and current count
* Add MergeVerifyRulesResponse type
2025-02-26 17:56:59 +00:00
Darko Draskovic
df7ac77361 feat: [CODE-3233]: Automatically add default reviewers based on rules (#3464)
* Fix tests
* Amend on protection rules verify to include the entire rule output data
* Merge remote-tracking branch 'origin/main' into dd/rule-reviewers
* Fix protection.Branch init in mapToBranchRules
* Amend MergeVerify to include number of default reviewer approvals
* Merge remote-tracking branch 'origin/main' into dd/rule-reviewers
* Refactor add code owners as reviewers to include add default reviewers
* Automatically add default reviewers based on rules
2025-02-25 15:52:59 +00:00
Darko Draskovic
e39ae83e78 feat: [CODE-2987]: Add codeowners as reviewers (#3439)
* Handle violations in branch CreatePullReqVerify
* Merge remote-tracking branch 'origin/main' into dd/codeowner-reviewers
* Add PullReq infix to Create rule interface and dedup reviewers in PR create
* Add create field to pullreq field in rule def
* Add codeowners as reviewers
2025-02-20 16:03:06 +00:00
Marko Gaćeša
a906259562 feat: [CODE-3148]: refactor refcache (#3390)
* linter issues fix
* reintroduce repofinder to aiagent
* Merge remote-tracking branch 'origin/main' into mg/cache/space-and-repo-finder
* removed refcache deps from aiagent
* pr comments
* fix linter issues
* refactor refcache
2025-02-12 12:42:12 +00:00
Marko Gaćeša
5eb79b3805 feat: [PIPE-22290]: add additional info to list branches API (#2831)
* change type of branch.SHA from string to sha.SHA
* remove code duplication, changed DB query for PRs
* add additional info to list branches API
2024-10-24 13:19:35 +00:00
Marko Gaćeša
449435c9af feat: [CODE-1474]: fix allowed methods in merge dry run (#2783)
* fix allowed methods in merge dry run
2024-10-08 16:20:34 +00:00
Marko Gaćeša
1fd081199e feat: [CODE-2087]: fix rule check for force update push (#2728)
* fix rule check for force update push
2024-09-24 12:52:08 +00:00
Marko Gaćeša
7c83c5520e feat: [CODE-2385]: add fast-forward merge (#2718)
* add fast-forward merge
2024-09-23 11:34:19 +00:00
Darko Draskovic
060d977433 Add two new settings to branch rules: block merge and force push to branch (#2656)
* Fix rule naming, warn log and use switch case for ref update
* Fix tests
* Refactor isForcePush to remove post-receive only related msg
* Add two new settings to branch rules: block merge and force push to branch
2024-09-12 14:17:13 +00:00
Akhilesh Pandey
a2cea52155 feat: [CODE-2232]: Branch Rules: UserGroup support: Create and List (#2640)
* feat: [CODE-2327]: add usergroup change to rebase api
* Merge branch 'main' into akp/CODE-2327
* feat: [CODE-2327]: wrap error
* feat: [CODE-2327]: move resolver inside bypass.go and update tests
* feat: [CODE-2327]: newline
* feat: [CODE-2327]: update wire
* Merge remote-tracking branch 'origin' into akp/CODE-2327
* feat: [CODE-2327]: update tests
* feat: [CODE-2327]: fix build
* feat: [CODE-2327]: merge main
* feat: [CODE-2327]: add and update unit tests
* feat: [CODE-2327]: fix
* feat: [CODE-2312]: introduce parser and enclosing method
* Apply suggestion from code review
* feat: [CODE-2327]: annotate error
* Merge branch 'main' into akp/CODE-2327
* feat: [CODE-2327]: usergroup resolver via controller
* feat: [CODE-2312]: update interface in protection
* feat: [CODE-2312]: export and update deduplication use
* feat: [CODE-2327]: Branch Rules: Allow Group bypass.go
* feat: [CODE-2232]: Branch Rules: UserGroup support: Create and List
2024-09-11 08:04:31 +00:00
Akhilesh Pandey
905d027cc3 feat: [CODE-2232]: Branch Rules: UserGroup support: Create and List (#2636)
* feat: [CODE-2312]: annotate error
* feat: [CODE-2312]: name change and todo removal
* feat: [CODE-2312]: Annotate errors
* feat: [CODE-2232]: Branch Rules: UserGroup support: Create and List
2024-09-09 14:41:03 +00:00
Johannes Batzill
77b01718bd feat: [CODE-2179]: Add error message to protection rule violation error responses (#2665) 2024-09-06 18:54:15 +00:00
Johannes Batzill
6da5c93706 Only allow admin to bypass rules if bypassing is allowed (#2047) 2024-05-17 22:32:35 +00:00
Johannes Batzill
a690fa4ebc small fixes (#1232) 2024-04-19 01:36:03 +00:00
Johannes Batzill
c5383940bd Integrate approvals.RequireLatestcommit to merge dryrun (#1183) 2024-04-04 22:39:23 +00:00
Johannes Batzill
dc7b3bc79a [Rules] Expose extra Branch.PullReq fields on merge DryRyn as required by UI (#1117) 2024-03-13 23:37:10 +00:00
Marko Gacesa
f8f1453de1 add new API: list status checks for a pullreq (#1042) 2024-02-22 10:39:25 +00:00
Darko Draskovic
6f270eb3ae Add rule to block PR merge if changes are requested by reviewer (#1054) 2024-02-21 16:32:02 +00:00
Johannes Batzill
adf2046a94 [MISC] Move UID to Identifier to match Harness Standards (#992) 2024-01-29 23:29:53 +00:00
Marko Gacesa
25d282073d return user info for rule bypass users (#867) 2023-12-05 19:04:04 +00:00
Abhinav Singh
04566e1cf9 feat: support codewoners usrgrp (#826) 2023-11-30 04:02:28 +00:00
Marko Gacesa
703a645e85 update min approval count rule message (#833) 2023-11-28 18:47:21 +00:00
Marko Gacesa
2c618b33b3 add bypassable to rule violation (#802) 2023-11-15 14:37:52 +00:00
Johannes Batzill
972c7d6c67 [BugBash] Rule Descriptions & Reordering, UID Validation, Improved Error Messages (#790) 2023-11-11 00:59:17 +00:00
Marko Gacesa
98dc67fc71 return allowed merge methods for merge dry run (#781) 2023-11-08 18:55:25 +00:00
Marko Gacesa
941bc7a0fd allow optional rule bypass (#764) 2023-11-03 18:31:10 +00:00
Marko Gacesa
f0d87f4437 empty pattern matches all (#743) 2023-10-31 07:33:12 +00:00
Johannes Batzill
b0e519b571 [WIP] Move from space_owner to repo_admin for protection rules (#745) 2023-10-30 22:35:52 +00:00
Marko Gacesa
1a727b8be1 refactor of protection package (#734) 2023-10-27 14:06:09 +00:00
Marko Gacesa
4e3a43efdd add unit tests for the protection package (#729) 2023-10-27 08:05:26 +00:00
Abhinav Singh
adbe2f6f97 feat: [CODE-967]: codeowners service e2e (#695) 2023-10-26 16:50:59 +00:00
Marko Gacesa
02b36d0f73 return want&got for rule violations (#704) 2023-10-26 07:57:52 +00:00
Marko Gacesa
fda8fa733d fix branch.lifecycle rule violation codes (#719) 2023-10-25 12:16:47 +00:00
Marko Gacesa
266b3a4fa1 lifecycle protection rules (#715) 2023-10-24 20:20:20 +00:00
Marko Gacesa
7ab52c1764 add protection to prevent direct push (#712) 2023-10-24 14:22:06 +00:00
Marko Gacesa
fcc8c0be73 use dedicated DB query to fetch all repo rules (#702) 2023-10-20 11:06:33 +00:00
Marko Gacesa
7bbeca2750 status checks: use DB-layer list status checks results func (#692) 2023-10-19 05:43:36 +00:00
Marko Gacesa
c0849b7b36 remove branch rule: all status checks must succeed (#691) 2023-10-18 16:33:55 +00:00