Re: Build periodically with Parameters support

2017-02-06 Thread Daniel Beck
It's unclear what plugin you're referring to.

> On 06.02.2017, at 23:05, Sam K  wrote:
> 
> Anyone? 
> 
> On Thursday, February 2, 2017 at 3:41:47 PM UTC-8, Sam K wrote:
> I could not find this plugin in the compatibility page here: 
> https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md
> 
> Is there a way I can schedule the same job with different parameters?  I am 
> using a non-declarative job just to kick off my parameterized declarative 
> pipeline each night.  :)
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/e7a1b576-1b52-4599-8ab4-cecd04919f44%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3AB19AFD-7430-42A0-A974-384DC372C7BB%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


Re: User not passing to job history if submitted by URL?

2017-02-06 Thread Daniel Beck

> On 06.02.2017, at 14:41, Don Alcombright  wrote:
> 
> any thoughts on that?

Build token is needed if and only if whoever you authenticate as has permission 
to view, but not build, the job.

Clearly, no authentication happens here, probably because Jenkins doesn't ask 
for it. Read 
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/E9D33C45-E148-4F02-A80F-1FF726A545D4%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


Is there any docker plugin which does not save credentials in the jenkins' slave machine for docker image push

2017-02-06 Thread AYUSH SAHU
Hi,

I don't want to save credentials inside docker.cfg or .docker/config.json in 
the 
jenkins slave for docker push.

Is there any docker plugin which does not save credentials in the slave machine 
for docker image push.


Regards,

Ayush


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b7bd4a1a-e0ce-4fa1-84a1-c5322cd284f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No way to add/remove jobs from a newly created View

2017-02-06 Thread Cary Tsai
Yes, I clicked on the 'MultiJobs'. If I click on the 'List' , the Jobs list 
shows.
Thanks

On Monday, February 6, 2017 at 4:02:18 PM UTC-8, Indra Gunawan (ingunawa) 
wrote:
>
> My view only shows jobs that the user has access to:
>
>  
>
> *My View*
>
>  
>
> This view automatically displays all the jobs that the current user has an 
> access to.
>
>  
>
>  
>
> You probably is thinking about “List View”:
>
>  
>
> *List View*
>
>  
>
> Shows items in a simple list format. You can choose which jobs are to be 
> displayed in which view.
>
>  
>
>  
>
>  
>
> *From: * on behalf of Cary 
> Tsai 
> *Reply-To: *"jenkins...@googlegroups.com " <
> jenkins...@googlegroups.com >
> *Date: *Monday, February 6, 2017 at 2:35 PM
> *To: *Jenkins Users 
> *Subject: *No way to add/remove jobs from a newly created View
>
>  
>
> Jenkins version: 2.32.1 
>
>  
>
> Create a View, click on "Edit View", from the 
>
> http://myJenkins/view/MyView/configure,
>
> I cannot see Jobs list nor "Job Filters" even I install view jobs filter 
> plugin.
>
> Anything I forgot to install/set/configure?
>
> Thanks
>
>  
>
>
> 
>
>  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/71d6660a-61df-4369-9e8c-4898234a8317%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fb9c702b-0bbc-450f-9f78-828d76273b9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No way to add/remove jobs from a newly created View

2017-02-06 Thread Indra Gunawan (ingunawa)
My view only shows jobs that the user has access to:

My View



This view automatically displays all the jobs that the current user has an 
access to.



You probably is thinking about “List View”:

List View



Shows items in a simple list format. You can choose which jobs are to be 
displayed in which view.




From:  on behalf of Cary Tsai 

Reply-To: "jenkinsci-users@googlegroups.com" 
Date: Monday, February 6, 2017 at 2:35 PM
To: Jenkins Users 
Subject: No way to add/remove jobs from a newly created View

Jenkins version: 2.32.1

Create a View, click on "Edit View", from the
http://myJenkins/view/MyView/configure,
I cannot see Jobs list nor "Job Filters" even I install view jobs filter plugin.
Anything I forgot to install/set/configure?
Thanks


[https://lh3.googleusercontent.com/-5gISH9jZbFo/WJj55ZT6ySI/Ds0/549qW0CnarM9v-V0zqmE45nf0_cC8-SPQCLcB/s320/Edit%2BView%2B%2BJenkins%2B.png]

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/71d6660a-61df-4369-9e8c-4898234a8317%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/552E704F-1EC3-4864-A03A-CC31190361D3%40cisco.com.
For more options, visit https://groups.google.com/d/optout.


No way to add/remove jobs from a newly created View

2017-02-06 Thread Cary Tsai
Jenkins version: 2.32.1

Create a View, click on "Edit View", from the 
http://myJenkins/view/MyView/configure,
I cannot see Jobs list nor "Job Filters" even I install view jobs filter 
plugin.
Anything I forgot to install/set/configure?
Thanks



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/71d6660a-61df-4369-9e8c-4898234a8317%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Build periodically with Parameters support

2017-02-06 Thread Sam K
Anyone? 

On Thursday, February 2, 2017 at 3:41:47 PM UTC-8, Sam K wrote:
>
> I could not find this plugin in the compatibility page here: 
> https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md
>
> Is there a way I can schedule the same job with different parameters?  I 
> am using a non-declarative job just to kick off my parameterized 
> declarative pipeline each night.  :)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e7a1b576-1b52-4599-8ab4-cecd04919f44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Serialization error moving @NonCPS method from pipeline script to shared library

