How to select the particular repository in bamboo during build? - bamboo

I am new to use the bamboo server. In the application, i have multiple branches, during the build time, it is possible to normal user to select the particular branch to build other than default repository.
Thanks in advance

You can use plan branches to build for specific or all branches. See https://confluence.atlassian.com/display/BAMBOO/Using+plan+branches for more details.

Related

How to override the default plan branch configuration?

Currently we are in the process of migrating our projects from jenkins to bamboo. In this process, I am looking for an option in bamboo plan for a plan branch to be created when a new branch is created in the bitbucket repo and also when pull request is created.
As I see in the branch configuration of a plan, it is possible only to choose one option (new branch or pull request) for plan branch. is there any way where i can choose both options? Can I override the configuration using shell script? our bamboo server is currently running version 6.10.
Bamboo doesn't support multiple options for plan branch creation. What's the reason to have both options?
Before you create PR VCS branch already exists so why option to create plan branch on Bitbucket branch creation is not enough?

How to use one sourceode checkout for all the Bamboo stages?

I am planning to create 4 stages
Source code checkout stages
Build for dev env stages
Build for uat env stages
Build for Prod env stages
Is it possible to use the same source code check out for all the stages? How?
This is actually straight forward:
Define your repository in the Repository tab of the plan configuration
Add a Sourcecode Checkout task for each build job in the plan.
By virtue of the repository definition for the plan, a consistent snapshot at the time the plan was started, will be used for the checkout tasks i.e. they will each fetch the same code.
This is not clearly documented in the Bamboo docs but is discussed here https://answers.atlassian.com/questions/33651/stages-and-artifact-passing
Above answer works, but I think you should not build same branch with all environments. It might be better to use better branching workflow,so that you can easily deploy correct change to required environment.

Allow/deny users from running a build configuration in Teamcity

I have a build chain of 4 build configurations, which correspond to different teams' tasks. The idea behind the configurations is this:
Run the build itself
Move build to staging
QA approved
Release
Each of those configurations have different responsible people. People not responsible for a given configuration should not be allowed to run it.
I know I can define roles on project-level, but here I need to define it on a build configuration-level. Is that possible?
Thanks
You can create subprojects for each configuration and then assign roles corresponding to restrictions.
You can add precondition step to each job where check username and fail step and job if user not allowed to run this job.
I made the second approach in similar case.

Maven best practice for generating artifacts for multiple environments [prod, test, dev] with CI/Hudson support?

I have a project that need to be deployed into multiple environments (prod, test, dev). The main differences mainly consist in configuration properties/files.
My idea was to use profiles and overlays to copy/configure the specialized output. But I'm stuck into if I have to generate multiple artifacts with specialized classifiers (ex: "my-app-1.0-prod.zip/jar", "my-app-1.0-dev.zip/jar") or should I create multiple projects, one project for every environment ?!
Should I use maven-assembly-plugin to generate multiple artifacts for every environment ?
Anyway, I'll need to generate all them at once so it seams that the profiles does not fit ... still puzzled :(
Any hints/examples/links will be more than welcomed.
As a side issue, I'm also wondering how to achieve this in a CI Hudson/Bamboo to generate and deploy these generated artifacts for all the environments, to their proper servers (ex: using SCP Hudson plugin) ?
I prefer to package configuration files separately from the application. This allows you to run the EXACT same application and supply the configuration at run time. It also allows you to generate configuration files after the fact for an environment you didn't know you would need at build time. e.g. CERT
I use the "assembly" tool to zip up each domain's config files into named files.
I would use the version element (like 1.0-SNAPSHOT, 1.0-UAT, 1.0-PROD) and thus tags/branches at the VCS level in combination with profiles (for environments specific things like machines names, user name passwords, etc), to build the various artifacts.
We implemented a m2 plugin to build the final .properties using the following approach:
The common, environment-unaware settings are read from common.properties.
The specific, environment-aware settings are read from dev.properties, test.properties or production.properties, thus overriding default values if necessary.
The final .properties files is written to disk with the Properties instance after reading the files in given order.
Such .properties file is what gets bundled depending on the target environment.
We use profiles to achieve that, but we only have the default profile - which we call "development" profile, and has configuration files on it, and we have a "release" profile, where we don't include the configuration files (so they can be properly configured when the application is installed).
I would use profiles to do it, and I would append the profile in the artifact name if you need to deploy it. I think it is somewhat similar to what Pascal had suggested, only that you will be using profiles and not versions.
PS: Another reason why we have dev/ release profiles only, is that whenever we send something for UAT or PROD, it has been released, so if there is a bug we can track down what the state of the code was when the application was released - it is easier to tag it in SVN than trying to find its state from the commit history.
I had this exact scenario last summer.
I ended up using profiles for each higher environment with classifiers. Default profile was "do no harm" development build. I had a DEV, INT, UAT, QA, and PROD profile.
I ended up defining multiple jobs within Hudson to generate the region specific artifacts.
The one thing I would have done differently was to architect the projects a bit differently so that the region specific build was outside of the modularized main project. That was it would simply pull in the lastest artifacts for each specific build rather than rebuild the entire project for each region.
In fact, when I setup the jobs, the QA and PROD jobs were always setup to build off of a tag. Clearly this is something that you would tailor to your specific workplace rules on deployment.
Try using https://github.com/khmarbaise/multienv-maven-plugin to create one main WAR and one configuration JAR for each environment.

maven build execute svn get

I have a project build that needs to include files from another svn location during the build. I want to execute an svn get and then copy these files to the appropriate folder for the build. Researching this issue it seems I could use ant tasks but I wanted to find out what might be the best approach to take for this build.
You can use the maven-scm-plugin. According to the scm matrix both checkout and update are allowed.
Robert's answer is good, if the project is large though you'll be checking out a lot of content to get e single file.
If you want to get an individual file from SCM, the Maven SCM API allows you to interact directly with an SCM repository to invoke arbitrary goals. In this related answer I provide an example of a custom Mojo that commits a single file, if you implement that mojo and change the command from add to checkout you'll avoid having to checkout the entire project.