Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jbris/jenkins-docker-bats-stack

A Docker configuration for Jenkins. Includes Bats for testing. Traefik and Portainer are included for container management and routing.
https://github.com/jbris/jenkins-docker-bats-stack

bats cd ci ci-cd docker docker-compose docker-image groovy groovy-language jenkins jenkins-ci jenkins-container jenkins-pipeline jenkinsfile pipelines portainer taps testing testing-framework traefik

Last synced: 26 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# jenkins-docker-bats-stack

## Table of Contents
* [Introduction](#introduction)
* [Jenkins](#jenkins)
* [Docker](#docker)
* [Bats](#bats)

### 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](services/jenkins/scripts/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](services/jenkins/scripts/sync-plugins.sh) to install all the plugins listed within the [plugins.txt](services/jenkins/resources/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](Jenkinsfile) has been included. This file will execute the battery of tests included in the [tests directory](tests). A test results report will be generated using the [TAPS plugin](https://plugins.jenkins.io/tap/).

### 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](tests) for some example tests that will be executed during the Jenkins pipeline. [tests.bats](tests/tests.bats) contains a battery of simple tests to determine if Docker is correctly installed within the Jenkins container. [jenkins_helper.bash](tests/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.