Skip to content

A Docker configuration for Jenkins. Includes Bats for testing. Traefik and Portainer are included for container management and routing.

License

Notifications You must be signed in to change notification settings

JBris/jenkins-docker-bats-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jenkins-docker-bats-stack

Table of Contents

Introduction

This repo combines Jenkins, Bats, and Docker together to provide a simple example of the CI/CD process. Execute build.sh to get started.

Jenkins

Execute get-plugins.sh to retrieve a list of installed plugins within your Jenkins master instance. You can use make get-plugins to call the script from within the Jenkins container.

Execute sync-plugins.sh to install all the plugins listed within the plugins.txt file. You can use make sync-plugins to call the script from within the Jenkins container.

During your initial installation of Jenkins, execute make init-admin-password to retrieve the initial, autogenerated administrator password. Note that this password will be visible in the shell.

A fairly simple example Jenkins file has been included. This file will execute the battery of tests included in the tests directory. A test results report will be generated using the TAPS plugin.

Docker

The Jenkins container has access to the Docker socket to facilitate communication with the Docker daemon (note that there are security implications in doing this). Both Docker and docker-compose are installed during the Jenkins build process, allowing docker commands to be executed within your Jenkins pipelines.

Bats

The BATS framework has been included for use during unit and integration testing. See the tests directory for some example tests that will be executed during the Jenkins pipeline. tests.bats contains a battery of simple tests to determine if Docker is correctly installed within the Jenkins container. jenkins_helper.bash is a helper bash script that can contain any reusable variables or functions that you may wish to include in your tests.