4

I'm working on a Git workflow (not git-flow) for a Java project that uses Maven and Artifactory for artifact storage. On develop and feature/* branches the version number contains '-SNAPSHOT'. It is not desirable to have release/* or master branches with '-SNAPSHOT' so I'm trying to figure out when (and how) to get rid of it.

I came up with a partial workflow, as below, but it doesn't handle removing 'SNAPSHOT':

                v1.0-snap    v1.0-snap
feature/a       * ---------> *
                ^            |
                |            |
                |            v
develop         *            * v1.0-snap
                v1.0-snap    |
                             |
                             v        
release/1.1        v1.0-snap * -----> *
                                    v1.1-snap

I came up with 2 options, but both might be wrong.

Option 1

                v1.0-snap    v1.0-snap
feature/a       * ---------> *
                ^            |
                |            |
                |            v             v1.1-snap
develop         *            * v1.0-snap  *
                v1.0-snap    |           /
                             |          /
                             v         /
release/1.1        v1.0-snap * -----> * v1.1-snap
                                       \
                                        \
                                         \
master                                    * --------> *
                                          v1.1-snap   v1.1

Option 2

                v1.0-snap    v1.0-snap
feature/a       * ---------> *
                ^            |
                |            |
                |            v             v1.1-snap
develop         *            * v1.0-snap  *
                v1.0-snap    |           /
                             |          /
                             v         /
release/1.1        v1.0-snap * -----> * ----- >* v1.1
                                   v1.1-snap    \
                                                 \
                                                  \
master                                             *
                                                  v1.1

Both options seems weird to me, though.

Is there any best practice for this kind of flow?

1
  • How is the version mapped to the release/master branch?
    – gmolaire
    Commented Aug 19, 2018 at 21:54

1 Answer 1

2

I have a similar setup.

For feature/* and develop, I use something like 18.08-SNAPSHOT in my pom. When we're ready to start release hardening, I'll cut a release branch (release/18.08) and change the version in the pom/s to 18.08.

I'll also bump the version on develop to 18.09-SNAPSHOT, for example.

From there, bugfix and finalise the release, merge to master when appropriate.

We're not properly CI/CD yet, but the issue I bumped in to with release builds was that I still needed unique builds in Artifactory. So, at build time (for release branches) Jenkins will change the version in the pom to something like 18.08-326 (326 being build number). It won't commit this change, but the artefact that gets built and pushed to Artifactory will be unique (foobar-18.08-326.war)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.