How to create editable parameter based on conditions of another parameter?

2021-08-30 Thread Gajanan Mahajan
For Jenkins pipeline, I've a parameter say `Repository` and second parameter say `Branch`. Based on `Repository` value, I want to auto-populate, value for `Branch`. Let's say - if `Repository` is `BobRepo` then for `Branch` value `BobBranch` is auto populated if `Repository` is `AdamRepo`

How to get failed stage name during parallel run of stages?

2020-10-07 Thread Gajanan Mahajan
I've a pipeline where multiple stages run in parallel but if any of the stages fails, I want to get its name to show failed stage. With following code, even if it fails in first stage ie `Checking Redmine access`, it always show last stage as failed i.e. `Checking Reviewers list`. This is

Why does Jenkins pipeline allows duplicate parameters?

2020-08-14 Thread Gajanan Mahajan
In Jenkins pipeline, one can create parameter with same name twice or more(also with same type). Let's say I've a String Parameter with name `Branch` and again I can create String Parameter with same name i.e. `Branch`. It is duplicated still I can save the pipeline. If you access that

How to get owner of upstream build in downstream build without using parameter?

2020-08-04 Thread Gajanan Mahajan
I have upstream and downstream pipelines and in downstream pipeline, I want to store user, who started upstream build, in downstream build variable. I used following in downstream pipeline but it results into error - `java.lang.NullPointerException: Cannot invoke method getUserId() on null

How to add parameters to existing parameters list?

2020-08-04 Thread Gajanan Mahajan
I get all parameters of a build using - def myparams = currentBuild.rawBuild.getAction(ParametersAction).getParameters() `myparams` is object of `java.util.Collections$UnmodifiableRandomAccessList` hence if try to add another parameter to it like - myparams.add([$class:

How to identify exactly where exception occurred in Jenkins pipeline?

2020-07-30 Thread Gajanan Mahajan
In Jenkins pipeline build, sometimes I've seen null pointer or other exceptions like - java.lang.NullPointerException: Cannot invoke method trim() on null object Generally if we run Java program through IDE or command line, if an exception occurs we see at which line number the exception

How to get console log of current stage?

2020-07-09 Thread Gajanan Mahajan
In Jenkins pipeline, we can get console log of current build with following - String logData = currentBuild.rawBuild.getLog(X) Is there a way to get only log of current stage? -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To

How to enable timeout in pipeline based on a condition?

2020-06-26 Thread Gajanan Mahajan
I've a Jenkins pipeline with following stage - stage('Test') { options { timeout(time: 5, unit: 'MINUTES') } steps { script { //some code here }

How to edit xml files through Jenkins pipeline?

2020-06-22 Thread Gajanan Mahajan
I've to update xml file as a part of pipeline. From following, I've to replace `value` from `true` to false Also, following commented code, I've to uncomment - Both of above snippets can be anywhere in xml file. `sed` utility won't help much here. Could you please suggest

Unable to get value of password parameter into another parameter

2020-06-21 Thread Gajanan Mahajan
In Jenkins pipeline parameter say `Branches` of type `Active Choice Reactive Parameter`, I've to auto-populate branch names hence I've following command, which I can execute in parameter's Groovy script - svn ls --non-interactive --no-auth-cache --trust-server-cert --username --password

How to integrate JSCover in pipeline to get code coverage?

2020-06-17 Thread Gajanan Mahajan
I've a requirement where Jenkins pipeline should be written in such a way that using JSCover after Selenium tests are executed, js code coverage should be generated. I went through http://tntim96.github.io/JSCover/manual/manual.xml for this but I'm not able to collect it to implement what I

Unable to run Selenium tests on CentOS through Xvfb

2020-06-15 Thread Gajanan Mahajan
I'm running Selenium tests on `CentOS 7` machine through Jenkins pipeline hence using `Xvfb`. When use `screen` argument with any valid value like following - wrap([$class: 'Xvfb', autoDisplayName: true, screen: '1440x800x8']) { } It results into following error -

Unable to run Selenium tests on CentOS through Xvfb

2020-06-15 Thread Gajanan Mahajan
I'm running Selenium tests on `CentOS 7` machine through Jenkins pipeline hence using `Xvfb`. When use `screen` argument with any valid value like following - wrap([$class: 'Xvfb', autoDisplayName: true, screen: '1440x800x8']) { } It results into following error -

httpRequest does not return result in parameters's Groovy script

2020-06-15 Thread Gajanan Mahajan
If I make following http request in pipeline code it returns result for `response.status` def response = httpRequest authentication: '', url: '' However if same code is passed to Groovy script of pipeline parameter, it returns nothing and also no error is seen. Please help on how I can

How to get logged in username of Jenkins in parameter's Groovy script?

2020-06-10 Thread Gajanan Mahajan
In Jenkins parameter, I'm writing Groovy script and in that script I need to pass Jenkins logged in username NOT user. User and username, could be different Ex - User, that is displayed left to 'log out', could be - Bob Gill and username, used to login - could be - bob User can be retrieved

Re: Jenkins Pipeline Error

2020-05-08 Thread Gajanan Mahajan
when directive is to execute if stage should be executed or not. You might have when directive at wrong place. Please refer to document for more details - -https://www.jenkins.io/doc/book/pipeline/syntax/#when On Fri, May 8, 2020 at 5:40 PM MANISH JOSHI wrote: > Please help out > >

Jenkins pipeline does not proceed even if Selenium execution finishes

2020-04-21 Thread Gajanan Mahajan
I have a pipeline with stage for Selenium execution where execution of Selenium tests takes around 5 hours. In 'Selenium Execution' stage, I've code to execute Selenium tests then taking backup of results. Here pipeline executes on say `ABC` machine and Selenium stage execution on say `XYZ`

Jenkins pipeline stuck for some of stages which run in parallel

2020-04-08 Thread Gajanan Mahajan
I have a Jenkins pipeline where around 25 stages run in parallel on different nodes. But when those run in parallel and suppose a stage has 10 statements to execute, then I can see only 5(or any number less than 10) statements are executed for some of the stages and stage icon show spinner

Equivalent actions for what Xvfb plugin is doing

2020-02-03 Thread Gajanan Mahajan
I was having problems running Selenium tests through Jenkins on Open SUSE node. I got it working with [Xvfb plugin][1] by installing, configuring plugin on Jenkins server and updating pipeline by wrapping Selenium execution code with - wrap([$class: 'Xvfb', ]) { //Selenium