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

Jenkins dsl - determine binding when running

I'm a nubie to jenkins dsl. I'm trying to set credentials as an environment variable in order to use it in my fabfile . I first determine the credentials I want to use in a step context, than bind it in a wrapper block. The problem I so was that the…
user2512231
  • 352
  • 2
  • 6
  • 17
0
votes
1 answer

Make Changes only to one repository, in case of Multiple SCM using Job DSL

I am creating a new job in Jenkins by copying a template job. For a template with single repository I am using the below code to change the branches to build section. job('example') { using('template_job') configure { node -> node / scm /…
shwetha
  • 376
  • 4
  • 7
  • 22
0
votes
1 answer

How can I run Maven with debugging output from Job DSL?

How can I configure a Jenkins Maven job to be run with Maven debugging output enabled using Jenkins Job DSL? There is mavenOpts for specifying options to the JVM and properties for specifying Maven properties, but there doesn't seem to be a way for…
Tuure Laurinolli
  • 4,016
  • 1
  • 22
  • 21
0
votes
1 answer

how to read ansible yml config file in groovy

I want to write a DSL job build script for jenkins in groovy which automatically make deploy job for our projects. There is a general yml file for ansible roles and hosts parameter in each project which I want to read it and use its contents to…
Fezo
  • 183
  • 2
  • 14
0
votes
1 answer

How to use EnvInject plugin within Job DSL

I believe that the generated config.xml would look something like below: MAVEN_HOME=/opt/maven/apache-maven-3.2.5 …
meallhour
  • 13,921
  • 21
  • 60
  • 117
0
votes
3 answers

How to create build pipeline in Jenkins?

How to create build pipeline view in Jenkins using Jenkins CLI or through scripting? I would prefer CLI if possible. Right now I create a Bunch of jobs including downstream. So would prefer a way to automate pipeline view.
enthuguy
  • 405
  • 2
  • 8
  • 20
0
votes
1 answer

How to use Job DSL with Accurev SCM?

I am using the following groovy script to create a Job DSL that uses Accurev as SCM. Please let me know how should the correct script look like. job('payer-server') { scm { accurev { /**What to insert here **/ } } triggers { …
meallhour
  • 13,921
  • 21
  • 60
  • 117
0
votes
1 answer

Jenkins Job DSL Plugin - Script Execution Order

When specifying multiple lines of script wildcards to execute (in the DSL Scripts field), does the plugin make any guarantees about the execution order of the scripts? As of release job-dsl-1.43, the execution order has changed (apparently as a…
Daniel
  • 9
  • 3
0
votes
1 answer

How can I generate incremental Maven build in Jenkins Job DSL?

I'm trying to generate what appears in my Jenkins Maven job under Advanced... as Incremental build - only build changed modules This is an XML node that's directly within . I didn't find it in the API, so I thought I'd use…
eerriicc
  • 1,124
  • 4
  • 17
  • 29
0
votes
1 answer

Adding existing Jobs to a MultiJob

The Jenkins Job DSL plugin (version 1.42) allows defining MultiJobs: multiJob('MyMultiJob'){ steps{ phase('First') phaseJob('JobA'){ #job configuration } } } } Is it possible to define…
EightBitBoy
  • 653
  • 6
  • 23
0
votes
2 answers

Jenkins Job DSL: how do you set "Default subview"?

I am trying to create nested tabs with a Jenkins Job DSL Groovy script. It creates them, but I can find no way to set the "Default subview" in the DSL API. It does not appear to display the tabs correctly until I do this. Once I manually, change…
P Solomon
  • 175
  • 1
  • 10
0
votes
2 answers

Jenkins Job DSL Issue

I have created the following groovy script to create a sample job in Jenkins. import hudson.model.* import hudson.node_monitors.* import hudson.slaves.* import java.util.concurrent.* jenkins = Hudson.instance now=Calendar.instance; def project_name…
Achintha Gunasekara
  • 1,165
  • 1
  • 15
  • 29
0
votes
2 answers

Reuse maven step in Jenkins Job DSL

I am using the Job DSL to define a job that requires multiple maven steps to be run. This is an example: def mavenInst = 'maven-3x' job('test') { steps{ maven { mavenInstallation(mavenInst) goals('fuu') } …
Behe
  • 7,572
  • 3
  • 33
  • 46
0
votes
1 answer

Jenkins UI Automation testing

We have the following UI as shown in the image. These parameters are cascaded i.e they are inter-dependent. If you select continent then respective countries will come and then when you select country respective city will come. I want to automate…
0
votes
1 answer

How to execute shell script and update env variable using groovy?

How do I write groovy script that executes simple shell command and update the env variable to a properties file so that it can be used later on by Email-Ext. Here is the shell command that I want to execute using groovy: email_recipients=`cat…
natbrat
  • 31
  • 4