<

Installing OpenJDK8 on Default Bamboo AMIs

Published on
7,342 Points
1,342 Views
Last Modified:
Approved
Phil Phillips
Execution-focused Full Stack Developer and DevOps Engineer with over 10 years experience in all facets of the software development lifecycle

About Bamboo


Bamboo Cloud is a hosted build and continuous integration service from Atlassian. Bamboo is similar to other continuous integration suites, such as Jenkins and TeamCity. The great thing about Bamboo Cloud is that Atlassian hosts the service for you, so you don't have to worry about provisioning, installing, and maintaining an infrastructure for continuous integration. Bamboo also integrates seamlessly with Jira, Atlassian's issue tracking software.
 

The Bamboo Agent


Bamboo Cloud uses an agent in Amazon’s Elastic Compute Cloud (EC2) to execute the build and deployment steps. Atlassian provides an Amazon Machine Image (AMI) that has all of the Bamboo agent software, as well as common build tools, pre-installed. While the AMI has OpenJDK6 and OpenJDK7 installed, it does not (as of this writing) have OpenJDK8.  This poses a problem for users who want to compile Java code designed to work under the Java 8 specification.  This article is for users who already have a Bamboo configuration, but want to add OpenJDK8 to their build capabilities. To set up Bamboo with OpenJDK8, you will need to:
 

  • Upgrade Amazon Linux within Atassian's AMI to the latest version
  • Install OpenJDK8
  • Create your own AMI
  • Configure Bamboo Cloud to be use your custom AMI
 

Upgrade Amazon Linux within Atlassian's AMI to the latest version


The current Atlassian Bamboo agent image is installed with Amazon Linux 2014.03. To have access to the OpenJDK8 packages, you need to upgrade Amazon Linux to the latest version. SSH into your agent, and open /etc/yum.conf. Find the following line:

releasever=2014.03

Open in new window


Edit it to:

releasever=latest

Open in new window


Now, run the following commands:

sudo yum clean all
sudo yum upgrade
sudo reboot

Open in new window


At this point, your image will be running the latest Amazon Linux version.
 

Install OpenJDK8


Now that your image is upgraded, it now has access to OpenJDK8 packages.  You can run ‘yum list | grep openjdk’ to see the openjdk packages.  You’ll get something like this:

[ec2-user@ip-10-10-0-245 ~]$ yum list | grep openjdk
java-1.7.0-openjdk.x86_64           1:1.7.0.71-2.5.3.1.49.amzn1     @amzn-updates
java-1.6.0-openjdk.x86_64           1:1.6.0.33-67.1.13.5.0.67.amzn1 amzn-updates
java-1.6.0-openjdk-demo.x86_64      1:1.6.0.33-67.1.13.5.0.67.amzn1 amzn-updates
java-1.6.0-openjdk-devel.x86_64     1:1.6.0.33-67.1.13.5.0.67.amzn1 amzn-updates
java-1.6.0-openjdk-javadoc.x86_64   1:1.6.0.33-67.1.13.5.0.67.amzn1 amzn-updates
java-1.6.0-openjdk-src.x86_64       1:1.6.0.33-67.1.13.5.0.67.amzn1 amzn-updates
java-1.7.0-openjdk-demo.x86_64      1:1.7.0.71-2.5.3.1.49.amzn1     amzn-updates
java-1.7.0-openjdk-devel.x86_64     1:1.7.0.71-2.5.3.1.49.amzn1     amzn-updates
java-1.7.0-openjdk-javadoc.noarch   1:1.7.0.71-2.5.3.1.49.amzn1     amzn-updates
java-1.7.0-openjdk-src.x86_64       1:1.7.0.71-2.5.3.1.49.amzn1     amzn-updates
java-1.8.0-openjdk.x86_64           1:1.8.0.25-0.b18.4.amzn1        amzn-updates
java-1.8.0-openjdk-demo.x86_64      1:1.8.0.25-0.b18.4.amzn1        amzn-updates
java-1.8.0-openjdk-devel.x86_64     1:1.8.0.25-0.b18.4.amzn1        amzn-updates
java-1.8.0-openjdk-headless.x86_64  1:1.8.0.25-0.b18.4.amzn1        amzn-updates
java-1.8.0-openjdk-javadoc.noarch   1:1.8.0.25-0.b18.4.amzn1        amzn-updates
java-1.8.0-openjdk-src.x86_64       1:1.8.0.25-0.b18.4.amzn1        amzn-updates

Open in new window

 

The package you want to install is “java-1.8.0-openjdk-devel.x86_64”.  Run the following command to install:

sudo yum install java-1.8.0-openjdk-devel.x86_64

Open in new window


Now, OpenJDK8 is installed on your agent under /usr/lib/jvm/java-1.8.0-openjdk.
 

Create your own AMI


Now that you have OpenJDK8 installed, you will want to make sure that Bamboo can spin up future elastic agent instances with OpenJDK8. To make this happen, you have to create our own AMI. In your EC2 console, find your Bamboo instance. Right click on it and select "Create Image":
bamboo-create-image.png

In the pop-up, enter in a name and description for your new AMI, then click "Create Image":
bamboo-create-image2.png
In a few minutes, your AMI should be available. You can view your AMIs by clicking on "AMIs" on the left nav bar:

bamboo-view-images.png
Make a note of your AMI ID. For example, the AMI ID shown in the screenshot above is 'ami-39d49df9'.

 

Configure Bamboo Cloud to use your custom AMI

 
The last step is to let Bamboo know of your new custom AMI.  In the Bamboo Cloud configuration interface, click on "Image Configurations" found on the left navigation bar.  You can also follow this URL (replace YOURDOMAINHERE with your Atlassian domain): https://YOURDOMAINHERE.atlassian.net/builds/admin/elastic/image/configuration/viewElasticImageConfigurations.action

Fill out the details on the form.  Make sure to put in the AMI ID that you noted earlier.  You can also optionally specifiy a subnet and availability zone:

bamboo-add-image.png
At this point, you will see your new AMI available as an image for new elastic images:
bamboo-list-images.pngYou will now be able to start elastic agents using your custom AMI by clicking on the "Start" button, and your builds will have OpenJDK8 capabilities.
0
Comment
0 Comments

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Join & Write a Comment

Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month