Re: Parameterized build driven by Jenkinsfile

2017-08-09 Thread Craig Barr
Thanks Jacob. That worked exactly as I would expect!

On Thu, Aug 10, 2017 at 5:40 AM, Jacob Larsen  wrote:

> Try this:
> properties([
> parameters([
> string(name: 'bld', defaultValue: 'full', description: ''),
> string(name: 'branch', defaultValue: 'dev', description: '')
> ])
> ])
>
> /Jacob
>
>
> On 2017-08-09 03:54, Craig Barr wrote:
>
> Thanks Jacob and Alex!
>
> Which version of Jenkins does this work for you on?
> I've tried with the following Jenkinsfile on 2.46.1 but no matter how many
> times I ran, the parameters never showed up in the console.
>
> parameters {
>
>string(name: 'bld', defaultValue: 'full', description: '')
>
>string(name: 'branch', defaultValue: 'dev', description: '')
>
> }
>
>
> node {
>
>if (getBinding().hasVariable("bld")) {
>
>   echo "SET"
>
>} else {
>
>   echo "NOTSET"
>
>}
>
> }
>
> On Friday, 4 August 2017 03:27:44 UTC+10, Alex Marcon wrote:
>>
>> That's right... to define, it is something like:
>>
>> parameters {
>> string(name: 'bld', defaultValue: 'full', description: '')
>> string(name: 'branch', defaultValue: 'dev', description: '')
>> }
>>
>> you may load some properties from a file and use those variables for
>> defaultValue...
>>
>> AM
>>
>> On Thursday, 3 August 2017 04:13:54 UTC-4, Jacob Larsen wrote:
>>>
>>> Yes, kind of...
>>>
>>> The parameters are hidden in the "properties" structure. They will be
>>> applied to the job when it runs, meaning that the first run will not have
>>> these parameters defined. If you make your Jenkinsfile robust for undefined
>>> parameters, it should be doable, just remember that they will apply to the
>>> second build.
>>>
>>> /Jacob
>>>
>>> On 2017-08-03 04:03, Craig Barr wrote:
>>>
>>> In Jenkins you can select "This project is parameterized" and add
>>> parameters. My question is simple:
>>> Can this parameter metadata be populated by an alternative
>>> version-controlled source?
>>>
>>> For example, can I define parameter definitions in my Jenkinsfile so
>>> that when I click Build Now it will populate the parameters from this
>>> source?
>>> If this is not possible, are they any other suggestions for addressing
>>> such a requirement?
>>>
>>> Thanks!
>>>
>>> *Oracle Excellence Award Specialized Partner of the Year: Middleware,
>>> Asia Pacific
>>> *
>>>
>>>
>>>
>>> Rubicon Red Privacy Policy 
>>>
>>> --
>>> 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/ms
>>> gid/jenkinsci-users/eb7dca33-81d0-4b35-9045-0ab521327109%
>>> 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/e4e728c9-553a-4720-96c7-5ac29bddabb8%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-users/oRhJRoBgWfc/unsubscribe.
> To unsubscribe from this group and all its topics, 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/0978cc69-5cbe-6737-a7dc-802fc3dc1511%40larsen.net
> 
> .
>
> 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/CAOF_U2rK5Wn7Dv6MBsavf%3DjcnCFVa%2Bw%2B_h5b1%2BhRgtUcO7gu0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Affordable solution for Jenkins CI and build slaves in the cloud?

2017-08-09 Thread Eddie Sutton
I no longer want to deal with backup issues of our CI system.

I have an ESXi server running on a Mac Mini hosting a Jenkins server and
multiple build machines on a Synology NAS datastore targeting Android, iOS,
Linux, macOS, and Linux.

Any success stories or recommendations?

Thanks in advance,

-Ed

-- 
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/CAKas9SStLd2_kxOWMt3uptwGQ0EzYsf7VZf4gCmgMxF4guf4HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: curl upload with filename in variable

2017-08-09 Thread Curtis Kline
The file exists in the current working directory. This is a three-stage
project with the agent declared at the global level. It's not running in a
Docker container, simply on a Linux node. As a test, I included a step
right before the one I mentioned:

ls -l ${env.filename}

The results seem conclusive:

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ ls -l Project-debug-v2.1.0-b999.apk
-rwxrwxrwx 1 jenkins jenkins 33014841 Aug  9 21:01 Project-debug-v2.1.0-b999.apk




On Wed, Aug 9, 2017 at 4:26 PM, Slide  wrote:

