paint-brush
How to Get Started With Bambooby@terencewong
770 reads
770 reads

How to Get Started With Bamboo

by Terence WongJanuary 6th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Continuous Integration (CI) servers are an important part of the CI/CD process. CI servers take a code repository, build it, and push it to a central location where a Continuous Delivery (CD) tool like Octopus can take over and manage deployments. Bamboo is a CI server developed by Atlassian that automates the building and testing of software applications.
featured image - How to Get Started With Bamboo
Terence Wong HackerNoon profile picture



Continuous Integration (CI) servers are an important part of the CI/CD process. CI servers take a code repository, build it, and push it to a central location where a Continuous Delivery (CD) tool like Octopus can take over and manage deployments.


Bamboo is a CI server developed by Atlassian that automates the building and testing of software applications. If you're beginning your CI/CD journey, it's helpful to begin with a simple use case, with a visible result.


In this post, I show you how to build and push a software artifact where Octopus can take over and deploy it to a target environment.


You learn how to:

  • Install Bamboo on a Windows Server
  • Configure a Bamboo project
  • Configure a Bamboo plan to build and push a Docker container to a container registry
  • Run and view the container image

Getting set up

To follow this post, you need the following software and accounts:

Installing Bamboo on a Windows server

To install Bamboo:

  • Sign up for a free trial which gives you an activation key
  • Run the install executable
  • Set the install location to a directory you can access, such as C:\Users\Username\Documents (note that setting it to the default location of C:\Program files may result in permission errors)
  • Set the Bamboo home directory, and make sure this is a separate directory from the install location with a folder name Bamboo-home


After the install finishes, run the Bamboo server:

  • Open terminal and navigate to the Bamboo installation directory
  • Run bin\start-bamboo.bat
  • The server should be started at http://localhost:8085/

Setting up users

In the start-up screen, you're asked to set up an admin account. Fill out the details and store the details in a password manager. If you misplace your password, you need to run through a recovery process.

Agents

Agents are the Workers that execute workloads in Bamboo. Because you installed the pre-requisite technology, you can use the local machine as an agent for testing purposes.


To set up a local agent:

  • In the Bamboo dashboard, go to the settings icon and select Agents
  • Go to Add local agent and give it a name
  • Click Add

Setting up the project and plan

Bamboo organizes your workflow into projects and plans. A project can contain multiple plans and each plan is a process that executes a series of tasks.


To get started, set up your first project and plan:

  • In the home menu, select Create and then Create Plan
  • Fill out the name of your project and plan



On the next screen, check the box that says Link new repository.

Connect to the Octopus underwater app repository

This post uses the Octopus underwater app.

To use this repository:


  • Fork it into your own GitHub account
  • In the password settings of GitHub, use a personal access token to grant Bamboo access to repositories under your GitHub account
  • Select the main branch
  • Test the connection to make sure Bamboo connects to this repository
  • Click Save and continue

Configuring the job

On the Configure Job screen, configure the tasks that the plan runs to execute your job. Bamboo provides a suite of task steps you can select from. These tasks execute a certain step in the CI pathway, such as checkout, build, pull, push.


There's a source code checkout task pre-filled for you. This checks out the linked GitHub repository into Bamboo.


  • Leave the isolated build as Agent environment. This uses the local agent you set up earlier.


First, add the Build Docker task:

  • Click Add Task and search for Docker
  • Set the command to Build a Docker Image
  • Set the repository to be [Your DockerHub Username]/[The tag of your image]
  • Check Use an existing Dockerfile located in context path
  • Click Save


Now, add the Push Docker task:

  • Click on Add task and search for Docker
  • Set the command to Push a Docker Image
  • Set the repository to be [Your DockerHub Username]/[The tag of your image]
  • Check Use the agent's native credentials
  • Click Save
  • Click Create


The plan starts to execute by checking out the code, building the Docker image, and pushing the built image to DockerHub


After it's complete, you see a green tick box to indicate the plan completed successfully.




Navigate to your DockerHub account to confirm the image has been pushed to the repository.

Deploy step

Now the image is on DockerHub, any CD tool can deploy it locally or to a cloud platform. We have guides explaining how to do this for:

To view the application locally:

  • docker pull [Your DockerHub Username]/[The tag of your image]
  • docker run -p 8080:8080 [Your DockerHub Username]/[The tag of your image]
  • Go to http://localhost:8080/



Conclusion

CI servers are an important part of the CI/CD process, and you can use many different CI servers to complete your deployments. Bamboo by Atlassian lets you build and push Docker images to Docker repositories.


In this post, you learned how to install Bamboo and set up a project. This is a simple example to get started, but there are many more ways to use Bamboo.



Also Published Here