Combining periodic SCM check with building individual commits

8 views
Skip to first unread message

Mark Raynsford

unread,
Aug 28, 2019, 9:14:42 AM8/28/19
to Jenkins Users
Hello.

I use a pretty simple setup for each job. Each of my jobs is a GitHub
project, and I use the "poll SCM" feature with a schedule of "H/53 * *
* *" (in other words, poll randomly roughly hourly). My Jenkins setup
is not externally accessible in any form, so I can't have an external
service notifying my server that something has been updated.

This all works fine, except that now I've started wanting to publish
snapshots and releases automatically from Jenkins builds. This would be
fine, except that Jenkins tends to only build the latest commit that it
sees each SCM polling period, rather than building all of the
individual commits that occurred between this and the last period. This
means that it's possible for it to "miss" a tagged release commit and
just build the latest development snapshot instead.

Is there some way to get it to build all of the individual commits? In
other words, if I've made five commits since the last polling period, I
should see five new jobs scheduled next time the SCM is polled.

--
Mark Raynsford | http://www.io7m.com

Mark Waite

unread,
Aug 28, 2019, 2:22:39 PM8/28/19
to Jenkins Users
You're using a relatively special case.  The git plugin does not support it directly.

You might consider splitting the task into two Jenkins jobs:
  1. Job that takes a SHA-1 as a parameter that should be built, but never polls the repository
  2. Job that detects changes on the remote repository and runs a script that computes the list of changes since the last run, then launches the job defined step 1 with each of the SHA-1 values that have arrived since the last run
Mark Waite

--
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/20190828141416.572bca32%40almond.int.arc7.info.


--
Thanks!
Mark Waite

Mark Raynsford

unread,
Aug 30, 2019, 1:24:24 PM8/30/19
to Mark Waite, jenkins...@googlegroups.com
On 2019-08-28T14:22:12 -0400
Mark Waite <mark.ea...@gmail.com> wrote:

> You're using a relatively special case. The git plugin does not support it
> directly.
>
> You might consider splitting the task into two Jenkins jobs:
>
> 1. Job that takes a SHA-1 as a parameter that should be built, but never
> polls the repository
> 2. Job that detects changes on the remote repository and runs a script
> that computes the list of changes since the last run, then launches the job
> defined step 1 with each of the SHA-1 values that have arrived since the
> last run

That's a shame, I was under the impression that what I was doing was
pretty standard. Launching a second job makes sense though, and will be
useful for other reasons.
Reply all
Reply to author
Forward
0 new messages