Github Web Hooks - Pre-Click Hooks

My requirement is that whenever developers click on github, they must run on the Jenkins server before pushing the CI assembly. If this assembly failed, then clicking on github should be rejected. I need to write hooks for this, but I do not want to write client-side clicks, as they can be disabled by developers. I want to use github sites on the server side or pre-connect to them.

Now, can this be achieved? If so, where to start? Do I need knowledge of the Rest API? Do I need to write shell scripts?

+5
source share
2 answers

This is not the usual workflow that is possible with GitHub.
You would prefer to use the “secure commit” model with 2 GitHub repositories:

  • one for clicking where you can enable the CI service such as Travis (or your own CI server ),
  • one for valid commits (those that passed CI) pushed by Travis ( as in this question ) and used by the developer to synchronize their repo (only for pull, without clicking)

what is the requirement for my project that cannot be changed

In this case, it is better to follow the CI Server Construction , which will:

  • detects clicks and starts compilation
  • click on the highlighted branch for a valid comimt (for example, it could be the main branch)

This means that developers should only point to the "dev" branch controlled by your server, and your CI engine will push these commits to the main branch if compilation passes.

+5
source

After some research, I found that you can start jenkins collection using github webhooks, but it is not possible to reject the github push message request if jenkins assembly failed. So basically, we cannot control github push, at least not in the free github account.

If I'm wrong, someone corrects me.

+1
source

All Articles