Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Latest commit

 

History

History
75 lines (69 loc) · 3.3 KB

README.md

File metadata and controls

75 lines (69 loc) · 3.3 KB

Leveraging Docker on your Build Executor Agents Demo Configuration

This docker-compose config was used for the demonstration portion of the presentation at https://www.slideshare.net/EricSmalling1/docker-based-jenkins-build-agents-78280169

Setup steps:


IMPORTANT SECURITY NOTE - PLEASE READ THE FOLLOWING:

The Jenkins server and executor agent configured below is for quick setup and demonstration purposes only. It is not secure in any way and it is in no way intended that these setup instructions be used in your environments.

Initial/pre-demo setup (do once)

If using a Docker swarm:

  • Run docker stack deploy ci -c swarm.yml
  • Run docker service logs ci_jenkins and copy the Jenkins admin token for the next step.

If using docker-compose (non-swarm):

  • Run docker-compose up and watch for the Jenkins admin token, copy it for next step.

Beginning of demo

This is to show the audience that this is a stock install (If short on time, you can set this up in advance and begin demo at Build demos below)

  1. Point your browser at http://localhost , wait for Jenkins to ask for the admin token and paste in what you copied above.
  2. Choose standard set of plugins
  3. Skip admin user setup, and click "Start using Jenkins"
  4. Go to http://localhost/computer/(master)/configure and change Usage to "Only build jobs with label...", click Save.
  5. Go to http://localhost/configureSecurity/ and set "Access Control->Authorization" to "Anyone can do anything", click Save.
  6. Go to http://localhost/pluginManager/available and select "Self-Organizing Swarm Plug-in Modules", click one of the "Install" options.

## Build demos The intent is to create a few projects, all using Pipeline from Jenkinsfile files inside their repositories. Feel free to use your own or the following 3 examples.

Java/Maven Job setup

  1. Click "Create New Jobs"
  2. Give it a name, choose "Pipeline", click "OK"
  3. Choose Pipeline->Definition: "Pipeline script from SCM"
  1. Click "Build Now"

JavaScript Job setup

  1. Click "Create New Jobs"
  2. Give it a name, choose "Pipeline", click "OK"
  3. Choose Pipeline->Definition: "Pipeline script from SCM"
  1. Click "Build Now"

GoLang Job setup

  1. Click "Create New Jobs"
  2. Give it a name, choose "Pipeline", click "OK"
  3. Choose Pipeline->Definition: "Pipeline script from SCM"
  1. Click "Build Now"

Optional executor-node scaling

If you feel the need, you can add additional executor-nodes via the following (replace the '3' below with the count you want):

  • Swarm:
    • docker service scale ci_executor-node=3
  • Non-Swarm:
    • docker-compose scale executor-node=3

Cleanup

When done, shut down the stack and optionally free up disk space:

  • Swarm:
    • run docker stack rm ci
  • Non-Swarm:
    • run docker-compose stop; (or just hit CTRL-C in the shell where you ran docker-compose up)
    • run docker-compose rm
  • Run rm -rf jenkins_home/* workspace/* to remove the Jenkins server's home directory and executor workspaces.