jenkins-job-dsl

How to create Jenkins jobs automatically in using JobDSL plugin

隐身守侯 提交于 2021-02-11 17:10:19
问题 I was trying to configure JobDSL plugin in Jenkins to automatically create Jenkins jobs for all repos in my Github account, and tried the following code snippet but it doesn't show any repos using Github API URL, so I found the issue was in authentication. Now I've configured the Github credentials in the Jenkins global configurations. My question is how can I add this credentials in the code snippet to authenticate. def organization = 'mygitorg' repoApi = new URL("https://api.github.com/orgs

How to create Jenkins jobs automatically in using JobDSL plugin

橙三吉。 提交于 2021-02-11 17:05:37
问题 I was trying to configure JobDSL plugin in Jenkins to automatically create Jenkins jobs for all repos in my Github account, and tried the following code snippet but it doesn't show any repos using Github API URL, so I found the issue was in authentication. Now I've configured the Github credentials in the Jenkins global configurations. My question is how can I add this credentials in the code snippet to authenticate. def organization = 'mygitorg' repoApi = new URL("https://api.github.com/orgs

How to append to node created by Jenkins job dsl in same configure block?

痞子三分冷 提交于 2021-02-10 18:49:18
问题 I have some jobDsl that looks like this: multibranchPipelineJob('foo/bar') { branchSources { git { remote('https://github.com/jenkinsci/job-dsl-plugin.git') credentialsId('github-ci') includes('JENKINS-*') } } } which generates the following xml (snippet): <!-- 1. foo/bar --> <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject> <sources class='jenkins.branch.MultiBranchProject$BranchSourceList'> <data> <jenkins.branch.BranchSource> <source class='jenkins.plugins.git

How to append to node created by Jenkins job dsl in same configure block?

我们两清 提交于 2021-02-10 18:48:48
问题 I have some jobDsl that looks like this: multibranchPipelineJob('foo/bar') { branchSources { git { remote('https://github.com/jenkinsci/job-dsl-plugin.git') credentialsId('github-ci') includes('JENKINS-*') } } } which generates the following xml (snippet): <!-- 1. foo/bar --> <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject> <sources class='jenkins.branch.MultiBranchProject$BranchSourceList'> <data> <jenkins.branch.BranchSource> <source class='jenkins.plugins.git

JobDSL - Create a new job if it doesn't exist in Jenkins already

对着背影说爱祢 提交于 2021-01-27 19:00:06
问题 I created this Groovy JobDSLs script to generate a new Jenkins jobs. List screen = [["AAA", "Description" ],["AAA", "Description" ]] for (item in screen) { job(item[0]) { description(item[1]) steps { shell('command ...') } }​ }​ Is there a way how to tell JobDSL plugin to not create a job in the List, if it already exists in Jenkins? I don't want to keep to separate files for generating new jobs. One file for new jobs and one file for all existing jobs. 回答1: If a job definition does not

How to import and run 3rd party Jenkins Plugin's extension DSL (githubPullRequest) with Gradle tool locally?

走远了吗. 提交于 2021-01-01 03:41:11
问题 I'm a newbie at Jenkins job-dsl scripting. I'm working to convert the Jenkins XML configuration to Groovy DSL script using a plugin (https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin) that uses Gradle tool for building the script and running Unit Test locally. However, currently, I'm facing an issue with the extension DSL from a 3rd Party Jenkins Plugin (https://github.com/jenkinsci/ghprb-plugin). triggers { githubPullRequest { orgWhitelist("Test") cron("H/5 * * * *") extensions {

How to import and run 3rd party Jenkins Plugin's extension DSL (githubPullRequest) with Gradle tool locally?

允我心安 提交于 2021-01-01 03:35:33
问题 I'm a newbie at Jenkins job-dsl scripting. I'm working to convert the Jenkins XML configuration to Groovy DSL script using a plugin (https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin) that uses Gradle tool for building the script and running Unit Test locally. However, currently, I'm facing an issue with the extension DSL from a 3rd Party Jenkins Plugin (https://github.com/jenkinsci/ghprb-plugin). triggers { githubPullRequest { orgWhitelist("Test") cron("H/5 * * * *") extensions {

How to import and run 3rd party Jenkins Plugin's extension DSL (githubPullRequest) with Gradle tool locally?

假装没事ソ 提交于 2021-01-01 03:34:46
问题 I'm a newbie at Jenkins job-dsl scripting. I'm working to convert the Jenkins XML configuration to Groovy DSL script using a plugin (https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin) that uses Gradle tool for building the script and running Unit Test locally. However, currently, I'm facing an issue with the extension DSL from a 3rd Party Jenkins Plugin (https://github.com/jenkinsci/ghprb-plugin). triggers { githubPullRequest { orgWhitelist("Test") cron("H/5 * * * *") extensions {

Calling pipelineJob from groovy script returns : java.lang.NoSuchMethodError: No such DSL method 'pipelineJob' found among steps

回眸只為那壹抹淺笑 提交于 2020-12-15 06:24:08
问题 i try to invoke programmatically pipeline using jobDSL pipelineJob method but im getting Even though it does exist as a plugin in Jenkins : java.lang.NoSuchMethodError: No such DSL method 'pipelineJob' found among steps this is what I'm calling : def invoke() { pipelineJob('example') { definition { cps { script(""" pipeline { agent any stages { stage('pipeline from pipelineJob'){ steps{ // script { sh '"Hello from pipelineJob!!!!"' // } } } } } """) } } } } and this called from a simple

Calling pipelineJob from groovy script returns : java.lang.NoSuchMethodError: No such DSL method 'pipelineJob' found among steps

走远了吗. 提交于 2020-12-15 06:24:07
问题 i try to invoke programmatically pipeline using jobDSL pipelineJob method but im getting Even though it does exist as a plugin in Jenkins : java.lang.NoSuchMethodError: No such DSL method 'pipelineJob' found among steps this is what I'm calling : def invoke() { pipelineJob('example') { definition { cps { script(""" pipeline { agent any stages { stage('pipeline from pipelineJob'){ steps{ // script { sh '"Hello from pipelineJob!!!!"' // } } } } } """) } } } } and this called from a simple