[workflow] SCM polling not working if build never done before?

已查看 113 次
跳至第一个未读帖子

Craig Rodrigues

未读,
2016年1月2日 15:03:512016/1/2
收件人 Jenkins Users
Hi,

I have a workflow script and am using the checkout() function to checkout
a workspace with Subversion:

https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/build-test.groovy#L113

For this workflow, I have enabled SCM polling every 3 hours.
I see this SCM polling log: https://jenkins.freebsd.org/job/FreeBSD_HEAD/scmPollLog/

In the log:

Started on Jan 2, 2016 6:28:36 PM
no previous build to compare to
Done. Took 0 ms
No changes

If no previous build has been done, shouldn't SCM polling trigger a new build instead of bailing?

--
Craig

Daniel Beck

未读,
2016年1月2日 16:08:242016/1/2
收件人 jenkins...@googlegroups.com
Workflows use the previous (completed) build's checkouts to determine what SCMs should participate in polling. Without such a build, it's not known whether there's even an SCM in use. So the option with no previous (completed) build is to never build, or to always build, on polling. And with only these options, this seems like the saner choice -- otherwise a newly created job will build every poll interval (which frequently is much shorter than 3 hours), or never, until a build has been completed -- which, given features like waiting for user input, could well take forever. I expect it is also likely that jobs initially will be triggered once by users manually, so this should never be a big issue, as opposed to the alternative behavior.

Just a guess though.
> --
> 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 jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAG%3DrPVdcwBL5b%3DFZYDLewD6fyN%3D%2Bj661Wgq644u71ps6eqT%2BOw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Craig Rodrigues

未读,
2016年1月2日 16:39:342016/1/2
收件人 Jenkins Users
On Sat, Jan 2, 2016 at 4:08 PM, Daniel Beck <m...@beckweb.net> wrote:
Workflows use the previous (completed) build's checkouts to determine what SCMs should participate in polling. Without such a build, it's not known whether there's even an SCM in use.

If I have a checkout() command directly in the workflow script itself, why can't the workflow detect
that an SCM is in use?  In the checkout() command, there is a parameter poll.  If you set it to poll: True or omit it,
then that SCM is supposed to participate in polling.  If you set poll: False, then that SCM is not supposed to
participate in polling. I omitted it the parameter, because in the workflow snippet generator,
if you  select Include in polling, then it omits the parameter.

So the option with no previous (completed) build is to never build, or to always build, on polling.

Are you sure about that?  How can I configure this behavior?

--
Craig

Daniel Beck

未读,
2016年1月2日 17:23:172016/1/2
收件人 jenkins...@googlegroups.com

On 02.01.2016, at 22:39, Craig Rodrigues <rod...@FreeBSD.org> wrote:

> If I have a checkout() command directly in the workflow script itself, why can't the workflow detect
> that an SCM is in use?

You mean the command that takes a bunch of parameters (including SCM type and URL) whose values may only be known during execution because they may be provided e.g. by build parameters?

It's also entirely possible to checkout repeatedly, in a loop, so the number of executions of the `checkout` command could range from 0 to potentially infinite.

Besides, Groovy is a pretty fancy language, so I wouldn't be surprised if it were actually really difficult to determine whether the `checkout()` that is called actually is the SCM checkout step.

> Are you sure about that? How can I configure this behavior?

You can't, that choice was made for you in the Workflow plugin development. I just explained what choices were possible here AFAICT, and why I believe this one was chosen.

回复全部
回复作者
转发
0 个新帖子