0

I'm attempting to convert 200+ Jenkins jobs from their current GUI-made configurations to DSL scripts. It's a tedious process and really slow.

Jenkins is running on a Windows 2012 server. The Jenkins version is 1.650 and we are using the Job DSL plugin version 1.51.

We use the diskcheck plugin for all Jenkins jobs and I cannot for the life of me find anywhere online which explains calling this when using the DSL. The API viewer doesn't appear to include this plugin so I presume I need to use the configure block. I haven't had to do this yet for anything but regardless, can find nothing online explaining what this involves.

Does anyone know what I need to do? I just want to the job which is generated to check the disk space before running and to fail if it is below some threshold.

In general the information on using the configure block is pretty useless for someone who hasn't done this before so if anyone knows of any good documentation on this that would be appreciated too.

shaneoh
  • 442
  • 2
  • 8
  • 26
  • Not sure why anyone would downvote this - if you know the answer then help out people who don't. After all, that's the reason this website exists. – shaneoh Nov 16 '16 at 14:39
  • Check the config.xml that is created for the job that has the disc-check. And then try to mimic that with your job_dsl. It is a bit of hassle to start with but is really just to force through it. /config.xml – MaTePe Nov 16 '16 at 17:00

2 Answers2

1
    job('your job') {
        description("")
        configure {
            it / 'buildWrappers' / 'org.jenkinsci.plugin.Diskcheck'(plugin: 'diskcheck@0.30'){
                failOnError('false')
            }
        }
    }
edst
  • 1,074
  • 10
  • 20
0

The diskcheck runs in each job by default, so I didn't need to do anything to make this happen.

I still can't find a way to configure this in the DSL, but in any case it seems in my instance of Jenkins, any new job has the diskcheck selected by default so it's not required.

shaneoh
  • 442
  • 2
  • 8
  • 26