> Does the file exist in what would be considered the current working
> directory? Perhaps an ls before the curl to verify?
>
> On Wed, Aug 9, 2017 at 2:13 PM Curtis Kline  wrote:
>
>> In my declarative pipeline Jenkinsfile, I have the following shell script
>> line:
>>
>> sh """
>> curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F
>> "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234"
>> https://rink.hockeyapp.net/api/2/apps/upload
>> """
>>
>> This does not work, because curl is apparently unable to open the file.
>> The file clearly exists, and the env.filename variable contains the correct
>> filename (you can see this in the console log below, as the variable has
>> been expanded to a file name).
>>
>> A snippet of my console log is below. I’ve been working on this for a
>> number of hours, and I could use any help or advice you might have.
>>
>> [Pipeline] sh[JenkinsAndroidTest] Running shell script
>> + curl -F status=2 -F notify=1 -F notes= -F ipa=@Project-debug-v2.1.0-
>> b999.apk
>> -H X-HockeyAppToken: 1234 https://rink.hockeyapp.net/api/2/apps/upload
>>   % Total% Received % Xferd  Average Speed   TimeTime Time
>> Current
>>  Dload  Upload   Total   SpentLeft
>> Speed
>>
>>   0 00 00 0  0  0 --:--:-- --:--:--
>> --:--:-- 0
>>   0 00 00 0  0  0 --:--:-- --:--:--
>> --:--:-- 0
>> curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
>> "
>> [Pipeline] }
>>
>> --
>> 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/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-
>> KmAr8Qig%40mail.gmail.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/CAPiUgVfa%2BX14jd_4LvX1CYS_
> vuWRSYmvvHSh3dHjM9_ApMo5-g%40mail.gmail.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/CAGkg-enQf5Wd00PPtkNnatYKNcmFjPDxHAoj94JakZe18U88Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: curl upload with filename in variable

2017-08-09 Thread Slide
Does the file exist in what would be considered the current working
directory? Perhaps an ls before the curl to verify?

On Wed, Aug 9, 2017 at 2:13 PM Curtis Kline  wrote:

> In my declarative pipeline Jenkinsfile, I have the following shell script
> line:
>
> sh """
> curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F
> "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234"
> https://rink.hockeyapp.net/api/2/apps/upload
> """
>
> This does not work, because curl is apparently unable to open the file.
> The file clearly exists, and the env.filename variable contains the correct
> filename (you can see this in the console log below, as the variable has
> been expanded to a file name).
>
> A snippet of my console log is below. I’ve been working on this for a
> number of hours, and I could use any help or advice you might have.
>
> [Pipeline] sh[JenkinsAndroidTest] Running shell script
> + curl -F status=2 -F notify=1 -F notes= -F
> ipa=@Project-debug-v2.1.0-b999.apk
> -H X-HockeyAppToken: 1234 https://rink.hockeyapp.net/api/2/apps/upload
>   % Total% Received % Xferd  Average Speed   TimeTime Time
> Current
>  Dload  Upload   Total   SpentLeft
> Speed
>
>   0 00 00 0  0  0 --:--:-- --:--:--
> --:--:-- 0
>   0 00 00 0  0  0 --:--:-- --:--:--
> --:--:-- 0
> curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
> "
> [Pipeline] }
>
> --
> 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/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.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/CAPiUgVfa%2BX14jd_4LvX1CYS_vuWRSYmvvHSh3dHjM9_ApMo5-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Parameterized build driven by Jenkinsfile

2017-08-09 Thread R. Tyler Croy
(replies inline)

On Wed, 02 Aug 2017, Craig Barr wrote:

> In Jenkins you can select "This project is parameterized" and add 
> parameters. My question is simple:
> Can this parameter metadata be populated by an alternative 
> version-controlled source?
> 
> For example, can I define parameter definitions in my Jenkinsfile so that 
> when I click Build Now it will populate the parameters from this source?
> If this is not possible, are they any other suggestions for addressing such 
> a requirement?


My pal Liam created a screencast on this topic recently:
https://www.youtube.com/watch?v=5_tvlaIeQUQ&feature=youtu.be

See also: https://jenkins.io/doc/book/pipeline/jenkinsfile/#parameters


- R. Tyler Croy

--
 Code: 
  Chatter: 
 xmpp: rty...@jabber.org

  % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
--

-- 
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/20170809212559.4qi4ut3sxo5gbnfz%40blackberry.coupleofllamas.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


curl upload with filename in variable

2017-08-09 Thread Curtis Kline
In my declarative pipeline Jenkinsfile, I have the following shell script
line:

sh """
curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F
"ipa=@${env.filename}" -H "X-HockeyAppToken: 1234"
https://rink.hockeyapp.net/api/2/apps/upload
"""

This does not work, because curl is apparently unable to open the file. The
file clearly exists, and the env.filename variable contains the correct
filename (you can see this in the console log below, as the variable has
been expanded to a file name).

