Gating Core

Build Status Contributors Jenkins Plugin GitHub release Jenkins Plugin Installs

Introduction

Pause builds when required infrastructure is not ready for the build to run.

The plugin provides reusable components for Jenkins builds to either wait in queue or pause a Jenkins pipeline when the infrastructure is unavailable. Backend plugins are responsible for submitting the update data, so they can be consumed through this plugin.

Note that this plugin alone does not monitor any resources, nor it pulls resource status from anywhere. It relies on those backend plugins to do so.

Getting started

Install this plugin and necessary backend plugins to read the status information from the sources that you use to track infrastructure health. Once such plugin(s) are configured and start to provide the data to Jenkins Gating, builds can utilize the data.

See what metrics are available to Jenkins Gating at JENKINS_URL/gating/.

Holding builds in queue

Add "Gating requirement" property for your jobs and select which of the resources needs to be up in order for the build to be scheduled. Then everytime the build gets scheduled, it will only leave the queue when all the resources are up.

Configuring via Job DSL

job('my-job') {
  properties {
    requireResources {
      resources(['my-service', 'my-other-service'])
    }
    // ...
  }
  // ...
}

Pausing pipeline execution

Alternatively, part of the build can require certain resources using a pipeline block-step:

// ... pipeline code ...
requireResources(resources: ['my-service', 'my-other-service']) {
  echo 'Executed only when both the services are up'
}
// ... more pipeline code ...

The body of the block will not be executed until the the resources are available.

LICENSE

Licensed under MIT, see LICENSE