Re: Parameterized build driven by Jenkinsfile

2017-08-10 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.


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=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


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.


Re: Parameterized build driven by Jenkinsfile

2017-08-03 Thread Alex Marcon
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/839e9a5f-acef-413a-a73b-0e72e6ace741%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Parameterized build driven by Jenkinsfile

2017-08-03 Thread Jacob Larsen

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-users+unsubscr...@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/ef2112a4-a9a0-36be-c420-b3a5d674acb7%40larsen.net.
For more options, visit https://groups.google.com/d/optout.