2017-02-06 Thread David Karr
I'm trying to move duplicated methods in several pipeline scripts to a 
shared library.  My first attempt, moving an enum type, worked fine.  My 
next test is moving a method annotated with "@NonCPS".  I noticed in the 
doc about writing shared libraries 
(https://jenkins.io/doc/book/pipeline/shared-libraries/), it had the 
following statement:

The Groovy source files in these directories get the same “CPS 
> transformation” as in Scripted Pipeline.


I have no idea what that means, but I suppose it might have some relevant 
to my problem.

The method I'm trying to move is simply this:
@NonCPS
def computeCauseData() {
def result= ""
def causeActions = currentBuild.rawBuild.getAction(hudson.model.
CauseAction)
for (action in causeActions) {
println "action[${action}] displayName[${action.displayName}]"
for (cause in action.causes) {
println "cause[${cause}] 
shortDescription[${cause.shortDescription}]"
result= "${cause.shortDescription}."
if (cause instanceof Cause.LegacyCodeCause) {
}
else if (cause instanceof TimerTrigger.TimerTriggerCause) {
}
else if (cause instanceof Cause.RemoteCause) {
Cause.RemoteCauseremoteCause= (Cause.RemoteCause) 
cause
result= "${cause.shortDescription}: 
Addr[${remoteCause.addr}] Note[${remoteCause.note}]."
}
else if (cause instanceof Cause.UserIdCause) {
}
else if (cause instanceof SCMTrigger.SCMTriggerCause) {
SCMTrigger.SCMTriggerCausescmTriggerCause= (
SCMTrigger.SCMTriggerCause) cause
println "scmTriggerCause[${scmTriggerCause}]"
}
else if (cause instanceof GitStatus.CommitHookCause) {
GitStatus.CommitHookCausecommitHookCause= (GitStatus
.CommitHookCause) cause
Stringsha1= commitHookCause.sha1
println "sha1[${sha1}]"
}
else {

}
}
}

return result
}

This works fine in the pipeline script. When I moved it to my shared 
library (in "vars/computeCauseData.groovy") and commented out the 
definition in the pipeline script, and then ran my test, I got the 
following:

java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector
at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
at 
org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
at 
org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)


In the past, I've avoid serialization errors by nulling out variables 
before they cross a scope. I tried modifying this method, simply nulling 
out everything but "result" right after their last use, and that made no 
difference.  Same error.


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4127571d-0b9a-4d70-85af-a67bf1881a7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Size of ear generated

2017-02-06 Thread Tejinder Kaur Gill
In freestyle job we get the size of ear generated in trends using disk usage 
plugin but not able to get the same in pipeline job ,any specific plugin for 
the same??

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/27de88ef-560c-4f6f-a9ff-1f6fe28b404e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Size of ear generated

2017-02-06 Thread Tejinder Kaur Gill
In freestyle job we get the size of ear generated in trends using disk usage 
plugin but not able to get the same in pipeline job ,any specific plugin for 
the same??

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/09decc31-d10f-44ea-a606-c74622abcd68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to define a Git repository with two remotes in Pipeline DSL?

2017-02-06 Thread 'Marc Rohlfs' via Jenkins Users
Hi Mark,

this does exactly what I need, many thanks. I actually used the "pipeline 
syntax" link, but I was too much focussed on the "git" step instead of 
thinking about the checkout step.

Many thanks,

Marc

On Monday, 6 February 2017 14:32:32 UTC+1, Marc Rohlfs wrote:
>
> Hi there,
>
> how can I define a Git repository with 2 remotes in Pipeline DSL? 
> Unfortunaltely, *Multiple SCMs* don't seem to work for me, because I need 
> a clone that is connected to two remote repositories. I actually need this 
> to implement an automated sync for a vendor branching.
>
> Any ideas?
>
> Many thanks in advance
>
> Marc
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3599724e-33b5-4826-9cba-97de136ba112%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slave hang

2017-02-06 Thread jerome
I called victory way too fast, still can happen, just not as often. The 
fact that the slave can flood the master is a bit annoying, it should wait 
and continue later. Right now the behavior is if this happen, the 
slave/master hang (web gui is still accessible, but impossible to cancel 
the jobs) and I need to restart the Jenkins daemon everyday :-(

Maybe it's impossible to have the jobs folder under a network mount where 
the network can sometime be under heavy usage. This was solving the split 
between the master config and the jobs config/results for backup purpose. 
The master config change at slow pace and we manually backup the whole 
machine when doing update keeping the 2 last in case of problems to quickly 
revert. Jobs on the other hand need to be backup every day in incremental 
way.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/45d23afd-7861-452b-b5ec-dca615d09430%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Job without trigger building constantly because of "SCM change"

2017-02-06 Thread cameronheardithaka
*tl;dr:* make sure your repo doesn't have more than one branch that matches 
your Branch Specifier by using the full path to the branch: 
"refs/heads/master" instead of "origin/master"


Full story:
We were having similar problem with a job in Jenkins 2.19.4.

We would intentionally kick off a particular job, either manually or 
through a scheduled run, and then the job would keep building over and 
over. In fact, a second build would be scheduled just after the first one 
started.

Looking in the console output for the second and subsequent jobs, we saw

Started by an SCM change


as the first line. Odd, we weren't using SCM polling and even if we were, 
we weren't changing the source repo.


Further down in the console output, we saw:

Multiple candidate revisions

Scheduling another build to catch up with <...name_job...>


We were using origin/master as the branch specifier for the job. Turns out, 
our source repo had a branch named "master" and another named...sigh... 
"origin/master". 

Our theory is that, because we weren't specifying a full path for the 
branch, Jenkins was finding more than one branch and trying to kick of a 
job for both. Each subsequent job would find two branches, and try and kick 
off another build, and on and on.

FIX:
We changed the branch specifier in the job to "refs/heads/master". With the 
full path, Jenkins no longer thought there were multiple branches to build 
and the followup jobs quit happening.

P.S.:
As an aside, we also deleted the unexpected, unneeded branch 
"origin/master" from our repo, leaving just "master" behind. 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/40b2aa0d-a7f3-4e78-aafc-6620eb9445a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to define a Git repository with two remotes in Pipeline DSL?

2017-02-06 Thread Mark Waite
I don't know how to do that with pipeline DSL (though I suspect it is
possible).

