December 3, 2019
Share:

In this guide we'll describe how to create a delivery pipeline that will:
- build a Docker image with a web application
- launch the application in a Docker container
- run Selenium tests with Maven from a separate container
Actions used in this guide:
Pipeline flow chart
On every change to the repository, the pipeline will perform the following tasks:
- Build a Docker image of web application
- Run 3 Docker containers:
- container from the image built in the previous step
- container with a Selenium server
- container with Maven that will run the tests
- Depending on test results, the pipeline will:
- [Passed] Push the image to the Docker registry & run the image on the server
- [Failed] Notify the team via Slack
Pipeline flow
Pipeline configuration
First, we need to authenticate Buddy in the source code repository:
Authenticate Buddy
Next, we add a new pipeline and configure it to run on every push to the master branch:
Add a new pipeline
Actions
Now that we specified the target branch and trigger conditions for the pipeline, it's time to add the actions that will run our tasks.
Build Docker image
On the actions view, look up Build Image in the Docker section.
Build Image Action
Define the Dockerfile and the context if it's different than the directory with the Dockerfile. In our case, it's front
:
Docker Image Setup
Configure Selenium tests with Maven
With the Docker image built and waiting, we need something to run the tests. Look up Maven in the builds & task runners section:
Maven Action
Enter the command that will run the tests, e.g. mvn clean install
:
Run Commands
Now we need to add two microservices in the Services tab. Those are essentially Docker containers attached and linked to the main build container.
The first should be the Selenium service for your type of browser. In this example we'll use Selenium Chrome:
Add Services
Now, click Attach another and select Custom service. Configure it to use the Docker container that we built in the previous step:
Add Custom Service
80
). This way Maven will not start the tests until the application has successfully started.
Configure Selenium details
Once configured, the action will run 3 interlinked containers: Maven, Selenium, and a custom container. In order to make it work, we need to configure the Selenium server to which the tests will connect and the address of the application that will be run.
In our application, we defined them in lines 23 and 30 respectively. The hostnames should reflect those entered in the services of the Maven action:
Selenium TableMain
hostname
can be defined in the pipeline as an environment variables. If a variable is not resolved in runtime, you can use the Find & Replace action that will swap its values.
Push Docker image to registry
If all tests have passed successfully, the image can be pushed to a Docker registry:
Push Image
Buddy has native integrations with Docker Hub, Amazon ECR and Google GCR. You can also push images to your own private registry:
Private Registry
Release application
The image is stored in the registry and ready to be released on the server. With Buddy, you can deploy it to a Kubernetes, Amazon EKS or Azure AKS cluster, or you can simply run docker-compose on your own server.
Kubernetes Options
Notifications
Letting your team know that the tests have failed – or your client that a new version is waiting for review – is key to any software development business, which is basically one continuous build-test-release operation. Buddy natively integrates with the most popular notification services, including Slack, Discord, and Telegram:
Notification Actions

Alexander Kus
Customer Success Manager
With Buddy even the most complicated CI/CD workflows take minutes to create
Sign up for Buddy CI/CD
Start a free trial