Skip to content

ion-munteanu-x/jenkins-code

Repository files navigation

rs-jenkins-code

Jenkins Jenkins Code based on DSL plugin and Configuration as Code.

What is rs-jenkins-code?

  • This repo is dedicated for devops/developers who are developing jenkins pipelines and want to keep everything as code including Pipelines and Configuration of Jenkins.
  • This repo is an example of jenkins as code best practices.

How it works?

  • 1) Install required plugins, enumarated here: [Jenkins plugins required]
  • 2) Copy folder init.groovy.d inside your jenkins home. Restart Jenkins.
  • 3) Create a job of type Pipeline named Seed from Jenkins UI with Pipeline script from scm definition specifying this repo.
  • 4) Run Seed job.

Jenkins plugins required:

  • Job DSL
  • Configuration as Code
  • AnsiColor
  • EnvInject API Plugin
  • Environment Injector Plugin
  • user build vars plugin
  • Pipeline Utility Steps
  • Role-based Authorization Strategy
  • Simple Theme Plugin

Jenkins changes required:

  • Add SCM_CLONE_METHOD as Environment variable in Global Properties, can be either `ssh` or `https`
  • Add SCM_SERVER as Environment variable in Global Properties, the format should be `github.com`

Project Structure:

  • config/jenkins.yaml - Configuration of jenkins used by Jenkins Configuration as Code Plugin.
  • jobs - Folder that contains all job interfaces processed by the dsl plugin.
  • jenkinsfiles - Folder that contains all the jenkinsfiles to which job interfaces are delegating work.
  • src - groovy classes used as helpers for the pipelines.
  • vars - util functions.