Resolution
On Jenkins
A. Plugin Configuration
GitHub plugin as explained in GitHub Webhook configuration.
B. Job Configuration
In the Job configuration, one of the following Build Triggers
needs to be selected :
-
For Freestyle jobs
-
For PUSH events:
GitHub hook trigger for GITScm polling
(in the past named asBuild when a change is pushed to GitHub
)
-
-
For Pipeline jobs
-
For PUSH events:
GitHub hook trigger for GITScm polling
(in the past named asBuild when a change is pushed to GitHub
) -
-
The job has to be successfully executed manually one time in order for the push trigger and the git repo to be registered
-
Example of
Jenkinsfile
(Note that it includesGitHub hook trigger for GITScm polling
enabled)properties([pipelineTriggers([githubPush()])]) node { stage ('Checkout'){ git branch: 'exampleBranch', url: 'https://github.com/example-org/example-repo.git' } stage ('Build'){ // steps } stage ('Test'){ // steps } }
-
-
If Manage hooks is enabled (Automatic mode) webhooks are generated after you Save the configuration of the job with the right triggers.
|
Troubleshooting
If the post-receive hooks are not there, please review this Troubleshooting guide