With a regular pipeline script, you can use the "pipeline syntax" link on a
pipeline job definition to choose the "checkout" step.  That step will
allow you to define multiple remotes for a single working directory.  You
might look at the syntax it generates to see if something similar is
allowed for pipeline DSL.

Mark Waite

On Mon, Feb 6, 2017 at 6:32 AM 'Marc Rohlfs' via Jenkins Users <
jenkinsci-users@googlegroups.com> wrote:

> Hi there,
>
> how can I define a Git repository with 2 remotes in Pipeline DSL?
> Unfortunaltely, *Multiple SCMs* don't seem to work for me, because I need
> a clone that is connected to two remote repositories. I actually need this
> to implement an automated sync for a vendor branching.
>
> Any ideas?
>
> Many thanks in advance
>
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/ca368d24-4d85-4216-bb19-6d273f94020b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtE1NhZxbawLY%3D%3D_-ic6rLeo5KQMcQa7ihtzH_u7timCPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: User not passing to job history if submitted by URL?

2017-02-06 Thread Don Alcombright
So its improving sort of haha. Now instead of "N/A" it posts "anonymous" 
any thoughts on that?

On Friday, February 3, 2017 at 10:21:43 AM UTC-5, Daniel Beck wrote:
>
> Could be related to use of the build token. Try without, and make sure 
> your user has Build permission. 
>
> > On 03.02.2017, at 16:01, Don Alcombright  > wrote: 
> > 
> > 
> http://username:TOKEN@MACHINENAME:8080/job/CATRADER%20Suite%20Builder/buildWithParameters?token=ctbuild=False=True=False=False=Nightly=Automation=Nightly=\\PATHTOFOLDER=2015_Recipients=
> bl...@blah.com  
> > 
> > All it says next to the user is N/A, if I login to jenkins and kick it 
> off it gets my AD user like it should. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d3c435b1-2288-4a96-8b07-b49555d4fae1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting the description of a failed test in pipeline groovy

2017-02-06 Thread Richard Ginga
ok, if you need to step through to build object, I use this code to
eventually get the log of some other other job:

