git push failing to save updated gradle.build

44 views
Skip to first unread message

Rob Sargent

unread,
Nov 18, 2014, 5:11:58 PM11/18/14
to jenkin...@googlegroups.com
We would like to update the build number in our build.gradle file after each successful build.

Unfortunately it appears that jenkins clone of the git repo does not include the branch block
[branch "master"]
 remote = origin
 merge = refs/heads/master
we find when we do a manual check out.

As such, the 'git push' line in our post build script finishes with
+ git push
Everything up-to-date
 > git tag -l jenkins-jpsgcs-core-51 # timeout=10
 > git tag -a -f -m Jenkins Build #51 jenkins-jpsgcs-core-51-SUCCESS # timeout=10
Finished: SUCCESS
and the central repo is never updated. (The developers do not see an updated build.gradle.)

 

Mark Waite

unread,
Nov 18, 2014, 5:21:50 PM11/18/14
to jenkin...@googlegroups.com
If you're set on having the "git push" inside your build script, couldn't you also use your build script to configure the master branch remote and merge?

Alternately, you could include the setting of the remote into your "git push" command line by adding the "--set-upstream" argument to the push command.

The git plugin includes a git publisher post build action which can push changes for you, if you'd rather use the plugin to perform the push.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks!
Mark Waite

Rob Sargent

unread,
Nov 18, 2014, 6:15:02 PM11/18/14
to jenkin...@googlegroups.com
Thanks Mark,

We would rather use the publisher but that didn't work for us.  We get a clean build but
using GIT_SSH to set credentials 
 > git fetch --tags --progress integrity:/raid2/repository/vcs/jpsgcs/core +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision bcd82722d8351ebb380d41c7ad42faf4a6497dd9 (refs/remotes/origin/master)
. . .
+ /var/lib/jenkins/bin/incrBuildVersion build.gradle
+ mv new.gradle build.gradle
 > git tag -l jenkins-jpsgcs-core-56 # timeout=10
 > git tag -a -f -m Jenkins Build #56 jenkins-jpsgcs-core-56-SUCCESS # timeout=10
Finished: SUCCESS

but the build.gradle file remains unchanged in the git repo.

We checked "Push Only If Success", and "Merge Results" only. Not using "Force Push", Tags, Branches. I don't see a "git push" entry in the console log.

Thanks for your time.  We'll look at rigging the remote etc.

rjs

Mark Waite

unread,
Nov 18, 2014, 6:24:38 PM11/18/14
to jenkin...@googlegroups.com
You may need to add the additional behavior to checkout to a specific local branch (if you're not already doing that).  My git jobs which push are typically using "merge before build" and that specifies a target branch for checkout and merge.

Mark Waite

Kanstantsin Shautsou

unread,
Nov 19, 2014, 9:21:45 AM11/19/14
to jenkin...@googlegroups.com


Rob Sargent, please post issues to issues.jenkins-ci.org

Rob Sargent

unread,
Nov 19, 2014, 11:51:22 AM11/19/14
to jenkin...@googlegroups.com
Roger, wilco.

Really not confident this isn't a configuration mis-step, though having to tell jenkins to tell git to use master branch might be construed as an issue.

rjs
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/T8_kSCB2uws/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages