Code Monkey home page Code Monkey logo

jenkins-automation's Introduction

jenkins-automation

Repos automated by Jenkins DSL

Jenkins automation is a library of helper functions to make continuous integration and deploment easy.

We use Job DSL to automate. The DSL Master job will watch all listed repositories for changes, and rebuild all jobs defined in those repositories. To create Jenkins jobs for your project, you must create a jenkins.groovy file at the root of your project's primary repository. Then add your project's primary repo to the list of watched repos in your organization's jenkins-automation-private repository.

You should create your jobs using the templates defined in jenkins.groovy.

How it works

This repository defines two types of jobs in jenkins-automation.groovy:

  • A DSL Master job: watches all your project repositories and builds all the jobs defined in those repositories' jenkins.groovy files`
  • A number of template jobs: these templates should be extended by jenkins.groovy files in your project repositories to reduce boilerplate.

Guiding principles

Installation

Required Jenkins Plugins

jenkins-automation-private repository

jenkins-automation is all the tooling to create a continuous integration/deployment process for your organization. You need a way to specify all the projects that should be continuously integrated/deployed. jenkins-automation-private is the repository where you specify all these projects. It contains a single file listing all the projects that should be watched by jenkins. When your organization starts a new project, you add the root repo for the project to the jenkins-automation-private repo. All iteration of the deployment process then occurs in the root project repo owned by the project team, rather than jenkins-automation-private, owned by system engineering.

You will need to create a jenkins-automation-private repository with the following structure:

  - jenkins-automation-private/
    - repositories.yml
    - README.md

repositories.yml should have the following content:

repositories:
    - 'https://github.com/org/project-root-repo1'
    - 'https://github.examplecom/org/project-root-repo2'

README.md should provide organization-specific guidance on how teams can add their project to this repo for continuous integration/delivery.

Job DSL Bootstrap

Once you have created your jenkins-automation-private repo, and installed all the required jenkins plugins, you need to create a "bootstrap" job in Jenkins to create the dsl-master job. Create a free-style job with the following configuration:

  • Project Name: dsl-bootstrap

  • Description: This job needs to run only once to build the dsl-master job.

  • Source Control Management > Git > Repository Url: https://github.com/cfpb/jenkins-automation

  • Build Environment > Inject Environment Variables > Properties Content:

    JENKINS_AUTOMATION_PRIVATE_GIT_URL=https://github.com/<ORG>/jenkins-automation-private.git
    
  • Build > Process Job DSLs > Look on Filesystem > DSL Scripts: jenkins-bootstrap.groovy

Manually run the bootstrap job. This will create the dsl-master job.
The dsl-master job rebuilds dsl-project-builder whenever jenkins-automation or jenkins-automation-private changes. The dsl-project-builder job rebuilds all jobs defined in all jenkins.groovy files whenever any project repository changes.

Using Jenkins Automation

Jenkins Automation (JA) is built around the idea of a "project". A Project contains all the information needed to reproducibly deploy a software system.

In order to create a project, you must define three things:

  1. Source Code - Include the source code in your project repository or specify where to find your source code.
  2. Deployment instructions - Define how to deploy your software to a server or set of servers. We use Ansible for this purpose, but you can use any configuration management solution.
  3. Continuous Integration/Deployment configuration - Define what to test, when builds should fail, etc.

It is important that we open source as much Source Code as possible, while ensuring the security and integrity of our network and systems. It is therefore possible to split a project between two Project Repositories, one public and one private. If others wish to contribute to your open source project, they should be able to stand up a development environment without access to the private project repository. They should be able to stand up a production environment by creating their own private project repository.

In the single repository model, the repository has the following structure:

  • project-repository/
    • jenkins.groovy
    • ansible/ group_vars/ all/ repositories.yml

jenkins-automation's People

Contributors

virtix avatar scotchester avatar imuchnik avatar ooblioob avatar anselmbradford avatar dgreisen-cfpb avatar m3brown avatar amymok avatar contolini avatar marcesher avatar

Watchers

James Cloos avatar

Forkers

dccouncil

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.