A snippet of my console log is below. I’ve been working on this for a
number of hours, and I could use any help or advice you might have.

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ curl -F status=2 -F notify=1 -F notes= -F
ipa=@Project-debug-v2.1.0-b999.apk
-H X-HockeyAppToken: 1234 https://rink.hockeyapp.net/api/2/apps/upload
  % Total% Received % Xferd  Average Speed   TimeTime Time
Current
 Dload  Upload   Total   SpentLeft
Speed

  0 00 00 0  0  0 --:--:-- --:--:--
--:--:-- 0
  0 00 00 0  0  0 --:--:-- --:--:--
--:--:-- 0
curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
"
[Pipeline] }

-- 
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/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins 2.60.2 - testlink plugin: iterative build steps - addCustomFieldEnvironmentVariableName failed

2017-08-09 Thread W Jiang
Windows 10/Jenkins 2.60.2/Testlink 1.9

Testlink is able to found test cases from testlink with a few custom fields.

Create build step - iterative build steps. The custom Fields from testlink 
would be created as environment variables during iterative steps. but it 
was always gave error:

Wonder anything wrong or it's a bug?

 
java.runtime.version 1.8.0_66-b18



*00:00:00.002* Started by user wj 
ddd*00:00:00.005* Building in workspace 
C:\Program Files (x86)\Jenkins\workspace\TestTAP*00:00:00.008* Preparing 
TestLink client API.*00:00:00.008* Using TestLink URL: 
http://10.25.111.111:80/lib/api/xmlrpc/v1/xmlrpc.php 
*00:00:00.008* 
*00:00:00.199* Found 4 automated test cases in TestLink.*00:00:00.200* 
*00:00:00.200* Sorting automated test cases by TestLink test plan execution 
order.*00:00:00.200* *00:00:00.200* Executing single Build Steps.*00:00:00.200* 
*00:00:00.200* Merging build environment variables with data retrieved from 
TestLink.*00:00:00.200* *00:00:00.202* [TestTAP] $ cmd /c call 
C:\Users\englab\AppData\Local\Temp\jenkins914783694878718856.bat*00:00:00.243* 
*00:00:00.243* C:\Program Files (x86)\Jenkins\workspace\TestTAP>set  
1>"C:\Program Files (x86)\Jenkins\workspace\TestTAP\enviromentvar.txt " 
*00:00:00.245* *00:00:00.245* C:\Program Files 
(x86)\Jenkins\workspace\TestTAP>exit 0 *00:00:00.247* Executing iterative Build 
Steps.*00:00:00.247* *00:00:00.247* ERROR: Build step failed with 
exception*00:00:00.248* java.lang.NullPointerException*00:00:00.248* at 
hudson.plugins.testlink.util.TestLinkHelper.addCustomFieldEnvironmentVariableName(TestLinkHelper.java:263)*00:00:00.248*
 at 
hudson.plugins.testlink.util.TestLinkHelper.createTestLinkEnvironmentVariables(TestLinkHelper.java:201)*00:00:00.248*
at 
hudson.plugins.testlink.util.TestLinkHelper.buildTestCaseEnvVars(TestLinkHelper.java:304)*00:00:00.248*
  at 
hudson.plugins.testlink.TestLinkBuilder.executeIterativeBuildSteps(TestLinkBuilder.java:431)*00:00:00.248*
   at 
hudson.plugins.testlink.TestLinkBuilder.perform(TestLinkBuilder.java:249)*00:00:00.248*
  at 
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)*00:00:00.248* 
 at 
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)*00:00:00.248*
  at hudson.model.Build$BuildExecution.build(Build.java:206)*00:00:00.248*  
  at hudson.model.Build$BuildExecution.doRun(Build.java:163)*00:00:00.248*  
  at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)*00:00:00.248*
  at hudson.model.Run.execute(Run.java:1735)*00:00:00.248*at 
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)*00:00:00.248*at 
hudson.model.ResourceController.execute(ResourceController.java:97)*00:00:00.248*
at hudson.model.Executor.run(Executor.java:405)*00:00:00.248* Build step 
'Invoke TestLink' marked build as failure*00:00:00.672* Finished: FAILURE



-- 
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/320a918c-0be4-4e83-8005-f4898ca65c91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Parameterized build driven by Jenkinsfile

2017-08-09 Thread Jacob Larsen

Try this:

properties([
parameters([
string(name: 'bld', defaultValue: 'full', description: ''),
string(name: 'branch', defaultValue: 'dev', description: '')
])
])

/Jacob

On 2017-08-09 03:54, Craig Barr wrote:

Thanks Jacob and Alex!

Which version of Jenkins does this work for you on?
I've tried with the following Jenkinsfile on 2.46.1 but no matter how 
many times I ran, the parameters never showed up in the console.


