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
6
votes
3 answers

git describe --tags does not work on Jenkins pipeline build

I've seen this question which goes in a similar direction but not quite. The problem there was that the tags were simply not pushed correctly. I am currently using Jenkins to build my python projects using setuptools_scm, which basically uses git…
arne
  • 4,514
  • 1
  • 28
  • 47
6
votes
1 answer

Preventing expansion of environment variables in Jenkins job parameters

Problem I am working on a Jenkins job which accepts some parameters from the user. I am encountering an undesired behaviour: Jenkins appears to be expanding environment variables references within the parameter environment variables before my script…
6
votes
1 answer

DSL Seed Job for Multibranch pipeline with Bitbucket branch plugin suppress auto build of branches

Have a DSL job to create multibranch pipeline jobs in jenkins, running Jenkins 2.107.1 with plugins: 'Branch API Plugin' 2.0.18, 'Bitbucket Branch Source Plugin' 2.2.10. I'm unable to find a proper configuration function to enable property to…
6
votes
3 answers

jenkins how to enable checkout lightweight for pipelineJob?

Here is my job DSL which creates pipelinejob in which script is taken from scm itself. pipelineJob ("${jobName}_deploy") { description("built by seed") definition { cpsScm { scm { git { remote { …
ryan1506
  • 175
  • 1
  • 2
  • 17
6
votes
1 answer

Conditional loops in Job DSL

I'm taking the build type i.e either Maven Job or Freestyle job as an input parameter (using the build parameterized plugin) and based on the input condition create the corresponding Job My input parameter: "maven" (to create Maven job) , else block…
Goku
  • 482
  • 1
  • 7
  • 22
6
votes
2 answers

Jenkins: join multiple DSL files in one

I'd like to unify Jenkins job generation process and want to have one single file that I would pass to Process Job DSLs step. So I could vary files that included in current release of DSL. Say I have these…
Misha Slyusarev
  • 1,353
  • 2
  • 18
  • 45
6
votes
1 answer

Migrate from Jenkins Multijob to Pipeline plug-in

Currently we are using Jenkins CI 1.643 (I believe) with the Multijob plugin and Job DSL. A collection of jobs is generated using Job DSL, as well as a multijob that contains all the other jobs in a specific order (build, analysis, unit test,…
Arno Moonen
  • 1,134
  • 2
  • 10
  • 28
6
votes
2 answers

Initializing Jenkins 2.0 with pipeline in init.groovy.d script

For automation, I would like to initialize a Jenkins 2.0 instance with a pipeline job. I want to create a Groovy script that is copied to the /usr/share/jenkins/ref/init.groovy.d/ folder on startup. The script should create a Jenkins 2.0 Pipeline…
6
votes
2 answers

Jenkins xml configuration to Groovy-based Jenkins Job DSL

Could somebody give me a useful link, where I can find information about converting the complex xml configuration for Jenkins jobs? Here is a Jenkins job example: Description
Arthur
  • 1,156
  • 3
  • 20
  • 49
6
votes
3 answers

Can a Job DSL script be tested

Ideally I'd like to be able to invoke the script with some kind of unit test before I have it execute on a Jenkins. Is there any way to test a Job DSL script other than having jenkins run it?
harmingcola
  • 454
  • 6
  • 17
6
votes
1 answer

Using Jenkins Job DSL to set "Polling ignores commits in certain paths" for Git plugin

I have a Jenkins job that uses MultiScm to clone 2 git repositories. During polling, I want it to ignore one of the 2 repos. I can set "Polling ignores commits in certain paths" manually in the configuration to make that work (using ".*" as path to…
tarantoga
  • 1,096
  • 9
  • 19
6
votes
2 answers

How can I delete a job using Job DSL plugin(script) in Jenkins?

I am very new to Jenkins and Job DSL plugin. After a little research, I found how to create a job using DSL and now I am trying to delete a job using DSL. I know to disable a job using this following code: //create new job //freeStyleJob("MyJob1",…
Srijani Ghosh
  • 3,935
  • 7
  • 37
  • 68
6
votes
3 answers

Jenkins DSL Plugin: How to create a job in an existing jenkins View?

I found the following question regarding job creation and adding to a newly created view with the DSL plugin. Adding job to newly created view. How can i add a created job to an existing view with the DSL plugin? I couldn´t find any hint in the…
simon
  • 113
  • 2
  • 9
5
votes
1 answer

Why can't Gradle resolve org.connectbot.jbcrypt:jbcrypt:1.0.0 from the Maven Central Repository?

I'm using Gradle 6.9 and here is my build.gradle file: plugins { id "groovy" id "java" } group "com.matthiasdenu" version "1.0-SNAPSHOT" repositories { mavenCentral() maven { url 'https://repo.jenkins-ci.org/releases/' …
matthiasdenu
  • 323
  • 4
  • 18
5
votes
1 answer

Jenkins Job DSL trigger is deprecated

I am using the Job DSL Jenkins plugin, and I have got a problem regarding the trigger. It is deprecated and when I update the code, then the deprecation warning is still shown. Here the code before: protected def job void nightly(String schedule='H…
1 2
3
56 57