jenkins-pipeline

Jenkins Specify Remote Root Directory which creates “workspace” folder in the folder structure which i dont want

蓝咒 提交于 2021-02-10 17:56:27
问题 I tried searching on different sites but couldn't find answer. My Question is In Jenkins Slave Node, In Remote root directory, I specified -C:\MyJenkinsRun\ and it is creating folder structure as C:\MyJenkinsRun\workspace\Myprojectname Actually I dont want workspace named folder. I just want C:\MyJenkinsRun\Myprojectname. In My Master, it is Not creating workspace named folder. It is creating the way I want which is C:\MyJenkinsRun\Myprojectname. I did many different ways to specify Remote

Jenkins Specify Remote Root Directory which creates “workspace” folder in the folder structure which i dont want

拜拜、爱过 提交于 2021-02-10 17:52:25
问题 I tried searching on different sites but couldn't find answer. My Question is In Jenkins Slave Node, In Remote root directory, I specified -C:\MyJenkinsRun\ and it is creating folder structure as C:\MyJenkinsRun\workspace\Myprojectname Actually I dont want workspace named folder. I just want C:\MyJenkinsRun\Myprojectname. In My Master, it is Not creating workspace named folder. It is creating the way I want which is C:\MyJenkinsRun\Myprojectname. I did many different ways to specify Remote

Check parallel stages status

混江龙づ霸主 提交于 2021-02-10 17:33:25
问题 I have something like this: stages { stage('createTemplate') { parallel { stage('template_a') { creating template a } stage('template_b') { creating template b } } } stage('deployVm') { parallel { stage('deploy_a') { deploy vm a } stage('deploy_b') { deploy vm b } } } } How can I make sure that deployVm stages run when and only when respective createTemplate stages were successful? 回答1: You may want to run one parallel like this: parallel { stage('a') { stages { stage ('template_a') { ... }

Limit Jenkins Git polling to one branch

亡梦爱人 提交于 2021-02-10 15:50:58
问题 Out current Jenkins Pipeline job is setup to build a branch checked out from Git. To do the checkout we use the SCM plugin: triggers { pollSCM scmpoll_spec: '' } checkout( poll: true, scm: [$class: 'GitSCM', branches: [[name: 'refs/heads/develop']], userRemoteConfigs: [ [url: 'https://git-server/repo.git', name: 'origin', refspec: '+refs/heads/develop:refs/remotes/origin/develop', credentialsId: 'XXX'] ], extensions: [ [$class: 'WipeWorkspace'], [$class: 'CloneOption', honorRefspec: true,

Limit Jenkins Git polling to one branch

牧云@^-^@ 提交于 2021-02-10 15:47:32
问题 Out current Jenkins Pipeline job is setup to build a branch checked out from Git. To do the checkout we use the SCM plugin: triggers { pollSCM scmpoll_spec: '' } checkout( poll: true, scm: [$class: 'GitSCM', branches: [[name: 'refs/heads/develop']], userRemoteConfigs: [ [url: 'https://git-server/repo.git', name: 'origin', refspec: '+refs/heads/develop:refs/remotes/origin/develop', credentialsId: 'XXX'] ], extensions: [ [$class: 'WipeWorkspace'], [$class: 'CloneOption', honorRefspec: true,

Overriding default parameter when building one Jenkins pipeline from another

喜欢而已 提交于 2021-02-10 12:39:41
问题 Goal: override a Jenkins Boolean parameter default value (true) with false when I build from another Jenkins script I've check the suggested possible answers from other StackOverflow items; nothing seems to match. They did, however, show me how to use parameters when calling one Jenkins script from another. (Thanks!) I can pass a value of true to a non-default parameter to change its value from false to true. But when I try to pass a value of false to a parameter where I have checked the

Overriding default parameter when building one Jenkins pipeline from another

ぃ、小莉子 提交于 2021-02-10 12:38:20
问题 Goal: override a Jenkins Boolean parameter default value (true) with false when I build from another Jenkins script I've check the suggested possible answers from other StackOverflow items; nothing seems to match. They did, however, show me how to use parameters when calling one Jenkins script from another. (Thanks!) I can pass a value of true to a non-default parameter to change its value from false to true. But when I try to pass a value of false to a parameter where I have checked the

Jenkins Pipeline - java.lang.NoSuchMethodError: No such DSL method 'lock' found among steps

橙三吉。 提交于 2021-02-10 03:16:57
问题 I am using scripted pipeline syntax to create a Jenkins pipeline with the Jenkins version 2.107.1 and I am receiving the following error. java.lang.NoSuchMethodError: No such DSL method 'lock' found among steps at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108) at sun.reflect.GeneratedMethodAccessor1110.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at

Exporting and Importing Jenkins Pipeline script approvals

泄露秘密 提交于 2021-02-09 11:53:09
问题 I have a significant set of Groovy pipeline scripts for our Jenkins build process. I am in the process of moving those scripts onto another instances, and would like to replicate the set of approved scripts that were not originally white listed. Is it possible to export the list of approved signatures and import them into another instance? The only other solution I have is to constantly run and rerun the scripts and approving each signature as it breaks the build. Since the scripts are quite

How to get response code from curl in a jenkinsfile

空扰寡人 提交于 2021-02-09 11:01:12
问题 In a jenkinsfile I call curl with: sh "curl -X POST -i -u admin:admin https://[myhost]" and I get output like this: ... HTTP/1.1 204 No Content Server: Apache-Coyote/1.1 ... I would like to take different actions based on the response code from the above call but how do I store only the response code/reply in a variable? 回答1: By using the parameter -w %{http_code} (from Use HTTP status codes from curl) you can easily get the HTTP response code: int status = sh(script: "curl -sLI -w '%{http