Trigger from pipeline model definition plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Trigger from pipeline model definition plugin

Tim Downey
Hi all,

I'm using the pipeline model definition plugin (which is great btw!) to specify my pipelines.  I have a question about trigger though.  I'd like to use a poll based trigger instead of cron, but it's not clear on if it is supported.  Can anyone provide any feedback?

Here's the example from the wiki:

pipeline {
    agent any

    triggers
{
        cron
'@daily'
   
}

   
...
}

Instead of cron, I want to poll.  Unless I misunderstand, cron will definitely cause a build daily in the above configuration.  Instead, I'd like to configure Jenkins polling once a day instead.  This is necessary in my situation because push based triggers from my SCM don't actually trigger anything unless the Jenkins job is already set up to poll.  Specifically, I'm talking about what is the 'Poll SCM' build trigger from the gui panel.

I went ahead and tried poll as a trigger, but as you can see, that is not supported.  Supported methods within a triggers closure appear to be:

[Pipeline] End of Pipeline
java.lang.NoSuchMethodError: No such DSL method 'poll' found among steps [VersionNumber, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, envVarsForTool, error, fileExists, getContext, git, input, isUnix, libraryResource, load, mail, milestone, node, parallel, properties, pwd, readFile, readTrusted, retry, script, sh, sleep, sshagent, stage, stash, step, svn, timeout, tool, unarchive, unstash, waitUntil, withContext, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, wrap, writeFile, ws] or symbols [all, always, any, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, choice, choiceParam, clock, cloud, command, configFile, configFileProvider, cron, crumb, defaultView, demand, disableConcurrentBuilds, docker, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobDsl, jobName, junit, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, run, runParam, schedule, scm, scmRetryCount, search, security, shell, slave, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, viewsTabBar, weather, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm]

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2bc83b22-bec6-4dca-97cf-4147d5144364%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trigger from pipeline model definition plugin

Daniel Beck

> On 17.11.2016, at 15:17, Tim Downey <[hidden email]> wrote:
>
> I went ahead and tried poll as a trigger, but as you can see, that is not supported.  Supported methods within a triggers closure appear to be:
>

Should be 'pollSCM' (or 'pollScm'?). Note that the 'cron' trigger which you know works is also not listed.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/32D729E7-BD3C-4C34-B6D5-E016C7EBCFC2%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trigger from pipeline model definition plugin

Tim Downey
Hi Daniel.  Thanks for the suggestion.  I tried pollSCM and pollScm.  Both are unsupported.  The 'cron' trigger is in the list.  Highlighted below.

java.lang.NoSuchMethodError: No such DSL method 'pollScm' found among steps [VersionNumber, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, envVarsForTool, error, fileExists, getContext, git, input, isUnix, libraryResource, load, mail, milestone, node, parallel, properties, pwd, readFile, readTrusted, retry, script, sh, sleep, sshagent, stage, stash, step, svn, timeout, tool, unarchive, unstash, waitUntil, withContext, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, wrap, writeFile, ws] or symbols [all, always, any, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, choice, choiceParam, clock, cloud, command, configFile, configFileProvider, cron, crumb, defaultView, demand, disableConcurrentBuilds, docker, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobDsl, jobName, junit, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, run, runParam, schedule, scm, scmRetryCount, search, security, shell, slave, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, viewsTabBar, weather, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm]

On Thursday, November 17, 2016 at 9:47:07 AM UTC-5, Daniel Beck wrote:

> On 17.11.2016, at 15:17, Tim Downey <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hCTacoBECAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">timothy...@...> wrote:
>
> I went ahead and tried poll as a trigger, but as you can see, that is not supported.  Supported methods within a triggers closure appear to be:
>

Should be 'pollSCM' (or 'pollScm'?). Note that the 'cron' trigger which you know works is also not listed.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e04fbcc4-3c12-4ad3-823a-02c2e4e7a5f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trigger from pipeline model definition plugin

Andrew Bayer
So the symbol on SCMTrigger was originally "scm", which turned out not to work in Pipeline due to overlapping with the auto-generated "scm" global variable. I changed the symbol to "pollScm" as of core Jenkins 2.22, but that means it won't work in Declarative on earlier core versions. In scripted Pipeline, you can use the old $class approach to defining an SCMTrigger (i.e., [$class: 'SCMTrigger', scmpoll_spec: '@daily', ignorePostCommitHooks: true]), but we don't currently allow the $class approach to be used for specifying triggers, parameters, job properties or wrappers in Declarative. 

