Search code examples
jenkinsmaven-3mule-esbjgitflow-maven-plugin

Issue with parametrising feature builds by amending POM


We are working on mule application, and recently we have been instructed to follow PURE Scrum i.e.git-flow model of branching and development.

Below are the steps we need to follow: 1. For each development task (with assigned JIRA ID ex: JIRA-1234) we need to create different feature branch named with JIRA task ID.

  1. Once development is done, and tested OK in local, we need to push our feature branch to remote repository.

  2. Jenkins build job would poll each feature branch, and builds it if there is any push event identified. After deployment artifact version would be saved to Nexus.

  3. QA would deploy respective feature branch into TEST environment, perform automation/manual testing. If testing is OK, then feature branch would be merged to develop.

  4. At the end of sprint, we would create RELEASE branch from develop branch (which only contains TESTED OK developments for current sprint)

I have a problem in implementing this 100% (of course I am being bit optimistic):

  1. If QA needs to deploy each feature branch into TEST environment using Jenkins job, then there should already have been an artifact saved in Nexus with an unique name (lets say 4.1.0-JIRA-1234-SNAPSHOT). To do so, I need to amend POM.xml file with 4.1.0${JIRA_ID}-SNAPSHOT, and pass JIRA_ID parameter from maven build command. This is possible, but using this POM.xml file we would face issues while creating RELEASE (that's because we use MVN JGITFLOW:RELEASE-START / MVN JGITFLOW:RELEASE-FINISH)

  2. We can give this responsibility to developer - when they create a new feature branch against a JIRA ID, they manually amend the version in POM.xml as 4.1.0-JIRA-1234-SNAPSHOT. This would create artifact in Nexus after feature build, and QA can deploy it into TEST and complete testing. Issue would be while merging where more feature branches can conflict with POM.xml file because of overlapping value.

Please could anyone suggest me the best way to handle such situation, and follow GIT-FLOW process properly?


Solution

  • There is a solution for this problem - add a script into build feature branch jobs. This would read only the feature branch name and append to artifact name.

    Ex: Feature branch name - JIRAID-1234 POM artifact version - 1.1.0-SNAPSHOT

    Jenkins build job would finally generate artifact in nexus with name - 1.1.0-JIRAID-1234-SNAPSHOT

    THIS MAKES EASIER TO SAVE MY PARTICULAR CHANGE AND HELPFUL FOR QA TO DEPLOY AND TEST INDEPENDENTLY