jenkins-job-dsl

Groovy script fails to call Slack notification parameter from Jenkins DSL job

。_饼干妹妹 提交于 2020-01-01 18:31:31
问题 I'm attempting to use the Jenkins Job DSL plugin for the first time to create some basic job "templates" before getting into more complex stuff. 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. Ideally what I would like is for the seed job to be parameterised so that when it is being run the user can enter four things: the Job DSL script location, the name of the generated job, a Slack channel for failure notifications

Issues with multibranch pipeline job DSL

孤街浪徒 提交于 2019-12-25 00:19:57
问题 I am having issues with multibranch pipeline for job DSL plugin to automate the creation of multibranch pipeline job. The piece am having issues with is how to let set the path to the Jenkinsfile on the repo. I have looked online for documentation but found nothing to help. I have even tried to get example scripts but multibranch job DSL scripts are rare on the internet. Matter of fact could not find any that has Jenkinsfile set in it jobs.groovy folderName = "${JENKINS_PATH}" folder

groovy job DSL for triggering jenkins based on new release tags

时光总嘲笑我的痴心妄想 提交于 2019-12-24 10:24:31
问题 I came across this setting for jenkins job to trigger jenkins when a new release tag is created on git repo like github but wondering what the equivalent is for groovy jobs DSL script. https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/136740885/Triggering+Jenkins+Based+on+New+Tags Here is also link to same question asked but without the groovy job DSL script version jenkins trigger build if new tag is released How can one know how to write groovy job DSL scripts based on jenkins job

Jenkins Build Pipeline to Publish Applications JAR for Multiple Paths

蹲街弑〆低调 提交于 2019-12-24 08:46:31
问题 I have a repository, where different project owners commit their use-case specific code into their designated sub-directory. You may think of such repo to look something like this: repo_root | |-- proj_1 ------ 1_1_code --> 1_1_code.JAR | |-- 2_1_code --> 2_1_code.JAR | |-- 3_1_code --> 3_1_code.JAR | ... |-- proj_2 ------ 1_2_code --> 1_2_code.JAR | |-- 2_2_code --> 2_2_code.JAR | |-- 3_2_code --> 3_2_code.JAR | ... |-- proj_3 ------ 1_3_code --> 1_3_code.JAR | |-- 2_3_code --> 2_3_code.JAR

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

戏子无情 提交于 2019-12-24 00:38:06
问题 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", closure = null); job("MyJob1"){ disabled(true); } It is working perfectly fine. But, I couldn't find any method to delete another job in jenkins. Please help! Thanks! 回答1: Each instance of the Job Dsl plugin tracks what jobs (and views) it creates.

Jenkins job DSL plugin - hidden parameter

喜欢而已 提交于 2019-12-23 00:26:13
问题 I am using the Jenkins hidden parameter plugin but I cant find the syntax to write it in DSL like I am doing with other parameters. For example: https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.activeChoiceParam Is there any way to reflect hidden parameter in DSL? 回答1: Job DSL has no built-in support for the Hidden Parameter plugin, so it's not mentioned in the API viewer. But it's supported by the Automatically Generated DSL: job('example

How to access list of Jenkins job parameters from within a JobDSL script?

*爱你&永不变心* 提交于 2019-12-22 06:58:44
问题 I would like to save the parameters passed into a JobDSL job. I know I can refer to individual parameters but I would like to make the code generic. How would I access the list of parameters passed to the job? The current code looks something like: final jobParameters = new File('parameters') jobParameters.write(""" |AOEU=${AOEU} |SNTH=${SNTH} """[1..-1].stripMargin().trim()) I would like to be able to get it to look something like: final jobParameters = new File('parameters') jobParameters

Can a single seed job process DSLs from multiple repos?

旧时模样 提交于 2019-12-22 06:44:40
问题 I recently managed to convert several manually-created jobs to DSL scripts (inlined into temporary 'seed' jobs), and was pleasantly surprised how straightforward it was. Now I'd like to get rid of the multiple seed jobs and try to structure things more cleanly. To that end, I created a new jenkins-ci repo and committed all the Groovy DSL scripts to it. Then I created a job-generator Jenkins job that pulls from the jenkins-ci repo and has a single Process Job DSLs step. This step has the Look

How can I set the job timeout using the Jenkins DSL

爷,独闯天下 提交于 2019-12-21 13:15:22
问题 How can I use the Jenkins DSL to set the job timeout to 10 minutes ? From http://job-dsl.herokuapp.com/, I can enter job { name 'ci' description 'Build and test the app.' wrappers { timeout() } } and it generates the following block for the timeout, with a default of 3 minutes. <buildWrappers> <hudson.plugins.build__timeout.BuildTimeoutWrapper> <strategy class='hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy'> <timeoutMinutes>3</timeoutMinutes> </strategy> <operationList><

How can I set the job timeout for all jobs using the Jenkins DSL

做~自己de王妃 提交于 2019-12-13 05:27:55
问题 I read How can I set the job timeout using the Jenkins DSL. That sets the timeout for one job. I want to set it for all jobs, and with slightly different settings: 150%, averaged over 10 jobs, with a max of 30 minutes. According to the relevant job-dsl-plugin documentation I should use this syntax: job('example-3') { wrappers { timeout { elastic(150, 10, 30) failBuild() writeDescription('Build failed due to timeout after {0} minutes') } } } I tested in http://job-dsl.herokuapp.com/ and this