Skip to content

feat: Add support for executing pre-receive hooks#908

Merged
JamieSlome merged 19 commits intofinos:mainfrom
fabiovincenzi:pre-receive
Mar 13, 2025
Merged

feat: Add support for executing pre-receive hooks#908
JamieSlome merged 19 commits intofinos:mainfrom
fabiovincenzi:pre-receive

Conversation

@fabiovincenzi
Copy link
Contributor

This PR adds support for managing pre-receive hooks by executing .sh scripts located in the ./hooks directory. These scripts allow administrators to define conditions for automatically approving or rejecting pushes.

Changes Introduced

  • Implement execution of .sh scripts in the ./hooks directory to validate pushes.
  • Add basic tests to verify hook execution functionality.

You can also test this feature using the following pre-receive samples. Simply place a sample script in the ./hooks directory and attempt a push. The script should execute and determine whether the push is accepted or rejected.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 17, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 774a55e
🔍 Latest deploy log https://app.netlify.com/sites/endearing-brigadeiros-63f9d0/deploys/67d2f8f3824b7700081842e9

@fabiovincenzi fabiovincenzi changed the title Add support for executing pre-receive hooks feat: Add support for executing pre-receive hooks Feb 17, 2025
@JamieSlome
Copy link
Member

@06kellyjac (cc) 🍰

@JamieSlome JamieSlome self-requested a review February 21, 2025 10:06
@codecov
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.88%. Comparing base (d043db7) to head (774a55e).
Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #908      +/-   ##
==========================================
+ Coverage   61.06%   61.88%   +0.81%     
==========================================
  Files          48       49       +1     
  Lines        1767     1805      +38     
==========================================
+ Hits         1079     1117      +38     
  Misses        688      688              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JamieSlome JamieSlome left a comment

Choose a reason for hiding this comment

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

Another solid G-PR 😏

Can you confirm my understanding? This PR supports the definition and execution of .sh scripts which can be exposed to the chain via the hooks folder?

@JamieSlome
Copy link
Member

Just a reminder to get the EasyCLA signed and we're good to proceed 🍰

@fabiovincenzi
Copy link
Contributor Author

Another solid G-PR 😏

Can you confirm my understanding? This PR supports the definition and execution of .sh scripts which can be exposed to the chain via the hooks folder?

Thank you @JamieSlome for the review!
Exactly that is the flow🙌🏻

@JamieSlome
Copy link
Member

JamieSlome commented Feb 24, 2025

Thanks for the clarifications and updates ❤️ Once the EasyCLA is signed I'll merge the PR 🍰

EDIT: and release 🚀

@fabiovincenzi
Copy link
Contributor Author

fabiovincenzi commented Feb 26, 2025

@JamieSlome I added a check to verify whether the pre-receive hook exists. If it doesn’t, we simply skip its execution without any errors. This way, the check is only enforced if both the hooks folder and the pre-receive file are present. What do you think?

Aside from that, we were considering implementing auto-approval of pushes using this hook. I'll create a separate PR for that, but perhaps adding a configuration option like enable-auto-approval: true could allow pushes to be automatically approved and pushed to the upstream, or maybe define something like:

  • status = 0 -> auto-approve.
  • status = 1 -> auto-reject.
  • status = 2 -> manual-approving.

We are working to get the EasyCLA signed, thanks again!😊

@fabiovincenzi
Copy link
Contributor Author

@JamieSlome, All set! EasyCLA is now signed.

@fabiovincenzi fabiovincenzi requested a review from JamieSlome March 7, 2025 08:01
Copy link
Member

@JamieSlome JamieSlome left a comment

Choose a reason for hiding this comment

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

LGTM! 🍰

@JamieSlome JamieSlome merged commit 8efc22b into finos:main Mar 13, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants