Atlassian has added a continuous integration service as a new feature to their GitHub Cloud product. It’s called GitHub Pipelines and it is similar to Travis CI for GitHub offering a nice integration for continuous integration/delivery pipelines for projects hosted on GitHub.
It’s still in the beta phase and requires a sign-up but nevertheless I’d like to demonstrate the current state of this service and how easy it is to add scripted pipelines to a project.
Activating GitHub Pipelines
Activating pipelines for your GitHub repository is quite simple and Atlassian has provided detailed information in their documentation here.
Basically everything we need to to is ..
-
Sign-up for a beta account as long as GitHub Pipelines are still beta
-
Activate pipelines for your project
-
Provide a configuration file named bitbucket-pipelines.yml
That’s all .. this is what the new pipelines configuration panels look like in your project administration area.
Examples
To get a feeling how easy it is to set-up pipelines for your project, I’m providing two concrete projects with different requirements here.
Vert.x REST Service with rest-assured Integration-Tests using Gradle
For demonstration purpose, I’ve created a small RESTful web-service using Vert.x and I have added a simple integration-test using the rest-assured library.
In addition, I have chosen Gradle as the build tool for this small project here.
Steps
We want GitHub Pipelines to process the following steps each time, a commit is pushed in this project:
-
Create an environment with Java and Gradle installed and configured
-
Check-out our project from GitHub
-
Resolve the dependencies used there (Vert.x, rest-assured, JUnit and so on..)
-
Run the tests
YAML Config File
As Pipelines allow us to load every Docker image we want, our first step is to search DockerHub for images with Java and Gradle installed.
As a result of our search, we’re using the image qlik/gradle here so we’re saving our simple Pipelines configuration in YAML format in a file named bitbucket-pipelines.yml in the project’s root directory:
# using gradle as build tool ..
image: qlik/gradle
pipelines:
default:
- step:
script:
- gradle --version
- gradle test
This is the corresponding view on GitHub:
Pipelines Overview
In the new Pipelines overview all executions of our pipeline runs are displayed and lead to the detail view for each execution.
Pipelines Run Details
In this view, all information for each specific step of our pipeline is displayed in detail and a download of the log-files in a raw-format is possible.
Pipelines Integration in Commits-View
Having pushed some commits to GitHub, we’re also able to see the result of the pipeline run for each commit in the commit overview.
JIRA Plugin running Tests with the Atlassian Plugin SDK
In the next example, I’m adding pipelines to an existing project, my Quick Subtasks Plugin for JIRA.
The tests in this plugin are run using JUnit, but Atlassian’s Plugin SDK is needed to build the project and run the tests here.
Steps
The steps we want run for this project are:
-
Create an environment with Java, Atlassian-Plugin-SDK (Maven) installed
-
Check out our project
-
Resolve dependencies needed (Atlassian’s JIRA API, JUnit and others..)
-
Run the tests
YAML Config File
Again we’re searching DockerHub for an image with the Atlassian Plugin SDK installed and we’re finally using translucent/atlassian-plugin-sdk as our designated Docker image.
image: translucent/atlassian-plugin-sdk
pipelines:
default:
- step:
script:
- atlas-version
- atlas-mvn clean test
This is the corresponding view on GitHub:
Pipelines Overview
Again we see all pipelines run in the overview
Pipelines Run Details
In the Pipelines details we’re able to gather detailed information about the execution of our pipeline’s steps.
Pipelines Integration in Commits-View
And finally an excerpt from the plugin’s commits view with an added pipelines status.
Tutorial Sources
Please feel free to download the tutorial sources from my GitHub repository for the Vert.x example, fork it there or clone it using Git:
git clone https://github.com/hascode/bitbucket-vertx3-pipeline.git