A.

On Thu, Nov 17, 2016 at 7:12 AM, Tim Downey <[hidden email]> wrote:
Hi Daniel.  Thanks for the suggestion.  I tried pollSCM and pollScm.  Both are unsupported.  The 'cron' trigger is in the list.  Highlighted below.

java.lang.NoSuchMethodError: No such DSL method 'pollScm' found among steps [VersionNumber, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, envVarsForTool, error, fileExists, getContext, git, input, isUnix, libraryResource, load, mail, milestone, node, parallel, properties, pwd, readFile, readTrusted, retry, script, sh, sleep, sshagent, stage, stash, step, svn, timeout, tool, unarchive, unstash, waitUntil, withContext, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, wrap, writeFile, ws] or symbols [all, always, any, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, choice, choiceParam, clock, cloud, command, configFile, configFileProvider, cron, crumb, defaultView, demand, disableConcurrentBuilds, docker, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobDsl, jobName, junit, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, run, runParam, schedule, scm, scmRetryCount, search, security, shell, slave, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, viewsTabBar, weather, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm]

On Thursday, November 17, 2016 at 9:47:07 AM UTC-5, Daniel Beck wrote:

> On 17.11.2016, at 15:17, Tim Downey <[hidden email]> wrote:
>
> I went ahead and tried poll as a trigger, but as you can see, that is not supported.  Supported methods within a triggers closure appear to be:
>

Should be 'pollSCM' (or 'pollScm'?). Note that the 'cron' trigger which you know works is also not listed.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e04fbcc4-3c12-4ad3-823a-02c2e4e7a5f9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPbPdOY%3DVk9ffOH9vE2jDEPsC%3DLFj0EA4J01XsZ-Uqyb9vqs1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trigger from pipeline model definition plugin

Tim Downey
Thanks Andrew.

On Mon, Nov 21, 2016 at 2:24 PM, Andrew Bayer <[hidden email]> wrote:
So the symbol on SCMTrigger was originally "scm", which turned out not to work in Pipeline due to overlapping with the auto-generated "scm" global variable. I changed the symbol to "pollScm" as of core Jenkins 2.22, but that means it won't work in Declarative on earlier core versions. In scripted Pipeline, you can use the old $class approach to defining an SCMTrigger (i.e., [$class: 'SCMTrigger', scmpoll_spec: '@daily', ignorePostCommitHooks: true]), but we don't currently allow the $class approach to be used for specifying triggers, parameters, job properties or wrappers in Declarative. 

A.

On Thu, Nov 17, 2016 at 7:12 AM, Tim Downey <[hidden email]> wrote:
Hi Daniel.  Thanks for the suggestion.  I tried pollSCM and pollScm.  Both are unsupported.  The 'cron' trigger is in the list.  Highlighted below.

java.lang.NoSuchMethodError: No such DSL method 'pollScm' found among steps [VersionNumber, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, envVarsForTool, error, fileExists, getContext, git, input, isUnix, libraryResource, load, mail, milestone, node, parallel, properties, pwd, readFile, readTrusted, retry, script, sh, sleep, sshagent, stage, stash, step, svn, timeout, tool, unarchive, unstash, waitUntil, withContext, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, wrap, writeFile, ws] or symbols [all, always, any, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, choice, choiceParam, clock, cloud, command, configFile, configFileProvider, cron, crumb, defaultView, demand, disableConcurrentBuilds, docker, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobDsl, jobName, junit, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, run, runParam, schedule, scm, scmRetryCount, search, security, shell, slave, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, viewsTabBar, weather, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm]

On Thursday, November 17, 2016 at 9:47:07 AM UTC-5, Daniel Beck wrote:

> On 17.11.2016, at 15:17, Tim Downey <[hidden email]> wrote:
>
> I went ahead and tried poll as a trigger, but as you can see, that is not supported.  Supported methods within a triggers closure appear to be:
>

Should be 'pollSCM' (or 'pollScm'?). Note that the 'cron' trigger which you know works is also not listed.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e04fbcc4-3c12-4ad3-823a-02c2e4e7a5f9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/1j57KpAPzbY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPbPdOY%3DVk9ffOH9vE2jDEPsC%3DLFj0EA4J01XsZ-Uqyb9vqs1w%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJp9yiPi-JvyierNLy%2B8r_eK4gPLJ%3DiGQF3ET8X_L5sbV4RaDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.