Jenkins Artifactory Plugin: Updating to the Latest Snapshot on Git

醉酒当歌 提交于 2019-12-22 10:44:01

问题


When we do a release, both the release artifact and tag are being created as expected. However, the project isn't properly updated to the next (snapshot) version.

An example configuration for the release:

The relevant part of the console log:

[RELEASE] Committing release version on branch 'master'
[RELEASE] Creating tag '1.3.14'
[RELEASE] Pushing branch 'master' to 'ssh://git@git.cloudbees.com/xxx/yyy.git'
[RELEASE] Pushing tag '1.3.14' to 'ssh://git@git.cloudbees.com/xxx/yyy.git'
[RELEASE] Changing POMs to next development version
[RELEASE] Committing next development version on branch 'master'
Finished: SUCCESS

And the project's status in Git, as expected:

$ git pull origin master
From ssh://git.cloudbees.com/xxx/yyy
 * branch            master     -> FETCH_HEAD
Already up-to-date.
$ git show --summary
commit df10d905c24c1cbf8d0b6992ab366ac5dcba470b
Author: CloudBees DEV@Cloud <nobody@cloudbees.com>
Date:   Mon Jul 29 09:04:38 2013 +0000
$ git remote show origin
* remote origin
  Fetch URL: ssh://git@git.cloudbees.com/xxx/yyy.git
  Push  URL: ssh://git@git.cloudbees.com/xxx/yyy.git
  HEAD branch: master

    RELEASED 1.3.14

So it looks like the update to the next snapshot is being committed locally, but isn't being pushed. Is this a bug (I couldn't find a related ticket) or are we doing something wrong?

PS: This problem only happens with Git, Subversion is working fine. Our Artifactory plugin version is 2.1.6, which should be the latest one.


回答1:


SOLUTION: Choose the "Deploy Artifacts to Artifactory" post-build action. This is where the plugin does the missing final git push of the updated POMs, in addition to doing the actual artifact deployment.

WORKAROUND (In case you realy don't want to deploy your artifacts to Artifactory): Add a post-build action of "Git Publisher". I checked "Push Only If Build Succeeds". Then I clicked "Add Branch" and put "master" in the branch to push (because I had master in the git "Checkout to a specific local branch" box, per the plugin config page) and "origin" in the "Target remote name" block. This forced a push of the locally-committed updated POM.

It would be nice if the plugin did the final git push and publish to Artifactory automatically for maven without having to know to select the "Deploy Artifacts to Artifactory" post-build action, like it does for gradle.



来源:https://stackoverflow.com/questions/17921881/jenkins-artifactory-plugin-updating-to-the-latest-snapshot-on-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!