for (item in Jenkins.instance.getAllItems()) {
//
// find the correct job
//
if (item.getFullName() == SERVER_BUILD_NAME) {
 def job = item.getAllJobs()
 //
 // get the last successful build object
 //
 def build = job[0].getLastSuccessfulBuild()
 //
 // get the build log from that build
 //
 def log = build.getLog(300)


On Mon, Feb 6, 2017 at 8:34 AM, Vincent Massol  wrote:

> Hi Richard,
>
> > On 6 Feb 2017, at 14:31, Richard Ginga  wrote:
> >
> > Vincent, I am not a Jenkins master, but, you need to replace the
> "manager" variable. that is defined by groovy-postbuild. I "think" all you
> need is to use "currentBuild" as the variable to access build methods and
> "Jenkins.instance." to access FilePath.
>
> I’ve tried to use currentBuild but it’s wrapped and only offers a few
> methods. For example it doesn’t allow calling getWorkspace() nor
> getTestResultAction().
>
> So right now I’m trying to find a way to get access to a
> https://github.com/jenkinsci/junit-plugin/blob/master/src/
> main/java/hudson/tasks/junit/TestResultAction.java instance.
>
> (Previously it was manager.build.testResultAction)
>
> Thanks
> -Vincent
>
> > On Mon, Feb 6, 2017 at 3:25 AM, Vincent Massol 
> wrote:
> > Hi Jenkins masters,
> >
> > I had a groovy postbuild script that I'm trying to migrate to pipeline
> groovy.
> >
> > It's setting the description of failed test (in order to embed the
> screenshot taken by our selenium tests in the jenkins failed test UI - For
> example: http://ci.xwiki.org/job/xwiki-enterprise-test-ui-7.4.x/org.
> xwiki.enterprise$xwiki-enterprise-test-ui/350/testReport/junit/org.xwiki.
> test.ui.appwithinminutes/WizardTest/testCreateApplication/ ).
> >
> > I've googled a lot but couldn't find any starting point to convert this
> script:
> >
> >  /**
> >* This script attaches the screenshot of a failing Selenium test to
> the failed test's description.
> >* The screenshot is preserved after the workspace gets cleared by a
> new build.
> >*/
> >   def attachScreenshotToFailingTests() {
> > def channel = manager.build.workspace.channel;
> > def workspace = manager.build.workspace.toString();
> >
> > def testResults = manager.build.testResultAction;
> > if (testResults == null) {
> >   // No tests were run in this build, nothing left to do.
> >   return;
> > }
> >
> > // Go through each failed test in the current build.
> > def failedTests = testResults.getFailedTests();
> > for (def failedTest : failedTests) {
> >   // Compute the test's screenshot file name.
> >   def testClass = failedTest.getClassName();
> >   def testSimpleClass = failedTest.getSimpleName();
> >   def testExample = failedTest.getName();
> >
> >   def suiteResultFile = failedTest.getSuiteResult().getFile();
> >   if (suiteResultFile == null) {
> > // No results available. Go to the next test.
> > continue;
> >   }
> >
> >   // Compute the screenshot's location on the build agent.
> >   def targetFolderPath = new hudson.FilePath(channel,
> suiteResultFile).getParent().getParent();
> >   // The screenshot can have 2 possible file names and locations, we
> have to look for both.
> >   // Selenium 1 test screenshots.
> >   def imageAbsolutePath1 = new hudson.FilePath(targetFolderPath,
> "selenium-screenshots/${testClass}-${testExample}.png");
> >   // Selenium 2 test screenshots.
> >   def imageAbsolutePath2 = new hudson.FilePath(targetFolderPath,
> "screenshots/${testSimpleClass}-${testExample}.png");
> >   // Determine which one exists, if any.
> >   def imageAbsolutePath = imageAbsolutePath1.exists() ?
> imageAbsolutePath1 : (imageAbsolutePath2.exists() ? imageAbsolutePath2 :
> null);
> >
> >   // If the screenshot exists...
> >   if (imageAbsolutePath != null) {
> > // Build a base64 string of the image's content.
> > def imageDataStream = imageAbsolutePath.read();
> > byte[] imageData = IOUtils.toByteArray(imageDataStream);
> > def imageDataString = "data:image/png;base64," +
> DatatypeConverter.printBase64Binary(imageData);
> >
> > def testResultAction = failedTest.getParentAction();
> > def testResult = testResultAction.getResult();
> >
> > // Build a description HTML to be set for the failing test that
> includes the image in Data URI format.
> > def description = "Screenshot";
> > description += " style=\"width: 800px\" src=\"" + imageDataString + "\" />";
> >
> > // Set the description to the failing test and save it to disk.
> > testResultAction.setDescription(failedTest, description);
> > // Note: the owner field is marked as deprecated and it might go
> away. It should be replaced by an instance of Run in the 

Re: Setting the description of a failed test in pipeline groovy

2017-02-06 Thread Vincent Massol
Hi Richard,

> On 6 Feb 2017, at 14:31, Richard Ginga  wrote:
> 
> Vincent, I am not a Jenkins master, but, you need to replace the "manager" 
> variable. that is defined by groovy-postbuild. I "think" all you need is to 
> use "currentBuild" as the variable to access build methods and 
> "Jenkins.instance." to access FilePath.

I’ve tried to use currentBuild but it’s wrapped and only offers a few methods. 
For example it doesn’t allow calling getWorkspace() nor getTestResultAction().

So right now I’m trying to find a way to get access to a 
https://github.com/jenkinsci/junit-plugin/blob/master/src/main/java/hudson/tasks/junit/TestResultAction.java
 instance.

(Previously it was manager.build.testResultAction)

Thanks
-Vincent

> On Mon, Feb 6, 2017 at 3:25 AM, Vincent Massol  wrote:
> Hi Jenkins masters,
> 
> I had a groovy postbuild script that I'm trying to migrate to pipeline 
> groovy. 
> 
> It's setting the description of failed test (in order to embed the screenshot 
> taken by our selenium tests in the jenkins failed test UI - For example: 
> http://ci.xwiki.org/job/xwiki-enterprise-test-ui-7.4.x/org.xwiki.enterprise$xwiki-enterprise-test-ui/350/testReport/junit/org.xwiki.test.ui.appwithinminutes/WizardTest/testCreateApplication/
>  ).
> 
> I've googled a lot but couldn't find any starting point to convert this 
> script:
> 
>  /**
>* This script attaches the screenshot of a failing Selenium test to the 
> failed test's description.
>* The screenshot is preserved after the workspace gets cleared by a new 
> build.
>*/
>   def attachScreenshotToFailingTests() {
> def channel = manager.build.workspace.channel;
> def workspace = manager.build.workspace.toString();
> 
> def testResults = manager.build.testResultAction;
> if (testResults == null) {
>   // No tests were run in this build, nothing left to do.
>   return;
> }
> 
> // Go through each failed test in the current build.
> def failedTests = testResults.getFailedTests();
> for (def failedTest : failedTests) {
>   // Compute the test's screenshot file name.
>   def testClass = failedTest.getClassName();
>   def testSimpleClass = failedTest.getSimpleName();
>   def testExample = failedTest.getName();
> 
>   def suiteResultFile = failedTest.getSuiteResult().getFile();
>   if (suiteResultFile == null) {
> // No results available. Go to the next test.
> continue;
>   }
>   
>   // Compute the screenshot's location on the build agent.
>   def targetFolderPath = new hudson.FilePath(channel, 
> suiteResultFile).getParent().getParent();
>   // The screenshot can have 2 possible file names and locations, we have 
> to look for both.
>   // Selenium 1 test screenshots.
>   def imageAbsolutePath1 = new hudson.FilePath(targetFolderPath, 
> "selenium-screenshots/${testClass}-${testExample}.png");
>   // Selenium 2 test screenshots.
>   def imageAbsolutePath2 = new hudson.FilePath(targetFolderPath, 
> "screenshots/${testSimpleClass}-${testExample}.png");
>   // Determine which one exists, if any.
>   def imageAbsolutePath = imageAbsolutePath1.exists() ? 
> imageAbsolutePath1 : (imageAbsolutePath2.exists() ? imageAbsolutePath2 : 
> null);
> 
>   // If the screenshot exists...
>   if (imageAbsolutePath != null) {
> // Build a base64 string of the image's content.
> def imageDataStream = imageAbsolutePath.read();
> byte[] imageData = IOUtils.toByteArray(imageDataStream);
> def imageDataString = "data:image/png;base64," + 
> DatatypeConverter.printBase64Binary(imageData);
> 
> def testResultAction = failedTest.getParentAction();
> def testResult = testResultAction.getResult();
> 
> // Build a description HTML to be set for the failing test that 
> includes the image in Data URI format.
> def description = "Screenshot";
> description += " style=\"width: 800px\" src=\"" + imageDataString + "\" />";
> 
> // Set the description to the failing test and save it to disk.
> testResultAction.setDescription(failedTest, description);
> // Note: the owner field is marked as deprecated and it might go 
> away. It should be replaced by an instance of Run in the future,
> // but FTM, I do not know how to access it. For the future, in case 
> descriptions start not getting stored, this might cause it.
> testResultAction.owner.save();
>   }
> }
>   }
> 
> Any pointer would be much appreciated.
> 
> Thanks
> -Vincent
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> 

How to define a Git repository with two remotes in Pipeline DSL?

2017-02-06 Thread 'Marc Rohlfs' via Jenkins Users
Hi there,

how can I define a Git repository with 2 remotes in Pipeline DSL? 
Unfortunaltely, *Multiple SCMs* don't seem to work for me, because I need a 
clone that is connected to two remote repositories. I actually need this to 
implement an automated sync for a vendor branching.

Any ideas?

Many thanks in advance

Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ca368d24-4d85-4216-bb19-6d273f94020b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting the description of a failed test in pipeline groovy

2017-02-06 Thread Richard Ginga
Vincent, I am not a Jenkins master, but, you need to replace the "manager"
variable. that is defined by groovy-postbuild. I "think" all you need is to
use "currentBuild" as the variable to access build methods and
"Jenkins.instance." to access FilePath.

On Mon, Feb 6, 2017 at 3:25 AM, Vincent Massol  wrote:

> Hi Jenkins masters,
>
> I had a groovy postbuild script that I'm trying to migrate to pipeline
> groovy.
>
> It's setting the description of failed test (in order to embed the
> screenshot taken by our selenium tests in the jenkins failed test UI - For
> example: http://ci.xwiki.org/job/xwiki-enterprise-test-ui-
> 7.4.x/org.xwiki.enterprise$xwiki-enterprise-test-ui/350/
> testReport/junit/org.xwiki.test.ui.appwithinminutes/WizardTest/
> testCreateApplication/ ).
>
> I've googled a lot but couldn't find any starting point to convert this
> script:
>
>  /**
>* This script attaches the screenshot of a failing Selenium test to the 
> failed test's description.
>* The screenshot is preserved after the workspace gets cleared by a new 
> build.
>*/
>   def attachScreenshotToFailingTests() {
> def channel = manager.build.workspace.channel;
> def workspace = manager.build.workspace.toString();
>
> def testResults = manager.build.testResultAction;
> if (testResults == null) {
>   // No tests were run in this build, nothing left to do.
>   return;
> }
>
> // Go through each failed test in the current build.
> def failedTests = testResults.getFailedTests();
> for (def failedTest : failedTests) {
>   // Compute the test's screenshot file name.
>   def testClass = failedTest.getClassName();
>   def testSimpleClass = failedTest.getSimpleName();
>   def testExample = failedTest.getName();
>
>   def suiteResultFile = failedTest.getSuiteResult().getFile();
>   if (suiteResultFile == null) {
> // No results available. Go to the next test.
> continue;
>   }
>
>   // Compute the screenshot's location on the build agent.
>   def targetFolderPath = new hudson.FilePath(channel, 
> suiteResultFile).getParent().getParent();
>   // The screenshot can have 2 possible file names and locations, we have 
> to look for both.
>   // Selenium 1 test screenshots.
>   def imageAbsolutePath1 = new hudson.FilePath(targetFolderPath, 
> "selenium-screenshots/${testClass}-${testExample}.png");
>   // Selenium 2 test screenshots.
>   def imageAbsolutePath2 = new hudson.FilePath(targetFolderPath, 
> "screenshots/${testSimpleClass}-${testExample}.png");
>   // Determine which one exists, if any.
>   def imageAbsolutePath = imageAbsolutePath1.exists() ? 
> imageAbsolutePath1 : (imageAbsolutePath2.exists() ? imageAbsolutePath2 : 
> null);
>
>   // If the screenshot exists...
>   if (imageAbsolutePath != null) {
> // Build a base64 string of the image's content.
> def imageDataStream = imageAbsolutePath.read();
> byte[] imageData = IOUtils.toByteArray(imageDataStream);
> def imageDataString = "data:image/png;base64," + 
> DatatypeConverter.printBase64Binary(imageData);
>
> def testResultAction = failedTest.getParentAction();
> def testResult = testResultAction.getResult();
>
> // Build a description HTML to be set for the failing test that 
> includes the image in Data URI format.
> def description = "Screenshot";
> description += " style=\"width: 800px\" src=\"" + imageDataString + "\" />";
>
> // Set the description to the failing test and save it to disk.
> testResultAction.setDescription(failedTest, description);
> // Note: the owner field is marked as deprecated and it might go 
> away. It should be replaced by an instance of Run in the future,
> // but FTM, I do not know how to access it. For the future, in case 
> descriptions start not getting stored, this might cause it.
> testResultAction.owner.save();
>   }
> }
>   }
>
>
> Any pointer would be much appreciated.
>
> Thanks
> -Vincent
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/15ee3c93-8849-492a-8355-3b2e11c05ada%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Dick Ginga
Build Engineer
rgi...@disruptorbeam.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: Does the sh pipeline step not work in windows with cygwin?

2017-02-06 Thread Marcelo Filho
Same here, any update? Now I've being blocked by the SSH agent... :(

On Thursday, December 22, 2016 at 9:09:10 AM UTC+1, Kadrach IsFictious 
wrote:
>
> Hi Jonathan,
>
> did you ever resolve this issue? I have the same problem.
>
> Cheers,
>
> Kad
>
> On Sunday, July 3, 2016 at 10:32:34 AM UTC+10, Jonathan Hodgson wrote:
>>
>> No, it's in my path though. And from what I can see it finds cygwin ok, 
>> it's the generated shel script it doesn't find.
>>
>> I've avoided setting it in the global configuration because it isn't 
>> global, my linux and osx machines have different locations for sh compared 
>> to the windows one.
>>
>> On Saturday, July 2, 2016 at 11:50:38 PM UTC+1, slide wrote:
>>>
>>> Did you specify the path to sh on the file system in the shell area in 
>>> the global configuration?
>>>
>>> On Sat, Jul 2, 2016 at 12:37 PM Jonathan Hodgson  
>>> wrote:
>>>
 Hi,

 I have cygwin installed (and the cygpath plugin), and the slave seems 
 to find it, but it can't find the script that I assume is first generated 
 by the jenkins slave before calling sh.

 [C:\Jenkins\workspace\pipeline-test] Running shell script
 sh: C:\Jenkins\workspace\pipeline-test@tmp\durable-313cd6e7\script.sh: 
 command not found


 Is this something that anybody has working?



 -- 
 You received this message because you are subscribed to the Google 
 Groups "Jenkins Users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to jenkinsci-use...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/jenkinsci-users/6ca18674-19a0-4681-ba28-64ed9f24a7b1%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e3cceef8-f2d8-405e-8b4e-93643427b49e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Shell script in Jenkins doesn't get info about POM_VERSION/POM_ARTIFACTID with Promotion Build plugin

2017-02-06 Thread alopez
 

I am trying to execute shell script with Promotion Build plugin to get info 
about maven properties (POM_VERSION, POM_ARTIFACTID).

Trouble is values for Jenkins environment variables are shown, but info 
about maven properties are shown empty. Projects where I am testing are MVN 
projects.

echo $POM_ARTIFACTID
 
echo $POM_VERSION 

echo $PROMOTED_JOB_NAME 
tests 
echo $JOB_NAME 
tests/promotion

These are the versions I am using:

   - Jenkins 2.43
   - Maven Project Plugin 2.14
   - Promoted Builds Plugin 2.28.1

Anyone knows some solution for this?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9f21945a-8b6f-4bb5-b0bf-d08cac143d0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Declarative Pipeline] Using Dockerfile not in root of checkout

2017-02-06 Thread Andrew Bayer
I've got a PR up for this now -
https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/107

A.

On Sun, Feb 5, 2017 at 9:01 PM, Staffan Forsell  wrote:

> Hmmm, of course I found https://issues.jenkins-ci.org/browse/JENKINS-41668
> a couple of minutes later...
>
> On Sunday, 5 February 2017 20:50:16 UTC+1, Staffan Forsell wrote:
>>
>> I have an normal pipeline that looks like this:
>>
>> #!groovy
>> node('docker_host') {
>>   stage("checkout") {
>> p4sync credential: 'superSecretCred', depotPath: '//path'
>>   }
>>   def myEnv
>>   stage("docker build") {
>> myEnv = docker.build("mytag", "utils/docker")
>>   }
>>   myEnv.inside {
>> stage("build") {
>>   sh "./gradle"
>> }
>> }
>> }
>>
>> It builds a docker image and run the build stage in this image. The only
>> non-standard stuff is that the Dockerfile is not in the root but in the
>> "utils/docker" subdir to reduce the build context for docker.
>> I'm trying to convert this to a declarative pipeline but I can't find a
>> way to get it to accept the Dockerfile in a separate dir. Normally this is
>> done by adding the "utils/build" at the end of the docker build command.
>> My converted attempt looks like this:
>>
>> pipeline {
>>   agent {
>> label "docker_host"
>>   }
>>   stages {
>> stage("Checkout") {
>>   steps {
>> p4sync credential: 'superSecretCred', depotPath: '//path'
>>   }
>> }
>> stage("Echo world") {
>>   agent {
>> dockerfile {
>>   label "docker_host"
>>   args "utils/docker"
>>   // dockerfile "utils/docker/Dockerfile"
>> }
>>   }
>>   steps {
>> sh "./gradle"
>>   }
>> }
>>   }
>> }
>>
>> This fails with
>> java.io.IOException: java.io.FileNotFoundException:
>> /jenkins/workspace/test-job-declarative@2/Dockerfile (No such file or
>> directory)
>> at hudson.remoting.FastPipedInputStream.read(FastPipedInputStre
>> am.java:169)
>> at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
>> at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
>> at java.io.InputStreamReader.read(InputStreamReader.java:184)
>> at java.io.Reader.read(Reader.java:140)
>> at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2001)
>> at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1980)
>> at org.apache.commons.io.IOUtils.copy(IOUtils.java:1957)
>> at org.apache.commons.io.IOUtils.copy(IOUtils.java:1907)
>> at org.apache.commons.io.IOUtils.toString(IOUtils.java:778)
>> at org.apache.commons.io.IOUtils.toString(IOUtils.java:803)
>> at org.jenkinsci.plugins.workflow.steps.ReadFileStep$Execution.
>> run(ReadFileStep.java:89)
>> at org.jenkinsci.plugins.workflow.steps.ReadFileStep$Execution.
>> run(ReadFileStep.java:81)
>> at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonB
>> lockingStepExecution$1$1.call(AbstractSynchronousNonBlocking
>> StepExecution.java:47)
>> at hudson.security.ACL.impersonate(ACL.java:221)
>> at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonB
>> lockingStepExecution$1.run(AbstractSynchronousNonBlockingSte
>> pExecution.java:44)
>> at java.util.concurrent.Executors$RunnableAdapter.call(
>> Executors.java:471)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1145)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:745)
>> Caused by: java.io.FileNotFoundException: /jenkins/workspace/test-job-de
>> clarative@2/Dockerfile (No such file or directory)
>> at java.io.FileInputStream.open0(Native Method)
>> at java.io.FileInputStream.open(FileInputStream.java:195)
>> at java.io.FileInputStream.(FileInputStream.java:138)
>> at hudson.FilePath$33.invoke(FilePath.java:1789)
>> at hudson.FilePath$33.invoke(FilePath.java:1782)
>> at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772)
>> at hudson.remoting.UserRequest.perform(UserRequest.java:153)
>> at hudson.remoting.UserRequest.perform(UserRequest.java:50)
>> at hudson.remoting.Request$2.run(Request.java:332)
>> at hudson.remoting.InterceptingExecutorService$1.call(Intercept
>> ingExecutorService.java:68)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1142)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:617)
>> ... 1 more
>>
>> Using the dockerfile closure, it's unclear if args is for the build
>> command or the subsequent run command (my guess is the latter).
>> Anybody know a way to use a Dockerfile that's not in the root? Or is it
>> not supported (yet)?
>>
>> /Thanks Staffan
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop 

