jenkins-plugins

Jenkins Declarative pipeline get build failure cause

微笑、不失礼 提交于 2020-05-17 05:51:30
问题 I recently converted a scripted pipeline into a declarative pipeline but having trouble to get the build failure case in the post section. For a scripted pipeline, I can easily wrap the pipeline inside a try-catch and have access to the exception object. But not for declarative pipeline like this: pipeline { stages { ... } post{ failure { script { //this is where i need the failure exception detail handleFailure() } } } } Im not sure how to do that, I'm trying getContext() method but it

Jenkins Declarative pipeline get build failure cause

耗尽温柔 提交于 2020-05-17 05:51:10
问题 I recently converted a scripted pipeline into a declarative pipeline but having trouble to get the build failure case in the post section. For a scripted pipeline, I can easily wrap the pipeline inside a try-catch and have access to the exception object. But not for declarative pipeline like this: pipeline { stages { ... } post{ failure { script { //this is where i need the failure exception detail handleFailure() } } } } Im not sure how to do that, I'm trying getContext() method but it

How can I have unique build numbers across branches with Jenkins & the Pipeline Multibranch Plugin

醉酒当歌 提交于 2020-05-10 09:40:17
问题 We are using Jenkins Pipeline Multibranch Plugin with Blue Ocean. Through my reading, I believe it is quite common to tie your project's build number to the Jenkins run, as this allows traceability from an installed application through to the CI system, then to the change in source control, and then onto the issue that prompted the change. The problem is that for each branch, the run number begins at 0. For a project with multiple branches, it seems impossible to guarantee a unique build

How can I have unique build numbers across branches with Jenkins & the Pipeline Multibranch Plugin

谁说我不能喝 提交于 2020-05-10 09:38:27
问题 We are using Jenkins Pipeline Multibranch Plugin with Blue Ocean. Through my reading, I believe it is quite common to tie your project's build number to the Jenkins run, as this allows traceability from an installed application through to the CI system, then to the change in source control, and then onto the issue that prompted the change. The problem is that for each branch, the run number begins at 0. For a project with multiple branches, it seems impossible to guarantee a unique build

Can you identify from inside a jenkins pipeline if its the first run of a new branch?

半城伤御伤魂 提交于 2020-04-16 02:38:07
问题 Is it possible to see if a pipeline job is the first run of a newly discovered branch from inside the pipeline itself? If you could get a list of all the runs of a job maybe you could see if there are 0 previous runs and thereby know its the first run? 回答1: Use env.BUILD_NUMBER . env.BUILD_NUMBER == '1' if this is the first build. For newly discovered branches in Multibranch Pipeline (which I assume you use) this will work. 回答2: In case you mean to identify the build number from within the

Jenkins Git plugin: git describe cannot describe anything

不想你离开。 提交于 2020-04-14 02:31:34
问题 I am using the Git Plugin of Jenkins ans use Douglas Creager's get_git_version script. This uses git describe to get some sensible version for python modules. Usually this creates something like 0.1-11-g80fe130 , but on jenkins I get: + git describe fatal: No names found, cannot describe anything. I have configured the plugin not to come up with its own tags through 'skip internal tags'. Doing an extra checkout of the master branch like in this question about pushing from jenkins doesn't help

Jenkins Git plugin: git describe cannot describe anything

别等时光非礼了梦想. 提交于 2020-04-14 02:28:08
问题 I am using the Git Plugin of Jenkins ans use Douglas Creager's get_git_version script. This uses git describe to get some sensible version for python modules. Usually this creates something like 0.1-11-g80fe130 , but on jenkins I get: + git describe fatal: No names found, cannot describe anything. I have configured the plugin not to come up with its own tags through 'skip internal tags'. Doing an extra checkout of the master branch like in this question about pushing from jenkins doesn't help

Multi branch pipeline with bitbucket build status notifier plugin in jenkins

孤者浪人 提交于 2020-04-10 03:44:53
问题 I have a multi branch pipeline job in my jenkins server and I tried to notify the build status using bitbucket cloud build status notifier plugin. I configured the settings provided in notifier plugin and added the notifier script function in the beginning and end of my Jenkinsfile. Jenkinsfile: node { stage 'Build' bitbucketStatusNotify ( buildState: 'INPROGRESS' ) ....... ....... bitbucketStatusNotify ( buildState: 'SUCESS' ) } When I run the jenkins build it trigger the notifier script and

Accessing the BitBucket webhook's payload in Jenkins jobs

不打扰是莪最后的温柔 提交于 2020-03-21 18:06:19
问题 I'm using webhooks on Bitbucket to trigger builds on Jenkins when push event occurs, for this purpose I'm using Bitbucket plugin. My Jenkins pipeline consist of multiple cross depending tasks e.g.: Main pipeline (triggered task) 1) build docker images 2) run tests 3) do something The build is triggered when expected but tasks are failing because they rely on specific branch that I need to provide. Unfortunately I don't know how to access the webhook's payload that have all the information I

I can't find “Restrict where this project can be run” in the configure page

妖精的绣舞 提交于 2020-02-29 10:10:10
问题 I use Jenkins,I can't find "Restrict where this project can be run" in the configure page,should I add some plugins? which one? 回答1: This is because you have not yet added any new nodes to your Jenkins set up. Till then the master(where you have installed Jenkins) is the only available machine where jobs can be run. So there is no need to ask where the job needs to be restricted to be run. Check this link to see how to add a new node to your jenkins setup. Once you add a new node, you will