groovy

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

How to set a property of a task lazily?

痞子三分冷 提交于 2020-12-15 05:22:56
问题 task task1(type: ProduceFilesTaskType) { outDir = file("$projectDir/some/files") } task task2(type: ConsumeFilesTaskType) { fileList = file("$doSomething.outDir/somefolders/").listFiles().toList() // null pointer exception } I don't have the source of ConsumeFilesTaskType and it requires a List<File> fileList which is produced by task1 . Now because these files don't exist in configuration phase, gradle fails at configuration stage with error Cannot invoke method toList() on null object

How to set a property of a task lazily?

蓝咒 提交于 2020-12-15 05:21:10
问题 task task1(type: ProduceFilesTaskType) { outDir = file("$projectDir/some/files") } task task2(type: ConsumeFilesTaskType) { fileList = file("$doSomething.outDir/somefolders/").listFiles().toList() // null pointer exception } I don't have the source of ConsumeFilesTaskType and it requires a List<File> fileList which is produced by task1 . Now because these files don't exist in configuration phase, gradle fails at configuration stage with error Cannot invoke method toList() on null object

How to create dynamic checkbox parameter in Jenkins pipeline?

↘锁芯ラ 提交于 2020-12-15 04:38:07
问题 I found out how to create input parameters dynamically from this SO answer agent any stages { stage("Release scope") { steps { script { // This list is going to come from a file, and is going to be big. // for example purpose, I am creating a file with 3 items in it. sh "echo \"first\nsecond\nthird\" > ${WORKSPACE}/list" // Load the list into a variable env.LIST = readFile (file: "${WORKSPACE}/list") // Show the select input env.RELEASE_SCOPE = input message: 'User input required', ok:

Jenkins - Passing parameter to groovy function

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-13 03:14:52
问题 I've been trying to call another groovy function with parameters inside my pipeline without any luck. The groovy function I am passing the parameters to consists of a bash script, but this bash script does not recognize the parameter(s) I am passing to it. If however the parameter passed by i defined as a parameters {} in the pipeline, then it works, but I do not want this. PROBLEM: The shell script does not recognize/understand the arguments, the variables are empty, no value.

Jenkins - Passing parameter to groovy function

与世无争的帅哥 提交于 2020-12-13 03:12:35
问题 I've been trying to call another groovy function with parameters inside my pipeline without any luck. The groovy function I am passing the parameters to consists of a bash script, but this bash script does not recognize the parameter(s) I am passing to it. If however the parameter passed by i defined as a parameters {} in the pipeline, then it works, but I do not want this. PROBLEM: The shell script does not recognize/understand the arguments, the variables are empty, no value.

Jenkins - Passing parameter to groovy function

那年仲夏 提交于 2020-12-13 03:12:04
问题 I've been trying to call another groovy function with parameters inside my pipeline without any luck. The groovy function I am passing the parameters to consists of a bash script, but this bash script does not recognize the parameter(s) I am passing to it. If however the parameter passed by i defined as a parameters {} in the pipeline, then it works, but I do not want this. PROBLEM: The shell script does not recognize/understand the arguments, the variables are empty, no value.

Using groovy to parse JSON object in shell scripts for Jenkin

此生再无相见时 提交于 2020-12-12 12:09:26
问题 Say I have a JSON as following: {"id":"1.0.0-6", "version":"1.0.0", "build":6, "tag":"android-v1.0.0-6", "commitHash":"5a78c4665xxxxxxxxxxe1b62c682f84", "dateCreated":"2020-03-02T08:11:29.912Z"} I want to take out the version id from it in Jenkins Groovy file and pass the version id to a JIRA Plugin called XRAY so that it will create a build version as Label in JIRA. stage('Get App version') { steps { container('devicefarm') { steps { sh "LATEST_VERSION=$(curl ${APP_ARTIFACTORY_URL}/${XRAY

Using groovy to parse JSON object in shell scripts for Jenkin

谁说胖子不能爱 提交于 2020-12-12 12:08:24
问题 Say I have a JSON as following: {"id":"1.0.0-6", "version":"1.0.0", "build":6, "tag":"android-v1.0.0-6", "commitHash":"5a78c4665xxxxxxxxxxe1b62c682f84", "dateCreated":"2020-03-02T08:11:29.912Z"} I want to take out the version id from it in Jenkins Groovy file and pass the version id to a JIRA Plugin called XRAY so that it will create a build version as Label in JIRA. stage('Get App version') { steps { container('devicefarm') { steps { sh "LATEST_VERSION=$(curl ${APP_ARTIFACTORY_URL}/${XRAY