Re: Jenkins Upgrade | Migration path is 1.585 -> LTS 2.32.1

2017-02-06 Thread Vikrant Kaushik
Thank you both, yes, I'm seeing some problem with plugins in this case.

Regards

Vikrant

On Monday, 6 February 2017 06:07:16 UTC, Vikrant Kaushik wrote:
>
> Dear All,
>
> This weekend I'm planning to upgrade my Jenkins as per below Migration 
> plan:
>
> 1.585 -> LTS 2.32.1
>
> Request all of you to please advise if I'm able to directly upgrade 1.585 
> to LTS 2.32.1
>
> Regards
>
> Vikrant
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/61768547-50a3-4e47-af2c-f861fb7353eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Remove all jobs' builds directories - is it safe to do so?

2017-02-06 Thread Daniel Beck

> On 06.02.2017, at 10:51, Dan Tran  wrote:
> 
> is it a safe thing to do?

As long as there's never a user named 'builds', or a job named 'builds', or 
anything else, really, named builds -- perhaps.

In general, no.

Just configure all your projects to discard all but the last 1 (or 5, or …) 
builds, and Jenkins will do this automatically after every new build of that 
project.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/F75DDCD9-14B1-490A-AEC9-9E8EB8157B79%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


RE: Slow updates from the repository

