Add option to modify branch variable overrides

Issue #1 resolved
Robert Dailey created an issue

When incrementing a variable in a plan, add an option to instead modify the same variable on the current branch if the branch overrides that variable. When this option is enabled and the branch does not override the variable being incremented, it should modify the one in the plan.

What currently happens is that the value of the branch variable override is used and incremented but the plan's variable is modified instead of the branch.

Comments (11)

  1. Cintia Del Rio Calvo

    I've already thought about supporting branch variables.

    It shouldn't be that hard, but there might be some corner cases to take care.

  2. Cintia Del Rio Calvo

    Also, just to get the full picture, what's the usecase you are trying to achieve? So I can get more ideas on how to solve it.

  3. Robert Dailey reporter

    We maintain multiple versions of our product. We have a single bamboo plan that is disabled and only uses branches. We have at least 3 plan branches that represent parallel releases. We define two variables in the plan:

    VERSION_BASE
    VERSION_HOTFIX
    

    VERSION_BASE might be a number like 4.2, it's the part of the version on the left side (major.minor) that doesn't change automatically. If we need to change this, we always do it by hand. VERSION_HOTFIX is a single number like 5 (patch; third component). Each plan branch will override the plan's values for these variables (the plan's values are just dummy/placeholder). So our final version number in our build tasks is formed as:

    ${bamboo.VERSION_BASE}.${bamboo.VERSION_HOTFIX}.{bamboo.buildNumber}
    

    so you get something like: 4.2.5.569, that is our final version. I have a manual stage in my plan that I use to tag this release in version control. It also has a task at the very end that uses your plugin to increment VERSION_HOTFIX, so it will become 6 after I run the manual stage (using the example numbers above). The problem is, it is changing VERSION_HOTFIX in the plan instead of in the branch which the jobs & tasks are executed. That means I can't use this to reliable increment versions that have different values across my 3 plan branches for our various production releases.

    I hope my example helps. We're using bamboo 5.7.2

  4. Robert Dailey reporter

    No I don't. And in those cases I'd rather it not increment anything, but I also see value in an option to make the plan variable a fallback.

  5. Cintia Del Rio Calvo

    I started working on this (ISSUE-1 branch), but it won't be probably finished/merged until the end of the week.

  6. Cintia Del Rio Calvo

    Released version 1.1.13 with that option. I'm still trying to find out which corner cases we will find, and if that's the best way to support it.

  7. Log in to comment