Thanks Jacob. That worked exactly as I would expect!

On Thu, Aug 10, 2017 at 5:40 AM, Jacob Larsen <[email protected]> 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
>>> <http://www.rubiconred.com/oracle-excellence-award-specialized-partner-of-the-year-middleware-asia-pacific/>*
>>>
>>>
>>>
>>> Rubicon Red Privacy Policy <http://www.rubiconred.com/privacy-policy-2/>
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/jenkinsci-users/eb7dca33-81d0-4b35-9045-0ab521327109%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/jenkinsci-users/eb7dca33-81d0-4b35-9045-0ab521327109%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/e4e728c9-553a-4720-96c7-5ac29bddabb8%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/e4e728c9-553a-4720-96c7-5ac29bddabb8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/0978cc69-5cbe-6737-a7dc-802fc3dc1511%40larsen.net
> <https://groups.google.com/d/msgid/jenkinsci-users/0978cc69-5cbe-6737-a7dc-802fc3dc1511%40larsen.net?utm_medium=email&utm_source=footer>
> .
>
> 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 [email protected].
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.

Reply via email to