Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.
Will Paul edited this page Oct 28, 2016 · 18 revisions

Note: This wiki is a work in progress.

Introduction

The jenkins_pipeline_builder gem is designed to help you build jenkins jobs from json or yaml files. These files can (and should) be checked in with the code the are building or deploying. This solves a few problems. First, since all of the job config is stored in version control you can see every change made and easily revert. No more trying to remember what you changed in the job to fix it last time. Second, it means that if your build/deploy process changed and you need to run against an old version you can build the jobs that were stored for that version and run them, then run with your current jobs.

When using the gem there are a few things you need to know. There are two main types of files: project and job files. A project file sets everything up. It declares any dependencies, sets the default values and then lists the jobs that are part of that project. A project file can declare multiple projects that all share the same defaults and dependencies. At its simplest, a job file defines a single job. However, if you have a number of similar jobs (perhaps they run the same commands on different repos, or run at different times) then a single job file can specify both through the use of variables.

Installation and Usage

Setting up to use jenkins_api_client

Example YAML Pipeline

  • Extension types
    • For Jobs and Promotions:
      • Job Attributes (`job_attribute`)
      • Conditional Blocks
    • For Jobs:
      • Builders (`#builder`)
      • Wrappers (`#wrapper`)
      • Triggers (`#trigger`)
      • Publishers (`#publisher`)
    • For Promotions:
      • Promotion Conditions (`#promotion_condition`)
      • Build Steps (`#build_step`)

Creating a project file

Creating views

Writing Extensions

Generate command

Clone this wiki locally