github / github/platform-samples

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

Abierto
#493 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Shell
Estrellas
2.2k
Forks
1.9k
Merge medio
7 d 19 h
PR fusionados (30 d)
1

Descripción

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]#
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with pre-receive-hooks/require-jira-issue.sh and inspect the grep expression associated with the reported “Invalid range end” error. Reproduce the push with the example commit messages, then verify that a commit containing JIRA-123 is accepted while a commit without a JIRA issue is rejected.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
git, shell
Área
devops
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.