The latest expert opinions, articles, and guides for the Java professional.
3. Automate Artifact Creation with Bamboo
This is a good practice to have, especially when you have multiple developers working on the same branch of code. Each time they make a change, they would need to make sure that their changes reconcile with changes that their team members are making. Doing this by hand is painfully tedious and quite often, you’d end up with an erroneous build.
With automatic artifact creation, developers can continually check-in their code changes while a Continuous Integration (CI) server integrates them into the feature branch, and converts them into testable and deployable deliverables.
If the integration fails, the CI server returns appropriate feedback to the developer with reasons so that they can fix it. Our CI server for this exercise is Bamboo, by Atlassian. Naturally other CI servers like Jenkins, Hudson, TeamCity, CruiseControl or Travis CI would work as well, but in this report we’re exploring Bamboo, namely because it has some advanced features out of the box, such as native feature branching. It will pull source code from the GitHub repo and push the builds into Artifactory. You set both these up earlier!
To install Bamboo:
Download Bamboo from Atlassian’s website. Use wget -O <URL>.
Extract and start it:
tar xzf Bamboo TAR.GZ file
run bamboo.sh start
Provide a valid bamboo license. Generate one if required on their website.
Complete the express setup for Bamboo.
Now you can configure your first Bamboo plan. We’re using GitHub as our source code repository and will configure our Bamboo plan to poll for the changes from it.
Then we will create a build task to run a Maven build process.
Enable this plan and we’re done! When we introduce a new commit to the application codebase, it will be picked up and a new version of application will be built. Now we need to store it securely in the repository we created earlier.
Install an Artifactory Bamboo plugin:
Drop it into $BAMBOO_HOME/webapp/WEB-INF/lib folder and restart Bamboo.
Now go to: Administration -> Plugins -> Artifactory Plugin and specify a location of your repository:
Now you can add an artifactory deploy task to the job so the artifact will end up in the repository for future use.
Authors’ Note: Popular belief has it that “Continuous Delivery” means that every commit will end up in your production environment. That is not true; the philosophy of Continuous Delivery is that every stage of the release process is streamlined and automated, not simply throwing everything into production. With appropriate approvals along the way (which often should remain manual within an otherwise automated process flow), the pipeline should have the right checks and balances to guarantee quality, and should not have unnecessary bottlenecks. If the team chooses, they can remove approvals gates and truly have a pipeline that enables them to continuously deploy (i.e. known as Continuous Deployment).
DOWNLOAD THE PDF
Leave a comment