CI/CD : Deployment Automation Using Atlassian Bamboo and Gitlab
simple way to deploy apps to production with just one click on bamboo.
As a developer we always want the code that we produce, well tested and can be delivered as soon as possible to user. The process of creating a working software from development to production usually complex but we dont want the complexity done by manual way, we want it hidden and work on background seamlessly.
We often heard a term of deployment pipeline, in a modest way deployment pipeline is an implementation of automating process of software from version control until it come to the hand of users (a working product). To achieve that purpose we need proven tools like Gitlab and Bamboo. Gitlab in one side, control the versioning of the source code. Bamboo on the other hand, help to pipelining the source code to be build and tested automatically and then deployed into production environment with one click. Ok, enough explaining, lets implementing and do the drill.
- repo in Gitlab, in this occassion I use my corporate development gitlab which the url repo address is http://10.35.65.136:12404/rifa/ib-bri.git
- Project in Bamboo, It is a must to create one project to start everything in bamboo
1. Login to Bamboo
login to your bamboo web, in this tutorial I use my corporate bamboo
you will arrive at homepage of bamboo site
1. Create Bamboo Project
click menu create → create project
input the required field in create project page, then click save
we will arrive at the create project result page
hit the “create plan” to go to the next pipeline configuration
2. Create a Plan of Project
the purpose of create plan of project is to initiate the name of build plan, describe the build plan and set the plan reference to a repository (gitlab). So we have arrive at create plan form, we can see the UI on picture below
as you can see above, the build plan succssfully connect to the gitlab repo on http://10.35.65.136:12404/rifa/ib-bri.git, if the “test connection” button resulting connection successful, it means we are ready to combine the bamboo pipeline and gitlab repo. so just hit the configure plan button to start set the tasks for building apps.
3. Environment of the Build Plan
after succesffully create build plan, its time for us to know the environment of the build plan menu. Go to homepage of bamboo, we’ll see list of project and plan. Click “Simulate Bamboo tutorial”, and we will arrive at the summary of the build plan had been done.
So, go to actions → configure plan, and we will learn about the Configuration of “Simulate Bamboo tutorial”.
on this tutorial we will only cover the stages menu. We will only exploring the Default Stage → Default Job, so click it.
on the default job, we will see the default task “Source Code Checkout”, it means the task will checkout the repo into bamboo’s working directory as an artifatcs.
We also need to configure the checkouted file into one group artefacts using “Artifacts” submenu. because we need to move those artifact to the host server using deployment plan menu.
in the beginning, artifact definition is still empty. you can define the artifact by clicking “Create artifact” button.
fill in the name of artifact as BambooIB and the Copy Pattern as **/*, then click “Create” button. Remember, that we will deploy a PHP project so it wil become a very simple deployment plan.
artifact defintion successfully created as we see at the picture above.
now, lets go back to tasks bar. previously we only have one task (source code checkout). If we run the build plan, bamboo will checkout the source code into bamboo’s working directory.
We finish with the build plan, next we move into deployment plan. I remind once again The idea is to :
- checkout the source code from repo (DONE)
- define artefact from checkouted source code (DONE)
- move the artefact to the host server
so far we had been done step number one and number two. The third step is to move the artefact to the host server. To move the artefact, firstly we create deployment project using menu create → create deployment project
name the deployment project “deploy development” and fill in the description field “simulate deployment in development server”. Then choose build plan “Tutorial Bamboo › Simulate Bamboo tutorial” and choose “use the main plan branch”.
Okay we arrive at configuration deployment plan. We can click button “add environment” to create new deployment.
we name the environment as “development” like picture below, then click “create” button. The deployment plan of development environment successfully created, next we need to set detailed step of what to do in deployment development via “set up task button”
sorry…….. this chapter finally incomplete.. please explore by yourself then….
above picture show us the final step, next step we have to run the build plan first, then we allowed to run deployment plan …