0

I'm trying to configure the Graphite integration plugin for my jobs using Jenkins Job DSL. My block looks like this:

coreJobs = [my jobs here]
coreJobs.each{ a ->
    // some extra job config here
    job("$a") {    
        project / 'publishers' / 'org.jenkinsci.plugins.graphiteIntegrator.GraphitePublisher' {
            selectedIp '192.123.1.456' 
            metrics {
                'org.jenkinsci.plugins.graphiteIntegrator.Metric' {
                queueName ".${a}.BuildFailed"
                name      'BUILD_FAILED' 
                }
            }
        }
    }      
}

Without this graphite declaration it loops through, creating jobs using the jobs declared in $a. But because the graphite dsl requires a "name" parameter the DSL generator just ignores the jobs declared in $a and creates a job called "BUILD_FAILED" !!

So my question is how can I stop the DSL plugin trying to use the "name" parameter as a job name?

Some additional info, I don't think BUILD_FAILED should be a string. I think it's an object but I'm not sure how I would use that here or if it requires different syntax.

Thanks

Glef
  • 363
  • 1
  • 4
  • 12

1 Answers1

1

After Reading the Documentation again I found an example of a conflicting element: https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block

The doc suggests using the ‘delegate variable'. So my Code now uses: delegate.name('BUILD_FAILED')

This now means my jobs are created with the right names and no 'BUILD_FAILED' job is generated.

Glef
  • 363
  • 1
  • 4
  • 12