3

We're running a Jenkins pipeline with multi-branch support on a Git repository. Whenever a new branch is created, a new pipeline instance is spawned automatically for the new branch. So far so good (btw. this is not specific to Jenkins, other CI tools such as Bamboo support that as well).

However, when we're building maven artifacts, those are usually -SNAPSHOT versions and these get deployed to the Artifactory SNAPSHOT repository.

And now it becomes really hard to distinguish these versions

  • branch-1 -> 1.0-SNAPSHOT
  • branch-2 -> 1.0-SNAPSHOT

So I wonder, what is a good approach for dealing with this?

Gerald Mücke
  • 10,724
  • 2
  • 50
  • 67

1 Answers1

2

One way to solve this would be to include the branch name in the version number, like for example:

branch1 → 1.0-branch1.SNAPSHOT

You can get the name of the branch currently being built through the GIT_BRANCH environment variable made available by the Jenkins git plugin.

Enrico Campidoglio
  • 56,676
  • 12
  • 126
  • 154