Repository navigation
Add a validation_hook option to each remote. - #190
tomfitzhenry wants to merge 1 commit into
Conversation
When the remote provides the selected commit, comin executes the hook with the comin repository as the working directory, only if the commit signature passes verification. If the hook exits non-zero, the deploy is halted. Closes nlewo#119
| cmd.Dir = repositoryPath | ||
| output, err := cmd.CombinedOutput() | ||
| if err != nil { | ||
| return fmt.Errorf("the validation hook '%s' failed: %s\n%s", hook, err, string(output)) |
There was a problem hiding this comment.
We should avoid putting line breaks in the error message.
What would you think about printing the whole output with logrus.info (ideally line per line) and putting only the last output line in the error message?
| The path to an executable validation hook script. When the | ||
| remote provides the commit to evaluate, comin executes this | ||
| script with the comin Git repository (which is bare) as the | ||
| working directory, after commit signature verification. A |
There was a problem hiding this comment.
Maybe this help message should be more explicit that the hook is executed after the signature verification, only when a signature is expected.
|
@tomfitzhenry Thank you for this contribution! |
|
I realised this doesn't work for gittuf, because gittuf relies on non-bare repos, but comin clones bare repos. I will investigate further. |
Ah, gittuf now supports it: gittuf/gittuf#1462 |
When the remote provides the selected commit, comin executes the hook with the comin repository as the working directory, only if the commit signature passes verification.
If the hook exits non-zero, the deploy is halted.
Closes #119