parameters {

string(name: 'bld', defaultValue: 'full', description: '')

string(name: 'branch', defaultValue: 'dev', description: '')

}


node {

if (getBinding().hasVariable("bld")) {

echo "SET"

} else {

echo "NOTSET"

}

}


On Friday, 4 August 2017 03:27:44 UTC+10, Alex Marcon wrote:

That's right... to define, it is something like:

parameters {
string(name: 'bld', defaultValue: 'full', description: '')
string(name: 'branch', defaultValue: 'dev', description: '')
}

you may load some properties from a file and use those variables
for defaultValue...

AM

On Thursday, 3 August 2017 04:13:54 UTC-4, Jacob Larsen wrote:

Yes, kind of...

The parameters are hidden in the "properties" structure. They
will be applied to the job when it runs, meaning that the
first run will not have these parameters defined. If you make
your Jenkinsfile robust for undefined parameters, it should be
doable, just remember that they will apply to the second build.

/Jacob


On 2017-08-03 04:03, Craig Barr wrote:

In Jenkins you can select "This project is parameterized" and
add parameters. My question is simple:
Can this parameter metadata be populated by an alternative
version-controlled source?

For example, can I define parameter definitions in my
Jenkinsfile so that when I click Build Now it will populate
the parameters from this source?
If this is not possible, are they any other suggestions for
addressing such a requirement?

Thanks!

_Oracle Excellence Award Specialized Partner of the Year:
Middleware, Asia Pacific

_



Rubicon Red Privacy Policy


-- 
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/eb7dca33-81d0-4b35-9045-0ab521327109%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/e4e728c9-553a-4720-96c7-5ac29bddabb8%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/0978cc69-5cbe-6737-a7dc-802fc3dc1511%40larsen.net.
For more options, visit https://groups.google.com/d/optout.


Jenkins EC2 multiple spot instances

2017-08-09 Thread York Sun
I need some help on Jenkins EC2 spot with multiple instances. I try to 
setup the cloud with C4x8, M4x10 and other types, hoping to catch the less 
expensive spot price. Sometimes c4x8 is cheaper and sometimes m4x10 is 
cheaper. However, I never see my m4x10 instance starts. It always waits for 
c4x8 which is my first instance in configuration. I can only start my m4x10 
instance by using different label. This is not the case I want to discuss.

Is it even possible?

-- 
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/96f447d8-0fd4-4356-bec0-689d8f5dc385%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic closures called in parallel

2017-08-09 Thread 'Björn Pedersen' via Jenkins Users

Hi,

your problem is  actually addressed in the example. 
The closure is evalutated only during the parallel call. There $name is 
constant. 
Put a 
def xname  = name 
inside your loop and use xname in the closures. 
 (in the example it is  the def index=i line).

Björn


