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

pre-receive hook script require-jira-issue.sh is not working as expected #493

Open
shailesh-vaidya opened this issue Jan 10, 2023 · 1 comment

Comments

@shailesh-vaidya
Copy link

Hello Team,

Copied https://github.com/github/platform-samples/blob/master/pre-receive-hooks/require-jira-issue.sh to the repository in GitHub Enterprise Server. Configured pre-receive hook following steps from https://docs.github.com/en/enterprise-server@3.5/admin/policies/enforcing-policy-with-pre-receive-hooks/managing-pre-receive-hooks-on-the-github-enterprise-server-appliance

git push is always failing with the below error.

[root@test devops-experiments]# git push origin hook-test
Username for 'https://test.server.com': 729494
Password for 'https://user@test.server.com':
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 328 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: require-jira-issue.sh: failed with exit status 1
remote: grep: Invalid range end
remote: ERROR:
remote: ERROR: Your push was rejected because the commit
remote: ERROR: c975243bb888fc20aee6abec2122f2e4872e712c in hook-test
remote: ERROR: is missing the JIRA Issue 'JIRA-123'.
remote: ERROR:
remote: ERROR: Please fix the commit message and push again.
remote: ERROR: https://help.github.com/en/articles/changing-a-commit-message
remote: ERROR
To https://test.server.com/test/devops-experiments
 ! [remote rejected] hook-test -> hook-test (pre-receive hook declined)
error: failed to push some refs to 'https://test.server.com/test/devops-experiments
[root@test devops-experiments]#
@shailesh-vaidya shailesh-vaidya changed the title require-jira-issue.sh is not working pre-receive hook script require-jira-issue.sh is not working as expected Jan 10, 2023
@theonly171
Copy link

require 'sinatra'
require 'json'

post '/payload' do
push = JSON.parse(request.body.read)
puts "I got some JSON: #{push.inspect}"
end

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

No branches or pull requests

3 participants
@theonly171 @shailesh-vaidya and others