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

feat: add enforce support for project hooks/webhooks configuration #664

Merged
merged 10 commits into from
Jan 11, 2024

Conversation

TigreModerata
Copy link
Contributor

@TigreModerata TigreModerata commented Jan 6, 2024

Added 'enforce' support for hooks processor. If set to true, all hooks not present in config yaml will be removed. Set to false is the same as omitting it - in this case 'delete: true' has to be set on any hook that should be deleted.
Added 2 tests, enforce to true/false.
Updated documentation section on webhooks.

Closes #662

If enforce==true in hooks config all non present hooks are deleted
Copy link

codecov bot commented Jan 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6d01221) 84.27% compared to head (65e0bcf) 84.41%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #664      +/-   ##
==========================================
+ Coverage   84.27%   84.41%   +0.14%     
==========================================
  Files          69       69              
  Lines        2741     2747       +6     
==========================================
+ Hits         2310     2319       +9     
+ Misses        431      428       -3     
Files Coverage Δ
gitlabform/processors/project/hooks_processor.py 97.56% <100.00%> (+0.41%) ⬆️

... and 3 files with indirect coverage changes

tests/acceptance/standard/test_hooks.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@amimas amimas left a comment

Choose a reason for hiding this comment

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

Do we need an additional test case when hooks delete amd enforce is used together? I guess the existing test case named test_hooks_delete kind of takes care of delete with enforce disabled. What happens delete for a hook is enabled and enforce is also enabled?

docs/reference/webhooks.md Outdated Show resolved Hide resolved
docs/reference/webhooks.md Outdated Show resolved Hide resolved
gitlabform/processors/project/hooks_processor.py Outdated Show resolved Hide resolved
tests/acceptance/standard/test_hooks.py Outdated Show resolved Hide resolved
tests/acceptance/standard/test_hooks.py Outdated Show resolved Hide resolved
@amimas amimas changed the title #662 enforce hooks feat: add enforce support for project hooks/webhooks configuration Jan 7, 2024
Co-authored-by: amimas <aver.mimas@gmail.com>
Bug fix: iterator config_hooks to tuple (got consumed before 'enforce' section)
docs/reference/webhooks.md Outdated Show resolved Hide resolved
docs/reference/webhooks.md Outdated Show resolved Hide resolved
tests/acceptance/standard/test_hooks.py Outdated Show resolved Hide resolved
docs/reference/webhooks.md Outdated Show resolved Hide resolved
Co-authored-by: amimas <aver.mimas@gmail.com>
Co-authored-by: amimas <aver.mimas@gmail.com>
In test_hooks, changed string split to group.path
@amimas amimas temporarily deployed to Integrate Pull Request January 11, 2024 05:15 — with GitHub Actions Inactive
Copy link
Collaborator

@amimas amimas left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks again for this PR.

@amimas amimas merged commit aa53356 into gitlabform:main Jan 11, 2024
23 checks passed
@TigreModerata TigreModerata deleted the #662_enforce_hooks branch January 11, 2024 13:37
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.

Add enforce support for hooks configuration
2 participants