سؤال

Background

At the company I work for, we develop off the trunk and store releases in branches. Typically, after we release something, we set the next development version to be an increment in the minor version along with the canonical "-SNAPSHOT" suffix. So far so good.

The Problem

Our problem arises when we attempt to apply a "patch version" - the Z in X.Y.Z to a released module. By our rules, releasing a patch version means working off a released version. The Jenkins Artifactory Release Plugin (what we use to manage releasing of artifacts) seems to require a "Next Development Version". But for us, this often makes no sense; there's no dev version for a released artifact - it's released, we just want to patch it. It's worth noting that our patch versions, like any of our other releases, are also stored in new branches. The diagram below helps illustrate the model I've described so far.

--- 0.1.0-SNAPSHOT --- 1.1.0-SNAPSHOT (Development version; trunk)
                    \ 
                     \
           1.0.0 (Release Version)
                       \ 
                        \---1.0.1 (A patch to a released version)

This screenshot of the release plugin's fields may also be helpful: Screenshot of Artifactory Release Plugin

Suffice to say that attempting to not specify a new dev branch results in a mess of errors. But whether I put in an existing branch version, a new branch version, or leave it blank, I always get the same error message:

Error Log

19:40:48.188 [RELEASE] Pushing branch 'RELEASE-BRANCH-dummy-1.7.0' to 'git@bitbucket.org:Inc/dummy.git'
19:40:48.694 ERROR: [RELEASE] Failed on build completion
19:40:48.695 java.io.IOException: Failed to push: Command "git push git@bitbucket.org:Inc/dummy.git refs/heads/RELEASE-BRANCH-dummy-1.7.0" returned status code 1:
19:40:48.695 stdout: 
19:40:48.695 stderr: To git@bitbucket.org:Inc/dummy.git
19:40:48.695  ! [rejected]        RELEASE-BRANCH-dummy-1.7.0 -> RELEASE-BRANCH-dummy-1.7.0 (non-fast-forward)
19:40:48.695 error: failed to push some refs to 'git@bitbucket.org:Inc/dummy.git'
19:40:48.695 hint: Updates were rejected because the tip of your current branch is behind
19:40:48.695 hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
19:40:48.695 hint: before pushing again.
19:40:48.695 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Help for our issue, or a better method for handling this process appreciated.

Edit: Updates

Slav's hint helped me realize that the problem occurs when I try to specify a new development version off a release branch. The plugin tries to create a new branch, but, in the case above, the branch already existed. In other cases, however, I do not want a new development version, for reasons listed in my post. So it's a lose-lose.

هل كانت مفيدة؟

المحلول

Short of modifying the source code of Artifactory Release plugin and rebuilding it with your own requirements, your only other option is write custom branch off in a scripting language.

Problem with plugins is that they are usually restrictive to a certain flow.

BTW FWIW, in our setup a "patch" is committed to the release branch (no special "patched" branch is created). Tags are what keeps track of released versions and branches.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top