GithubHelp home page GithubHelp logo

anton-kasperovich / demo-jenkins-config-as-code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oleg-nenashev/demo-jenkins-config-as-code

0.0 2.0 0.0 48 KB

Demo of Jenkins Configuration-As-Code with Docker and Groovy Hook Scripts

Home Page: https://hub.docker.com/r/onenashev/demo-jenkins-config-as-code/

License: MIT License

Groovy 96.37% Shell 3.63%

demo-jenkins-config-as-code's Introduction

Demo image for Jenkins Configuration-as-Code

Docker Build Status

This demo image shows how to establish full configuration-as-code in Jenkins with Docker, Pipeline, and Groovy Hook Scripts. It brings up environment which can be used to develop Jenkins Pipeline libraries locally and to evaluate Jenkins features like Ownership-Based Security.

โ— Warning! This image is not designed for production use. Use it at your own risk. Prototyping is in progress.

Features

Jenkins container starts with the following features:

Jobs and Folders

  • 3 Folders on the root level: Production, Development, System. Folders offer different permissions to users
  • Production and System folders implicitly load the ci.jenkins.io Pipeline Library
  • Development folder contains sandbox folders where common users can create and test their jobs
  • Each folder contains several reference Pipeline jobs

Nodes:

  • Master node has a restricted access
  • Extra agents with linux label are available from Docker Cloud, powered by Yet Another Docker Plugin
  • Master and agents offer the mvn and jdk8tools

Extra UI Features:

Usage

Run image:

docker run --rm --name ci-jenkins-io-dev -v maven-repo:/root/.m2 -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 onenashev/demo-jenkins-config-as-code

Jenkins will need to connect to the Docker host to run agents. If you use Docker for Mac, use -Dio.jenkins.dev.host and additional socat image for forwarding.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 2376:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock

Developing Pipeline libraries

In the Development folder there is a PipelineLib folder, which allows local building and testing of the library. This folder can be mapped to a local repository in order to develop the library without committing changes:

docker run --rm --name ci-jenkins-io-dev -v maven-repo:/root/.m2 -v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library -v ${MY_OTHER_PIPELINE_LIBS_DIRS}:/var/jenkins_home/pipeline-libs -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000  onenashev/demo-jenkins-config-as-code

Once started, you can just start editing the Pipeline library locally. On every job start the changes will be reflected in the directory without committing anything.

Debugging Master

In order to debug the master, use the -e DEBUG=true -p 5005:5005 when starting the container. Jenkins will be suspended on the startup in such case.

Building images

Agents

Having a local agent build is a prerequisite for using the master for high-speed builds with Maven repository caching. For this purpose there is a custom Dockerfile in the /agent folder.

cd agent && docker build -t onenashev/demo-jenkins-maven-builder .

Master

Build image:

docker build -t onenashev/demo-jenkins-config-as-code .

demo-jenkins-config-as-code's People

Contributors

oleg-nenashev avatar

Watchers

Anton Kasperovich avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.