bamboobamboo-artifactsbamboo-specsbamboo-bsc

Bamboo - build for branches dynamically given at runtime


Good day. I would need to run the Bamboo plan which will dynamically get the branch at run time . For example , if i run the plan and it should prompt me for branch and lets say if i give feature_1 as my branch name , then it should build the feature_1 .

May i know how to achieve this ??

Thank you.


Solution

  • Bamboo doesn't satisfies this requirement directly. But this is how you can try to achieve same. Check the below steps you need to follow.

    1. In Bamboo build plan configuration, goto variables and add a variable for branch path. This is path of the branch which you want to build. e.g. Feature1, Feature2 branch path. etc

    2. In Plan repository, create SVN repository 'Build Script' and add repository path for common build script. You can use Perl script for this.

    3. Now in bamboo job, create a 'Command' task to execute this Perl script.

    4. When this common build script will gets executed, it will checkout desired branch specified at step 1 in plan variable. You have to use SVN command line to check out the branch.

    5. Post branch checkout, common build script will then call branch specific build script (which was checked out at step 4). Which will then do the job for that specific branch i.e. Compiling code, Packaging etc.

    So whenever you want to take build for any specific feature/brnach, then you just have to change the SVN path for branch path plan variable created at step 1 and run the plan. Thats it.

    Let me know if you need more clarification.

    ~Nilesh