Questions tagged [jenkins-job-dsl]

Jenkins Job-DSL is a Jenkins plugin which enables the creation of Jenkins Jobs using Groovy scripts. It's available in the standard Jenkins plugin list.

For command reference see the Job DSL API Viewer.

Example of DSL script:

job('Hello World') {
  description 'A Simple Job'
  scm {
    github 'pdurbin/maven-hello-world'
  }
  steps {
    maven 'package', 'my-app/pom.xml'
  }
  publishers {
    archiveArtifacts 'build/**/jar'
  }
}

Links

844 questions
0
votes
1 answer

How to handle exceptions in a Jenkins Job DSL seed job?

If I had a Git repository full of Job DSL groovy scripts and a typical seed job e.g.: job('seed') { //... scm, triggers etc. steps { dsl { external 'jobs/**/*.groovy' } } //... more config etc. } what…
Mark McLaren
  • 11,470
  • 2
  • 48
  • 79
0
votes
2 answers

How to set the owner of a Jenkins folder when creating it with a seeder job?

I've written a seeder job using the Job DSL Plugin to create folders with a predefined collection of jobs inside. I also use the Ownership Plugin to control which users get access to each folder. Now I need the user who fired the seeder job to be…
Mig82
  • 4,856
  • 4
  • 40
  • 63
0
votes
1 answer

Jenkins DSL workflow for performing subtraction

I have written a jenkins script where i want build no and previous build no.For that i am performing a subtraction operation. i want to perform a subtraction between two variables in jenkins DSL script. But i am not able to subtract.Ex i want to…
0
votes
1 answer

How to add "single conditional steps" under build section using dsl script

I'm currently trying to develop a DSL script that can create a jenkins job with all required plugins and options. I think I've almost completed all the section. But, I stuck up under build section where I've to include "conditional steps (single)"…
0
votes
0 answers

Generated DSL job configuration gets changed after job is run

I have a DSL script that creates a job. As soon as I run the job the config.xml is changed. Because of this, the job doesn't get an update when I run the seed job again. I suspect some plugins do this. Can you tell me the best way to find out what…
T3rm1
  • 2,299
  • 5
  • 34
  • 51
0
votes
1 answer

Jenkins Job DSL Script For creating a folder creation job

When i run Jenkins Jobs that runs DSL script as a built step to generate folder in jnkins it shows unreferenced Items which contains the job details of previously build of the same job. Is there aby way to get rid of the Unreference Item DSL Script…
Mike
  • 512
  • 3
  • 16
0
votes
1 answer

Jenkins DSL booleanCondition() not returning true even if true is passed

I have two jobs called ParentJob and ChildJob. ParentJob triggers the downstream job ChildJob. From ParentJob i am passing the variable as parameters { predefinedProp('RELEASE','true') } In the ChildJob i am picking the…
Naveen
  • 7,944
  • 12
  • 78
  • 165
0
votes
1 answer

Trying to execute a shell() command in the preBuildSteps of a Jenkins DSL mavenJob

I have done a lot of investigating trying to find examples of running shell() script commands in a preBuildSteps of a mavenJob. All I have found provides simple examples. For example: mavenJob('example-1') { preBuildSteps { shell("echo…
0
votes
1 answer

Substitute variable in an array from another array

Using groovy, how can I substitute the value of an array in another array variable? For eg.: def Env = [ 'Env1', 'Env2', 'Env3' ] def Job = [ [ name: "Job1", label: "<$Env>", action: #!/usr/bin/bash blah …
0
votes
1 answer

seed job does not passes environment variable to groovy dsl script

I am using job-dsl-plugin. In my seed job 'a' I am setting a build environment variable using 'Inject environment variables to the build process' option and providing an environment variable as follows in 'Properties Content'…
0
votes
1 answer

Jenkins job DSL: groovy job change PATH

I'm writing Jenkins job using job DSL. It looks like: job(jobName) { description("This is my Jenkins job.") steps { // Executing some shell here. } scm { // Checking out some branch from Git. } triggers { bitbucketPush() …
smart
  • 1,975
  • 5
  • 26
  • 46
0
votes
2 answers

Jenkins Job DSL - load groovy library from git repo

I want to keep my seed job as small as possible and keep all the logic in a central git repository. Also, I have several independent Jenkins instances that then could share the code. How can I load a groovy library in a Jenkins Job DSL script? Is…
tlo
  • 1,571
  • 1
  • 25
  • 38
0
votes
2 answers

Providing different values in Jenkins dsl configure block to create different jobs

I need my builds to timeout at a specific time (deadline) but currently Jenkins dsl only support the "absolute" strategy. So I tried to write the configure block but couldn't create jobs with different deadline values. def settings = [ [ …
Yuhao Zhang
  • 470
  • 2
  • 4
  • 13
0
votes
1 answer

Incorrect Job configuration for violations plugin using Job DSL

I'm trying to enable the violations and the Checkstyle option only in my "Build Settings" section of my Jenkins job and below is the code snippet : publishers { violations(100) checkstyle('') { } } It works fine but the…
voltas
  • 553
  • 7
  • 24
0
votes
1 answer

How to pass parameters from a pipeline job to a maven job in Jenkins

I have a pipeline job and two Maven jobs as shown below. node { def res stage('Build') { node('rhel6') { res = build job: "Build", parameters: [ …
SalmanKhan
  • 103
  • 1
  • 11