This repository contains all resources about this talk:
-
slides
: sources for AsciiDoc slides -
docs
: public files, slides HTML (assets, html…) -
demo
: docker compose files and doc to run the demo
-
Start the container
$ docker-compose up -d $ open http://localhost:8000
-
Edit slides (
.adoc
files) inslides/src/
-
Save
-
Refresh your browser and enjoy ;)
$ docker network create --driver bridge swf
# Run Sonar
# user: admin
# pwd: admin
$ docker-compose -f demo/sonar/docker-compose.yml up
# Run Jenkins
# user: administrator
# password: password4Admin
$ docker-compose -f demo/jenkins2/docker-compose.yml up
$ open http://localhost:8888
A lot of configuration is loaded by default in the mgreau/jenkins
Docker image, but some configuration have to be done once Jenkins is started.
-
Configure the agent so that it can access the Docker daemon, by configuring the agent startup
-
Go to http://localhost:8888/computer/new to create a new agent
-
Name::
ci-agent
-
Description::
Agent used to execute Build in Docker containers
-
Remote root directory::
jenkins-agents/ci-agent
This is a path to your filesystem (here ~/jenkins-agents/ci-agent). You can set an absolute path.
-
Labels::
ci-docker
-
Launch method::
Launch slave agents on Unix machines via SSH
-
Host::
Your IP (no 127.0.0.1 neither localhost)
-
Credentials:: Add new credentials with your username/pwd
-
Advanced > Prefix Start Slave Command::
source ~/.bash_profile &&
❗Required so that Jenkins can load your PATH to be able to access the docker binary
-
-
-
In order to receive builds status by email, you need to configure, got to Extended E-mail Notification Configuration
SMTP server |
smtp |
SMTP Port |
1025 |
Charset |
UTF-8 |
📎
|
If you don’t do it, the pipeline will failed at the last step, but other steps will be ok. |
❗
|
For simplicity and to avoid polluting real mailboxes, we use an embedded smtp server called MailHog, which will accept any email to send but won’t relay it to any other smtp server. All sent email will be viewable at http://localhost:8025/ |
By default, a Jenkns Pipeline job is created at http://localhost:8888/job/javaee7-websocket-master-ci/
It will build a Maven Java EE 7 project in a exoplatform/ci:jdk8-maven32
Docker container.+
❗
|
The first time you execute this job, it will failed for security reason. You just have to Approve the Pipeline Script Then you can re-execute the pipeline. |
If you want to customize the Maven Settings file included in each container:
-
Update the Maven configuration file (settings.xml with ID
exo-ci-maven-settings
)-
Go to http://localhost:8888/configfiles/editConfig?id=exo-ci-maven-settings
-
Update the Maven XML config file with your configuration
-
-
Create a new job
-
Name::
-
Type:: pipeline
-
-
Submit
-
Configure
-
Pipeline script
-
@Library('github.com/mgreau/exo-pipeline-library@master') // (1) import exoCI // (2) node('ci-docker'){ exoCI{ gitUrl = 'https://github.com/mgreau/javaee7-websocket.git' gitBranch = 'master' dockerImage = 'exoplatform/ci:jdk8-maven32' mavenGoals = 'clean package' } }
-
This library is initialized in the default
mgreau/jenkins2
Docker image, so this line is not mandatory -
The functions are automatically loaded in the default
mgreau/jenkins2
Docker image, so this line is not mandatory