- Create custom ansible (v2.2.1) image
- Launch Jenkins from official image
- Link Docker Host as Jenknis slave (ssh)
- Create custom gradle image
- Configure a job to build spring-boot application using gradle image buit in 3
- Configure a job to run just built Spring Boot app with docker-compose
# what version?
$ docker run --rm sbeliakou/ansible:2.2.1 ansible --version
# run playbook from current dir
$ alias ansible-playbook='docker run --rm -v $(pwd):$(pwd) -w $(pwd) sbeliakou/ansible:2.2.1 ansible-playbook -vv'
$ ansible-playbook playbook.yml
Jenkins Docker Pipeline plugin
stage('Run Tests') {
try {
dir('webapp') {
sh "mvn test"
docker.build("sbeliakou/my_container:${env.BUILD_NUMBER}").push()
}
} catch (error) {
} finally {
junit '**/target/surefire-reports/*.xml'
}
}