I am using Jenkins, which is the only one allowed to publish to our maven repository, and gradle-release plugin to tag a version and move to new snapshot version. I noticed the tagged version wasn't getting built because the push happens after the new snapshot version is committed -- hence Jenkins builds the new snapshot version and skips the tagged version. Is there a way to configure the gradle-release plugin to first do a push after the tagged version and then do another push for the new snapshot version?
-
Could you explain the flow you want to have a bit more please? In our jenkins jobs we use the release plugin and that 1. Sets the version for the release 2. Run tests and build release – Hillkorn Jan 24 '17 at 09:53
-
Sorry hit enter by accident. Could you explain the flow you want to have a bit more please? In our jenkins jobs we use the release plugin and that 1. Sets the version for the release 2. Run tests and build release 3. Upload artifact 4. Create and push tag 5. Set snapshot version (or next version) 6. Commit and push new version – Hillkorn Jan 24 '17 at 10:00
1 Answers
I looked into the source code of the plugin and installed it locally to see how it works. It turns out that the createReleaseTag
task and commitNewVersion
tasks actually perform separate pushes. I also checked the commits and found that they had different timestamps. I reckon that while our GitLab may have fired two calls to the Jenkins webhook, the short time in between the two commits is insignificant that by the time Jenkins pulls the changes for the one triggered by createReleaseTag
, the newer commit created by commitNewVersion
will have already been pulled along.
The solution I have in my mind now is to either create separate Jenkins jobs for the branches and tags, or to introduce some time delay in between createReleaseTag
and commitNewVersion
.
Update Jan 12, 2017
I settled on using the https://wiki.jenkins-ci.org/display/JENKINS/Release+Plugin where the Jenkins job pulled from both master and develop branches. The Jenkins release plugin added a Release page where the release version and next snapshot version can be inputted and submitted to do the ff:
- Check out master
- Run default job (which should run tests)
- Run release task
- Check out new tagged version
- Run publish task

- 1,123
- 1
- 14
- 21