Question about code change

38 views
Skip to first unread message

Peter Teichner

unread,
Dec 21, 2016, 5:34:58 AM12/21/16
to Jenkins Users
Hi there,

Is anyone aware of a variable or flag that indicates whether or not there has been a code change on a build? Thanks

Daniel Beck

unread,
Dec 21, 2016, 5:51:14 AM12/21/16
to jenkins...@googlegroups.com
When the SCM changelog isn't empty? Or what are you asking for exactly?

> On 21.12.2016, at 11:34, 'Peter Teichner' via Jenkins Users <jenkins...@googlegroups.com> wrote:
>
> Hi there,
>
> Is anyone aware of a variable or flag that indicates whether or not there has been a code change on a build? Thanks
>
> --
> 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/388691f8-2db5-429b-a535-cf032a045d92%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Peter Teichner

unread,
Dec 21, 2016, 7:11:19 AM12/21/16
to Jenkins Users, m...@beckweb.net
Yeah - ideally at runtime in a pipeline or any other way of determining whether there was a code change or not? I'm aware of a variable which is the build cause - that could be code change but if the build was started by a timer or even manually than the build cause will be different. However I would still like to be able to find out if there was an SCM change. Any ideas?

Richard Ginga

unread,
Dec 21, 2016, 8:49:24 AM12/21/16
to jenkins...@googlegroups.com
Peter, build cause = scm change will tell you. also many scm plugins produce environment variables. Perforce produces P4CHANGES

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1f086a16-7a8b-4d64-86e7-2396878739e3%40googlegroups.com.

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



--
Dick Ginga
Build Engineer

Daniel Beck

unread,
Dec 21, 2016, 8:56:00 AM12/21/16
to Jenkins Users, Peter Teichner

> On 21.12.2016, at 13:11, Peter Teichner <ptei...@googlemail.com> wrote:
>
> Any ideas?

https://github.com/daniel-beck/changelog-environment-plugin could probably do this. Haven't gotten around to actually releasing this unfortunately.

Related discussion in https://issues.jenkins-ci.org/browse/JENKINS-12032

Peter Teichner

unread,
Dec 21, 2016, 9:08:39 AM12/21/16
to Jenkins Users
Hi Richard,

The build cause doesn't work unfortunately because if the I manually start the build the cause is not SCM change. Also P4CHANGES variable is okay - but if one uses Git it won't work. I know that once the build is finished you can query the list of changes from the JSON or XML API. It's nested in the changeSet. Ideally I would like to be able to make a decision in the pipeline to execute or not execute a certain step based on whether or not there has been a change.


On Wednesday, 21 December 2016 13:49:24 UTC, Richard Ginga wrote:
Peter, build cause = scm change will tell you. also many scm plugins produce environment variables. Perforce produces P4CHANGES
On Wed, Dec 21, 2016 at 7:11 AM, 'Peter Teichner' via Jenkins Users <jenkins...@googlegroups.com> wrote:
Yeah - ideally at runtime in a pipeline or any other way of determining whether there was a code change or not? I'm aware of a variable which is the build cause - that could be code change but if the build was started by a timer or even manually than the build cause will be different. However I would still like to be able to find out if there was an SCM change. Any ideas?

On Wednesday, 21 December 2016 10:51:14 UTC, Daniel Beck wrote:
When the SCM changelog isn't empty? Or what are you asking for exactly?

> On 21.12.2016, at 11:34, 'Peter Teichner' via Jenkins Users <jenkins...@googlegroups.com> wrote:
>
> Hi there,
>
> Is anyone aware of a variable or flag that indicates whether or not there has been a code change on a build? Thanks
>
> --
> 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/388691f8-2db5-429b-a535-cf032a045d92%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 jenkinsci-use...@googlegroups.com.

Peter Teichner

unread,
Dec 21, 2016, 9:10:27 AM12/21/16
to Jenkins Users, ptei...@googlemail.com, m...@beckweb.net
Thanks for this - it's not 100% what I'm looking for, but it's close to it. Unfortunately I'm not in a position to install "unreleased" plugins and I think it might not work in the pipeline as code... :/

Eric Pyle

unread,
Dec 21, 2016, 9:48:58 AM12/21/16
to jenkins...@googlegroups.com
If possible, you could save the sha1 as an artifact with each build, and have your pipeline code retrieve it. Then query git in your new build to see whether the current sha1 is different (like 'git rev-parse HEAD').

Eric
--
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.

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

Peter Teichner

unread,
Dec 21, 2016, 10:26:24 AM12/21/16
to Jenkins Users
It's a good idea, but such a long winded way and it's also restricts to GIT - right now we're using Git and Perforce (far from good situation) but I'm surprised to see that there isn't a built in variable for that...
--
Reply all
Reply to author
Forward
0 new messages