2017-02-06 Thread Eliezer Croitoru
Bumping up.


Eliezer Croitoru
Linux System Administrator
Mobile: +972-5-28704261
Email: elie...@ngtech.co.il


-Original Message-
From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Eliezer Croitoru
Sent: Wednesday, February 1, 2017 2:27 PM
To: jenkinsci-users@googlegroups.com
Subject: Slow updates from the repository

I am updating Jenkins regularly on both CentOS, Debian and Ubuntu and most
of the time it's in the middle of the night(TimeZone +2) and I have used the
instructions from:
http://pkg.jenkins-ci.org/redhat/

But most of the time the download is lower the 1Mbit per second and some
other times it's 20+(my dsl connection is 30+).
I wanted to know if others have the same issue and if so what can be done to
resolve this issue?
I have a local self hosted server which I can rsync at the spare time the
repository once in a while(a week or less).
Where should I start in order to mirror locally the repositories to speed
the local updates?

Thanks,
Eliezer


Eliezer Croitoru
Linux System Administrator
Mobile: +972-5-28704261
Email: elie...@ngtech.co.il



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/068001d27c86%247d65c850%24783158f0%24%40ngtech.co.il.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/00aa01d28065%24f4a741e0%24ddf5c5a0%24%40ngtech.co.il.
For more options, visit https://groups.google.com/d/optout.