Am Mittwoch, 9. August 2017 17:17:53 UTC+2 schrieb Mirek S:
>
> Hi!
>
> I'm using the following Pipeline script:
>
> testruns = [:]
> for (name in ["one", "two", "three"]) {
>   print("Adding ${name} to testruns")
>   testruns[name] = { print("Staring phase ${name}"); sleep 10; 
> print("Finished phase ${name}")}
> }
>
> pipeline {
>   agent { label 'master' }
>   stages {
> stage("Parallelism") {
>   steps {
> script {
>   parallel testruns
> }
>   }
> }
>   }
> }
>
> I'm expecting to run those three dynamically created closures in parallel. 
> But it appears that all closures were created using only the last field 
> ("three"). Console output:
>
> Started by user ...
> [Pipeline] echo
> Adding one to testruns
> [Pipeline] echo
> Adding two to testruns
> [Pipeline] echo
> Adding three to testruns
> [Pipeline] node
> Running on master in ...
> [Pipeline] {
> [Pipeline] stage
> [Pipeline] { (Parallelism)
> [Pipeline] script
> [Pipeline] {
> [Pipeline] parallel
> [Pipeline] [one] { (Branch: one)
> [Pipeline] [two] { (Branch: two)
> [Pipeline] [three] { (Branch: three)
> [Pipeline] [one] echo
> [one] Staring phase three
> [Pipeline] [one] sleep
> [one] Sleeping for 10 sec
> [Pipeline] [two] echo
> [two] Staring phase three
> [Pipeline] [two] sleep
> [two] Sleeping for 10 sec
> [Pipeline] [three] echo
> [three] Staring phase three
> [Pipeline] [three] sleep
> [three] Sleeping for 10 sec
> [Pipeline] [one] echo
> [one] Finished phase three
> [Pipeline] [one] }
> [Pipeline] [two] echo
> [two] Finished phase three
> [Pipeline] [two] }
> [Pipeline] [three] echo
> [three] Finished phase three
> [Pipeline] [three] }
> [Pipeline] // parallel
> [Pipeline] }
> [Pipeline] // script
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> Finished: SUCCESS
>
>
> Please note that all phases are saying "three":
>
> [*two*] Finished phase *three*
>
> I was thinking that maybe there's a need for some kind of splat operator 
> on argument for "parallel", but pipeline parallel example 
>  doesn't use 
> it (and when I tried I got java.lang.UnsupportedOperationException)
>
> What am I not seeing here? Why the closures are not created properly?
>

-- 
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/f1a88248-913f-43ac-8930-2dcbbe4b854f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic closures called in parallel

2017-08-09 Thread Mirek S
Huh... Only now I noticed that my issue is mentioned in the pipeline 
parallel example. You can ignore this topic :)

//the dummy parameter is for preventing mutation of the parameter before the 
execution of the closure.//we have to assign it outside the closure or it will 
run the job multiple times with the same parameter "4"//and jenkins will unite 
them into a single run of the job


W dniu środa, 9 sierpnia 2017 17:17:53 UTC+2 użytkownik Mirek S napisał:
>
> Hi!
>
> I'm using the following Pipeline script:
>
> testruns = [:]
> for (name in ["one", "two", "three"]) {
>   print("Adding ${name} to testruns")
>   testruns[name] = { print("Staring phase ${name}"); sleep 10; 
> print("Finished phase ${name}")}
> }
>
> pipeline {
>   agent { label 'master' }
>   stages {
> stage("Parallelism") {
>   steps {
> script {
>   parallel testruns
> }
>   }
> }
>   }
> }
>
> I'm expecting to run those three dynamically created closures in parallel. 
> But it appears that all closures were created using only the last field 
> ("three"). Console output:
>
> Started by user ...
> [Pipeline] echo
> Adding one to testruns
> [Pipeline] echo
> Adding two to testruns
> [Pipeline] echo
> Adding three to testruns
> [Pipeline] node
> Running on master in ...
> [Pipeline] {
> [Pipeline] stage
> [Pipeline] { (Parallelism)
> [Pipeline] script
> [Pipeline] {
> [Pipeline] parallel
> [Pipeline] [one] { (Branch: one)
> [Pipeline] [two] { (Branch: two)
> [Pipeline] [three] { (Branch: three)
> [Pipeline] [one] echo
> [one] Staring phase three
> [Pipeline] [one] sleep
> [one] Sleeping for 10 sec
> [Pipeline] [two] echo
> [two] Staring phase three
> [Pipeline] [two] sleep
> [two] Sleeping for 10 sec
> [Pipeline] [three] echo
> [three] Staring phase three
> [Pipeline] [three] sleep
> [three] Sleeping for 10 sec
> [Pipeline] [one] echo
> [one] Finished phase three
> [Pipeline] [one] }
> [Pipeline] [two] echo
> [two] Finished phase three
> [Pipeline] [two] }
> [Pipeline] [three] echo
> [three] Finished phase three
> [Pipeline] [three] }
> [Pipeline] // parallel
> [Pipeline] }
> [Pipeline] // script
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> Finished: SUCCESS
>
>
> Please note that all phases are saying "three":
>
> [*two*] Finished phase *three*
>
> I was thinking that maybe there's a need for some kind of splat operator 
> on argument for "parallel", but pipeline parallel example 
>  doesn't use 
> it (and when I tried I got java.lang.UnsupportedOperationException)
>
> What am I not seeing here? Why the closures are not created properly?
>

-- 
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/1418333c-4b96-4644-9b62-33d9264aad92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Dynamic closures called in parallel

2017-08-09 Thread Mirek S
Hi!

I'm using the following Pipeline script:

testruns = [:]
for (name in ["one", "two", "three"]) {
  print("Adding ${name} to testruns")
  testruns[name] = { print("Staring phase ${name}"); sleep 10; 
print("Finished phase ${name}")}
}

pipeline {
  agent { label 'master' }
  stages {
stage("Parallelism") {
  steps {
script {
  parallel testruns
}
  }
}
  }
}

I'm expecting to run those three dynamically created closures in parallel. 
But it appears that all closures were created using only the last field 
("three"). Console output:

Started by user ...
[Pipeline] echo
Adding one to testruns
[Pipeline] echo
Adding two to testruns
[Pipeline] echo
Adding three to testruns
[Pipeline] node
Running on master in ...
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Parallelism)
[Pipeline] script
[Pipeline] {
[Pipeline] parallel
[Pipeline] [one] { (Branch: one)
[Pipeline] [two] { (Branch: two)
[Pipeline] [three] { (Branch: three)
[Pipeline] [one] echo
[one] Staring phase three
[Pipeline] [one] sleep
[one] Sleeping for 10 sec
[Pipeline] [two] echo
[two] Staring phase three
[Pipeline] [two] sleep
[two] Sleeping for 10 sec
[Pipeline] [three] echo
[three] Staring phase three
[Pipeline] [three] sleep
[three] Sleeping for 10 sec
[Pipeline] [one] echo
[one] Finished phase three
[Pipeline] [one] }
[Pipeline] [two] echo
[two] Finished phase three
[Pipeline] [two] }
[Pipeline] [three] echo
[three] Finished phase three
[Pipeline] [three] }
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS


Please note that all phases are saying "three":

[*two*] Finished phase *three*

I was thinking that maybe there's a need for some kind of splat operator on 
argument for "parallel", but pipeline parallel example 
 doesn't use it 
(and when I tried I got java.lang.UnsupportedOperationException)

What am I not seeing here? Why the closures are not created properly?

-- 
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/9fe68722-9d88-4077-89ec-65aa786912aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to group and sort tests and run in parallel without Parallel Test Executor Plugin

2017-08-09 Thread Viacheslav Dubrovskyi

Hi Michael,

We have list of tests which I would like run in parallel. The Parallel 
Test Executor Plugin doesn't work in our case, because we don't use 
junit and the list of tests (behatList) is result of script work. I 
can't run all tests on one node because it will take about 16 hours.


So I save results of previous builds to groovy file as map and load it 
before (suitesStat) . Then I group and sort tests (sortSuites(suites, 
suites_time) in previous post). And then I use this list for create 
parallel run.



def behatList =['AutoSuiteSet_0', 'AutoSuiteSet_1', 'AutoSuiteSet_2', 
'AutoSuiteSet_3', 'AutoSuiteSet_4', 'AutoSuiteSet_5']
def suitesStat=[AutoSuiteSet_0:0, AutoSuiteSet_1:1, AutoSuiteSet_2:2, 
AutoSuiteSet_3:3, AutoSuiteSet_4:4, AutoSuiteSet_5:5]

behatList2=sortSuites(behatList, suitesStat)

stage("test") {
behatList=sortSuites(behatList, suitesStat)
def enviroments_b = [failFast: failFirstError]
for (int j = 0; j < behatList.size() ; j++) {
int index_b=j
enviroments_b["TestEnv behat=${behatList[index_b]}"] = {
  node('behat') {
 for (int j2 = 0; j2 < behatList[index_b].size() ; j2++) {
int index_b2=j2
sh "./run_test ${behatList[index_b][index_b2]}"
 }
  }
}
}
parallel enviroments_b
}
...



06.08.2017 17:47, Michael Pailloncy пишет:
However, what do you want to achieve exactly ? 


--
WBD,
Viacheslav Dubrovskyi

--
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/bad445be-212a-6f0b-7001-0c9212761be1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Change context used in github status

2017-08-09 Thread Viacheslav Dubrovskyi

Hi All,

I use 2 multibranch jobs from one repository and 
github-branch-source-plugin used for set build status in pull request.


2 jobs because we need to split it to regular and regression jobs. All 
jobs have PRs. And PR from every jobs set the same status in github PR.


How can I change context (continuous-integration/jenkins/pr-merge or 
continuous-integration/jenkins/branch), which used in github status?


I see that it looks hardcoded in 
https://github.com/jenkinsci/github-branch-source-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubBuildStatusNotification.java#L79


Am I right?

If yes, how can I disable setting the status by github-branch-source-plugin?

Thank you for advice.

--
WBD,
Viacheslav Dubrovskyi

--
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/39b045c3-e92a-daf0-02a0-83ce265c05a6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with NotSerializableException in pipeline

2017-08-09 Thread Viacheslav Dubrovskyi

Hi

> Also is the suitesStat properly defined when declared?

Yes. Also I check size of map in function.


07.08.2017 15:41, jer...@bodycad.com пишет:
Maybe not relevent, but I would declare the function above/before the 
main stage. Maybe this won't change anything. Also is the suitesStat 
properly defined when declared? [AutoSuiteSet_0:0 ...]

--
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/196f9dc8-3445-4fca-8030-475caaec4191%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
WBD,
Viacheslav Dubrovskyi

--
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/eb7a4350-938c-9a12-b24a-9f0cfab24143%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with NotSerializableException in pipeline

2017-08-09 Thread Viacheslav Dubrovskyi

Hi All,

Thank you for answers. Finally I found correct way. Only map.sort was 
necessary move under @NonCPS function.

My work pipeline looks:


def behatList =['AutoSuiteSet_0', 'AutoSuiteSet_1', 'AutoSuiteSet_2', 
'AutoSuiteSet_3', 'AutoSuiteSet_4', 'AutoSuiteSet_5']
def suitesStat=[AutoSuiteSet_0:0, AutoSuiteSet_1:1, AutoSuiteSet_2:2, 
AutoSuiteSet_3:3, AutoSuiteSet_4:4, AutoSuiteSet_5:5]


stage("test") {
node('master') {
behatList2=sortSuites(behatList, suitesStat)
echo "SUITES2=${behatList2}"
}
}

def sortSuites(suites, suites_time){
def suitesMap = [:]
if (suites_time.size()>0){
timeLimit = suites_time.values().max()
for(s in suites){
  x = suites_time.find{ artifact -> artifact.key == s}
  if(x){
suitesMap.put(x.key, x.value)
  }else{
suitesMap.put(s, timeLimit)
  }
}
}else{
suitesList = suites.collect { t -> [t] }
return suitesList
}
tasks = divideList(suitesMap)
tasks = sortListInMap(tasks)
tasksList = tasks.collect { t -> t.keySet()}
return tasksList
}

def divideList(inputMap){
inputMap=sortMap(inputMap)
maxValue = inputMap.values().max()
def outputSet = []
def outputMap = [:]
for (inputElement in inputMap) {
   possibleMap = outputMap + [inputElement]
   possibleMapSum = possibleMap.values().sum()
   if (possibleMapSum < maxValue) {
   outputMap = possibleMap
   }else if(possibleMapSum == maxValue) {
   outputSet.add(possibleMap)
   outputMap = [:]
   }else if(possibleMapSum > maxValue) {
   outputSet.add(outputMap)
   outputMap = [:]
   outputMap.put(inputElement.key, inputElement.value)
   }
}
if (outputMap) {
   outputSet.add(outputMap)
}
return outputSet
}

@NonCPS
def sortMap(map) {
  map.sort{a, b -> b.value <=> a.value }
}

@NonCPS
def sortListInMap(map) {
map.sort { a, b -> b.values().sum() <=> a.values().sum() }
}




06.08.2017 17:47, Michael Pailloncy пишет:
It seems like there are some variables used out of their scope and 
some misused Groovy methods.


Here is a working version, IIUC your pipeline :-)

#!groovy

def behatList =['AutoSuiteSet_0', 'AutoSuiteSet_1', 'AutoSuiteSet_2', 
'AutoSuiteSet_3', 'AutoSuiteSet_4', 'AutoSuiteSet_5']
def suitesStat=[AutoSuiteSet_0:0, AutoSuiteSet_1:1, AutoSuiteSet_2:2, 
AutoSuiteSet_3:3, AutoSuiteSet_4:4, AutoSuiteSet_5:5]


stage("test") {
node('master') {
behatList2=sortSuites(behatList, suitesStat)
echo "SUITES2=${behatList2}"
}
}

@NonCPS
def sortSuites(suites, suites_time){
def timeLimit = suites_time.values().max()
def suitesMap= [:]
for(s in suites){
def x = suites_time.find{ artifact -> artifact.key == s}
if(x){
suitesMap.put(x.key, x.value)
}else{
suitesMap.put(s, timeLimit)
}
}
def tasks = [suitesMap]
timeLimit = suitesMap.values().max()
while(canSplit(tasks, timeLimit)) {
tasks = tasks.collect { t ->
if(checkLimit(t, timeLimit)){
t = splitTo2(t)
}
t
}.flatten()
}
tasks.sort { a, b -> b.values().sum() <=> a.values().sum() }
// tasks = tasks.collect { t -> t.keySet()} // not working, multiple 
elements are collected here

tasks = tasks.collectMany { t -> t.keySet()}
return tasks
}


@NonCPS
def checkLimit(t, timeLimit) {
if(t.values().sum()>timeLimit && t.size()>1){
return true
}else{
return false
}
}

@NonCPS
def canSplit(tasks, timeLimit) {
for(t in tasks) {
if(checkLimit(t, timeLimit)){
return true
  }
  }
return false
}


@NonCPS
def splitTo2(int_map) {
A=[:]
B=[:]

// int_map.sort{it.value} not working
// for(n in int_map.sort{it.value}) {
for(n in int_map) {
if (A.size() < B.size()) {
A.put(n.key, n.value)
}else{
B.put(n.key, n.value)
}
}
return [A, B]
}


However, what do you want to achieve exactly ? One of the main 
advantage of Pipeline is its resumability after restart. But if you 
use too many @NonCPS, you avoid this feature and this could lead to 
unexpected behaviour sometimes.


Hopefully it helps :-)


2017-08-04 19:17 GMT+02:00 Slava Dubrovskiy >:


Hi.

I use a special algorithm to pre-sort the steps for parallel start.
Here is my test pipeline:

|
#!groovy

defbehatList

=['AutoSuiteSet_0','AutoSuiteSet_1','AutoSuiteSet_2','AutoSuiteSet_3','AutoSuiteSet_4','AutoSuiteSet_5']

defsuitesStat=[AutoSuiteSet_0:0,AutoSuiteSet_1:1,AutoSuiteSet_2:2,AutoSuiteSet_3:3,AutoSuiteSet_4:4,AutoSuiteSet_5:5]

stage("test"){
node('master'){
behatList2=sortSuites(behatList,suitesStat)
echo "SUITES2=${behatList2}"
}
}

@NonCPS
defsortSuites(suites,suites_time){
timeLimit =suites_time.values().max()
defsuitesMap=[:]
for(s insuites){
x=suites_time.find{artifact ->artifact.key ==s}
if(x){
suitesMap.put(x.key,x.value)
}else{

Parsing POM take a long time after rename Jenkins slave name

2017-08-09 Thread tiendungitd
In jenkins, when I go to manage node, and rename a slave node like server8.1
to server 8.2, still the same server, then I try to build, the job build
take a lot of time at parsing POM step, around 6-8mins, even I already build
this job before with slave name server 8.1, it's mean this server slave
already have dependencies. Next build job, it run normaly. Does anyone know
what Jenkins did in parsing POM step, what they copied from master?



--
View this message in context: 
http://jenkins-ci.361315.n4.nabble.com/Parsing-POM-take-a-long-time-after-rename-Jenkins-slave-name-tp4901153.html
Sent from the Jenkins users mailing list archive at Nabble.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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1502263042498-4901153.post%40n4.nabble.com.
For more options, visit https://groups.google.com/d/optout.


The format of key of containerEnvVar within Jenkins Kubernetes Plugin

2017-08-09 Thread WANG, YAN-HONG
Hello,

I am Hong.

I saw "*containerEnvVar*" was supported by Jenkins *Kubernetes* Plugin 0.9.
But, it seems not support some key value with *dot*?

Example in *containerTemplate*:
*containerEnvVar*( key: “*data.source.url*”, value: “somewhere” )

I tried to use *backslash *to escape *dot*, but Jenkins parser doesn't pass
it.

Someone has idea?

Thanks very much.

Best regards,
Hong

-- 
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/CADLWyO1jrOYcJzMgBFZvMy0uENVjMORJsrSr%3DUoi%2Bf%2B-jGP-dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Parameterized build driven by Jenkinsfile

2017-08-09 Thread Craig Barr
Thanks Jacob and Alex!

Which version of Jenkins does this work for you on?
I've tried with the following Jenkinsfile on 2.46.1 but no matter how many 
times I ran, the parameters never showed up in the console.

parameters {

   string(name: 'bld', defaultValue: 'full', description: '')

   string(name: 'branch', defaultValue: 'dev', description: '')

}


node {

   if (getBinding().hasVariable("bld")) {

  echo "SET"

   } else {

  echo "NOTSET"

   }

}

On Friday, 4 August 2017 03:27:44 UTC+10, Alex Marcon wrote:
>
> That's right... to define, it is something like:
>
> parameters {
> string(name: 'bld', defaultValue: 'full', description: '')
> string(name: 'branch', defaultValue: 'dev', description: '')
> }
>
> you may load some properties from a file and use those variables for 
> defaultValue...
>
> AM
>
> On Thursday, 3 August 2017 04:13:54 UTC-4, Jacob Larsen wrote:
>>
>> Yes, kind of...
>>
>> The parameters are hidden in the "properties" structure. They will be 
>> applied to the job when it runs, meaning that the first run will not have 
>> these parameters defined. If you make your Jenkinsfile robust for undefined 
>> parameters, it should be doable, just remember that they will apply to the 
>> second build.
>>
>> /Jacob
>>
>> On 2017-08-03 04:03, Craig Barr wrote:
>>
>> In Jenkins you can select "This project is parameterized" and add 
>> parameters. My question is simple: 
>> Can this parameter metadata be populated by an alternative 
>> version-controlled source? 
>>
>> For example, can I define parameter definitions in my Jenkinsfile so that 
>> when I click Build Now it will populate the parameters from this source?
>> If this is not possible, are they any other suggestions for addressing 
>> such a requirement?
>>
>> Thanks!
>>
>> *Oracle Excellence Award Specialized Partner of the Year: Middleware, 
>> Asia Pacific 
>> *
>>
>>
>>
>> Rubicon Red Privacy Policy  
>> -- 
>> 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/eb7dca33-81d0-4b35-9045-0ab521327109%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/e4e728c9-553a-4720-96c7-5ac29bddabb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.