Is it actually possible to trigger pipeline job without Jenkinsfile by notifyCommit http-query?

533 views
Skip to first unread message

alexand...@gmail.com

unread,
Jan 16, 2017, 8:33:09 AM1/16/17
to Jenkins Users
Using Jenkins Pipeline there is no longer Source Code Management html-UI section at job configuration (for a pipeline job checkout is handled the pipeline script of the job).

I am trying to trigger a test job by 'notifyCommit' http-query (using curl):

This http-query successfully triggers my FreeStyle jobs with Source Code Management configured (via job UI) appropriately.
But any of my variants of Pipeline jobs containing 'git' or 'checkout scm' are not triggered by this http-query.

Here are some of my Pipeline job scripts I tried to set up 'notifyCommit'-triggering:
node (<node-label>) {
  git url
: 'ssh://git@<git-server-address>/<path>/<repo.git>', branch: 'master', credentialsId: '<id>'
}
---- this variant I borrowed from:
https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md
(see 'Creating a Simple Pipeline' section -> 'Understanding syntax' sub-section)
and modified in accordance with: https://jenkins.io/doc/pipeline/steps/git/

node (<node-label>) {
  checkout
(
   
[  $class: 'GitSCM',
       userRemoteConfigs
: [[url: 'ssh://git@<git-server-address>/<path>/<repo.git>']],
       credentialsId
: '<id>'  ]
 
)
}    
---- this variant I borrowed from:
https://github.com/jenkinsci/workflow-scm-step-plugin/blob/master/README.md
(see 'Generic SCM step' section)

At html-UI of pipeline jobs I switched on 'Poll SCM' (without schedule).
I tried with 'Poll SCM' unchecked also.
For 'git' pipeline step I tried also 'poll' false and true values.
Job HTML-UI setting 'Ignore post-commit hooks' was unchecked during all my tries.
Also I didn't use '$class: IgnoreNotifyCommit'.
On the other hand I successfully configured a pipeline job to be triggered via 'Trigger bulds remotely' set up.

The readme I already referred few lines above (see link below) says that it's possible to trigger pipeline job via 'notifyCommit':
https://github.com/jenkinsci/workflow-scm-step-plugin/blob/master/README.md
(see 'Features' section -> 'Polling' sub-section)
---- but there are no complete examples and no clarifications on several aspects of such set up.
Particularly it's unclear if both variants (with Jenkinsfile & with job html-UI pipeline script) can be triggered via 'notifyCommit' http-query.

Am I miss something?
Can it be that my 'Jenkins' + 'Pipeline Plugin' + 'Git plugin' versions have a bug?
For now I use Jenkins 2.8, Pipeline Plugin 2.4, Git Plugin 3.0.0 .


Kind regards
Alexander Ites

kods...@gmail.com

unread,
Mar 29, 2017, 6:02:05 AM3/29/17
to Jenkins Users
I found this issue to when running Git Plugin 3.1.0, Pipeline Plugin 2.5 - I'm doing checkout inside shared library which runs checkout in a loop according to config. However link git/notifyCommit?url=... gives me response "
No Git consumers using SCM API plugin for"

kods...@gmail.com

unread,
Mar 29, 2017, 7:44:03 AM3/29/17
to Jenkins Users
Actually I got that working - when pipeline completes first time then it will be executed via notifyCommit?url service

Reply all
Reply to author
Forward
0 new messages