jenkins-job-dsl

How do I run a Jenkins job where user can enter a date value?

安稳与你 提交于 2019-12-02 01:01:41
I wanted to run a jenkins job by accepting a date field (in format YYYY-MM-DD) from user. I found a link where user can enter a string parameter: job('example') { parameters { stringParam('myParameterName', 'my default stringParam value', 'my description') } } But in string param user can enter any thing. So how do I force user to enter a date field like a calender field and select date from the calender ? daspilker There seems to be no plugin which provides a date chooser. But you can use the Validating String Parameter Plugin , which can use a regular expression to validate a string

Using Jenkins Job-DSL Configure block to place custom steps in particular positions

女生的网名这么多〃 提交于 2019-11-30 07:23:00
Using the job-dsl-plugin I am attempting to script the configuration of a fair number of Jenkins jobs which have previously been configured manually. One flavour of these jobs has multiple steps including a couple which use the XShell plugin, this is not directly supported by job-dsl. However I should be able to get around that by using a custom "configure" block. Using the "Job DSL playground" at http://job-dsl.herokuapp.com/ I've got as far as: job { name 'my-job' jdk('JDK-17') steps { configure { node -> node / builders { 'hudson.plugins.xshell.XShellBuilder'(plugin: 'xshell@0.9') {

Job DSL to create “Pipeline” type job

徘徊边缘 提交于 2019-11-30 04:42:47
I have installed Pipeline Plugin which used to be called as Workflow Plugin earlier. https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin I want to know how can i use Job Dsl to create and configure a job which is of type Pipeline You should use pipelineJob : pipelineJob('job-name') { definition { cps { script('logic-here') sandbox() } } } You can define the logic by inlining it: pipelineJob('job-name') { definition { cps { script(''' pipeline { agent any stages { stage('Stage 1') { steps { echo 'logic' } } stage('Stage 2') { steps { echo 'logic' } } } } } '''.stripIndent()) sandbox() }

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

我的未来我决定 提交于 2019-11-29 09:42:59
问题 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 job for processing a Jenkinsfile from SCM. I cannot find the relevant Javadoc for the 2.0 pipeline classes or examples of how to do this. Previously, using Job DSL to create a pipeline, I used a Groovy script to create a FreeStyleProject with an

Using Jenkins Job-DSL Configure block to place custom steps in particular positions

不羁的心 提交于 2019-11-29 09:32:59
问题 Using the job-dsl-plugin I am attempting to script the configuration of a fair number of Jenkins jobs which have previously been configured manually. One flavour of these jobs has multiple steps including a couple which use the XShell plugin, this is not directly supported by job-dsl. However I should be able to get around that by using a custom "configure" block. Using the "Job DSL playground" at http://job-dsl.herokuapp.com/ I've got as far as: job { name 'my-job' jdk('JDK-17') steps {

Job DSL to create “Pipeline” type job

狂风中的少年 提交于 2019-11-28 22:28:47
问题 I have installed Pipeline Plugin which used to be called as Workflow Plugin earlier. https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin I want to know how can i use Job Dsl to create and configure a job which is of type Pipeline 回答1: You should use pipelineJob: pipelineJob('job-name') { definition { cps { script('logic-here') sandbox() } } } You can define the logic by inlining it: pipelineJob('job-name') { definition { cps { script(''' pipeline { agent any stages { stage('Stage 1')