Remove all jobs' builds directories - is it safe to do so?

2017-02-06 Thread Dan Tran

Hi

I found the below command very handy  to clean up my local jenkins master ( 
I dont really care about build histories and logs)

   find $JENKINS_HOME -name builds | xargs rm -rf

so that I can backup before upgrade my jenkins 

is it a safe thing to do? I am about to recommend this to my group, but 
just want to confirm 

Thanks

-Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/306d17af-77e3-40f2-b7d1-a6805b8c5482%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Upgrade | Migration path is 1.585 -> LTS 2.32.1

2017-02-06 Thread Oleg Nenashev
Also see upgrade guides being posted on the jenkins.io side.
There should not be serious update blockers, but backup and testing are 
always recommended. Likely you will be afftected by some security fixes, 
which change the default behavior n some cases.

понедельник, 6 февраля 2017 г., 7:49:10 UTC+1 пользователь James Dumay 
написал:
>
> You will have to confirm that the plugins you use are compatible with the 
> newer version of Jenkins. I would recommend backing up, creating a test 
> server from the. backup then upgrading all the plugins on the backup 
> Jenkins to see what breaks.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a4ec099c-5faa-4756-a06b-098cac38e449%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Setting the description of a failed test in pipeline groovy

2017-02-06 Thread Vincent Massol
Hi Jenkins masters,

