×
Find plugins

Cachet Gate
1.0.6Minimum Jenkins requirement: 2.62ID: cachet-gating

The Cachet Gate Plugin allows jobs to be gated based on Cachet resource availability.

Change Log

Version 1.0.6 (Feb 21, 2019) 

  • Add missing Operational status to metrics. (#9)

Set Up

Global Configuration

Before the plugin may be used, you must configure the Cachet API URL in the Jenkins global configuration:

init.groovy.d Configuration

You can also specify the following snippet as a Groovy Hook Script

import com.redhat.jenkins.plugins.cachet.GlobalCachetConfiguration
import com.redhat.jenkins.plugins.cachet.ResourceUpdater

def cachetUrl = "https://status.example.com/api/v1/"
GlobalCachetConfiguration gcc = GlobalCachetConfiguration.get();
gcc.setCachetUrl(cachetUrl);
gcc.setIgnoreSSL(true);

ResourceUpdater.setResources();


Gating Jobs

To gate jobs, in the job configuration check the box to confirm resource availability before building and then select the required resource from the list. Note that all selected resources must be available for the job to run.


Below is an example of a build that is blocked or gated:


Job setup using Job DSL

You can also use the job dsl plugin to configure gating for your jobs. Here is an example snippet:

properties {
  cachetJobProperty {
    requiredResources(true)
    resources(["service1", "service2"])
  }
}


Gating metrics

You can use the following snippet to gathering metrics once build has started after being gated:


def metricsMap = cachetgatingmetrics()
if (metricsMap.size() > 0) {
  echo "Semaphore Required Resources Gating Metrics:"
} else {
  echo "This build was not gated by required resources not being available"
}


metricsMap.each{ k, v ->
       echo "- Resource name: ${k}"
       echo "- Status:        ${v.getGatingStatus()}"
       echo "- Elapsed time:  ${v.getGatedTimeElapsed()} ms"
       echo ""
}


ArchivesGet past versions
Labels
This plugin has no labels