Re: How to dynamically get list of branches or pull requests in Jenkinsfile/groovy?

2017-08-08 Thread Danny Rehelis
Check this plugin -
https://wiki.jenkins.io/display/JENKINS/Git+Parameter+Plugin
If you may change your build behavior from user input to parameter, this
plugin might serve you well.

On Tue, Aug 8, 2017 at 11:00 AM Stephen Connolly <
stephen.alan.conno...@gmail.com> wrote:

> You'd best be served by writing a plugin with a step...
>
> Start from the code for resolveScm and you should be able to modify that
> to return a list of branch names rather than the current behaviour of
> returning a scm instance for a specific named branch (resolveScm will have
> a delta from what you want but it should have the smallest delta)
>
> On Mon 7 Aug 2017 at 18:49, Mark Stosberg  wrote:
>
>> Currently I've got an input() call in my Jenkinsfile that prompts users
>> to select a branch name to manually deploy:
>>
>>   userInput = input(
>>id: 'userInput', message: 'Manual Deploy?', parameters: [
>>[$class: 'ChoiceParameterDefinition', choices:
>> 'develop\nmaster\nPR-124', description: 'Branch to deploy', name: 'branch',
>> defaultValue: 'develop'],
>>   ])
>>
>> Instead of hardcoding a list branch names, how can I dynamically build
>> this list based on the list of the pull requests that are already known to
>> Jenkins in our multlbranch pipeline configuration?
>>
>> Jenkins is configured to automatically build new pull requests already.
>>
>> Thanks,
>>
>>   Mark
>>
>> --
>> 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/a0c15c4e-805c-4a41-bdf6-9cf42014b23e%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Sent from my phone
>
> --
> 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/CA%2BnPnMxXbw%2BpWwZpvQhrBx-%2B3eEuC-d9iOZz24fRf1i511nmaQ%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/CAObRFCXED%3D0zM6AzGFXjo5Z_a2Mr2E0f%2BwhPkiO%3DnFvNew0kFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to dynamically get list of branches or pull requests in Jenkinsfile/groovy?

2017-08-08 Thread Stephen Connolly
You'd best be served by writing a plugin with a step...

Start from the code for resolveScm and you should be able to modify that to
return a list of branch names rather than the current behaviour of
returning a scm instance for a specific named branch (resolveScm will have
a delta from what you want but it should have the smallest delta)

On Mon 7 Aug 2017 at 18:49, Mark Stosberg  wrote:

> Currently I've got an input() call in my Jenkinsfile that prompts users to
> select a branch name to manually deploy:
>
>   userInput = input(
>id: 'userInput', message: 'Manual Deploy?', parameters: [
>[$class: 'ChoiceParameterDefinition', choices:
> 'develop\nmaster\nPR-124', description: 'Branch to deploy', name: 'branch',
> defaultValue: 'develop'],
>   ])
>
> Instead of hardcoding a list branch names, how can I dynamically build
> this list based on the list of the pull requests that are already known to
> Jenkins in our multlbranch pipeline configuration?
>
> Jenkins is configured to automatically build new pull requests already.
>
> Thanks,
>
>   Mark
>
> --
> 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/a0c15c4e-805c-4a41-bdf6-9cf42014b23e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from my phone

-- 
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/CA%2BnPnMxXbw%2BpWwZpvQhrBx-%2B3eEuC-d9iOZz24fRf1i511nmaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to dynamically get list of branches or pull requests in Jenkinsfile/groovy?

2017-08-07 Thread Mark Stosberg
Currently I've got an input() call in my Jenkinsfile that prompts users to 
select a branch name to manually deploy:

  userInput = input( 
   id: 'userInput', message: 'Manual Deploy?', parameters: [ 
   [$class: 'ChoiceParameterDefinition', choices: 
'develop\nmaster\nPR-124', description: 'Branch to deploy', name: 'branch', 
defaultValue: 'develop'], 
  ]) 

Instead of hardcoding a list branch names, how can I dynamically build this 
list based on the list of the pull requests that are already known to 
Jenkins in our multlbranch pipeline configuration?

Jenkins is configured to automatically build new pull requests already. 

Thanks,

  Mark

-- 
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/a0c15c4e-805c-4a41-bdf6-9cf42014b23e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.