I had a groovy postbuild script that I'm trying to migrate to pipeline 
groovy. 

It's setting the description of failed test (in order to embed the 
screenshot taken by our selenium tests in the jenkins failed test UI - For 
example: 
http://ci.xwiki.org/job/xwiki-enterprise-test-ui-7.4.x/org.xwiki.enterprise$xwiki-enterprise-test-ui/350/testReport/junit/org.xwiki.test.ui.appwithinminutes/WizardTest/testCreateApplication/
 
).

I've googled a lot but couldn't find any starting point to convert this 
script:

 /**
   * This script attaches the screenshot of a failing Selenium test to the 
failed test's description.
   * The screenshot is preserved after the workspace gets cleared by a new 
build.
   */
  def attachScreenshotToFailingTests() {
def channel = manager.build.workspace.channel;
def workspace = manager.build.workspace.toString();

def testResults = manager.build.testResultAction;
if (testResults == null) {
  // No tests were run in this build, nothing left to do.
  return;
}

// Go through each failed test in the current build.
def failedTests = testResults.getFailedTests();
for (def failedTest : failedTests) {
  // Compute the test's screenshot file name.
  def testClass = failedTest.getClassName();
  def testSimpleClass = failedTest.getSimpleName();
  def testExample = failedTest.getName();

  def suiteResultFile = failedTest.getSuiteResult().getFile();
  if (suiteResultFile == null) {
// No results available. Go to the next test.
continue;
  }
  
  // Compute the screenshot's location on the build agent.
  def targetFolderPath = new hudson.FilePath(channel, 
suiteResultFile).getParent().getParent();
  // The screenshot can have 2 possible file names and locations, we have 
to look for both.
  // Selenium 1 test screenshots.
  def imageAbsolutePath1 = new hudson.FilePath(targetFolderPath, 
"selenium-screenshots/${testClass}-${testExample}.png");
  // Selenium 2 test screenshots.
  def imageAbsolutePath2 = new hudson.FilePath(targetFolderPath, 
"screenshots/${testSimpleClass}-${testExample}.png");
  // Determine which one exists, if any.
  def imageAbsolutePath = imageAbsolutePath1.exists() ? imageAbsolutePath1 
: (imageAbsolutePath2.exists() ? imageAbsolutePath2 : null);

  // If the screenshot exists...
  if (imageAbsolutePath != null) {
// Build a base64 string of the image's content.
def imageDataStream = imageAbsolutePath.read();
byte[] imageData = IOUtils.toByteArray(imageDataStream);
def imageDataString = "data:image/png;base64," + 
DatatypeConverter.printBase64Binary(imageData);

def testResultAction = failedTest.getParentAction();
def testResult = testResultAction.getResult();

// Build a description HTML to be set for the failing test that 
includes the image in Data URI format.
def description = "Screenshot";
description += "";

// Set the description to the failing test and save it to disk.
testResultAction.setDescription(failedTest, description);
// Note: the owner field is marked as deprecated and it might go away. 
It should be replaced by an instance of Run in the future,
// but FTM, I do not know how to access it. For the future, in case 
descriptions start not getting stored, this might cause it.
testResultAction.owner.save();
  }
}
  }


Any pointer would be much appreciated.

Thanks
-Vincent


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/15ee3c93-8849-492a-8355-3b2e11c05ada%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.