Re: Automating the Choice Parameter on a job

2020-10-19 Thread Kari Cowan
Nice. That’s a good tip. Thanks 

On Mon, Oct 19, 2020 at 4:36 PM Jan Monterrubio 
wrote:

> Yep, if docker tags can return you json, you can just slurp stuff and
> transform it.
>
> On Mon, Oct 19, 2020 at 09:27 Kari Cowan  wrote:
>
>> This is clever - thanks.
>>
>> I don't have a directory of files in my git project- but I am guessing I
>> could write something to add - like a deployment tag list that matches the
>> docker registry?
>>
>> Ideally I would pull the docker register tag list and use that.
>>
>>
>> On Fri, Oct 16, 2020 at 1:15 PM janmont...@gmail.com <
>> janmonterru...@gmail.com> wrote:
>>
>>>  import groovy.json.JsonSlurperClassic
>>>  def jsonSlurper = new JsonSlurperClassic()
>>> def response = jsonSlurper.parse(new URL("SOME REPO HERE"))
>>> return response
>>>
>>> It was something like that ^
>>>
>>> You can always start with a "return [ 'a', 'b'] " , we used the
>>> ActiveChoice reactive parameter
>>>
>>>
>>> On Thursday, October 15, 2020 at 11:32:33 PM UTC-5 janmont...@gmail.com
>>> wrote:
>>>
 I’ve used the extended choice parameter to pull a list of files from a
 directory in github and display a set of checkboxes. I’ll remember to grab
 you a snippet tomorrow during work!



 On Thu, Oct 15, 2020 at 17:01 Kari Cowan  wrote:

> I am working on a Jenkins job to rollback a Docker container to the
> previous version.  This on its own is pretty straight-forward, but what I
> want to do is get my list of available tags from the registry. As opposed
> to going to the registry-page and seeing what's available, then copy/paste
> a value into a form on Jenkins, I'd like to automate that step somehow - 
> by
> grabbing the data from the registry page and displaying the options in a
> choice parameter in Jenkins on the build screen.
>
> For example, call in the registry url by ip, example,
> 10.11.12.199:5000/v2/some-api/tags/list might display some JSON like:
> {"name":"some-api","tags":["qa_api-11","qa_api-12","qa_api-13"]}
>
> What's the best tool for this?  I'm no Groovy expert but would the
> Extensible Choice Parameter plugin coupled with a Groovy script be useful
> here? I'm not really clued up yet if this is possible in Groovy, but am
> open to suggestions.  Does anyone have any tips on that or other methods
> that are better?
>
>
>
> --
> 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/CAE7w4hg_RpwfVYAh7m9FLc1oxCPZQuqwd-eMpj6kFgBdMsJoOA%40mail.gmail.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/d99e92f5-f7a8-493c-b90a-997aa6aec02fn%40googlegroups.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/CAE7w4hiWP_btV6D4oh0y0mPH92TpuwG7e-RdEM7BTP%3DbvDe-7Q%40mail.gmail.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/CADgiF9LDMDY5WZKfYdSZPq2x9-5pMW34kRaoPMeKfEbDt%3DJcVA%40mail.gmail.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 

Re: Automating the Choice Parameter on a job

2020-10-19 Thread Jan Monterrubio
Yep, if docker tags can return you json, you can just slurp stuff and
transform it.

On Mon, Oct 19, 2020 at 09:27 Kari Cowan  wrote:

> This is clever - thanks.
>
> I don't have a directory of files in my git project- but I am guessing I
> could write something to add - like a deployment tag list that matches the
> docker registry?
>
> Ideally I would pull the docker register tag list and use that.
>
>
> On Fri, Oct 16, 2020 at 1:15 PM janmont...@gmail.com <
> janmonterru...@gmail.com> wrote:
>
>>  import groovy.json.JsonSlurperClassic
>>  def jsonSlurper = new JsonSlurperClassic()
>> def response = jsonSlurper.parse(new URL("SOME REPO HERE"))
>> return response
>>
>> It was something like that ^
>>
>> You can always start with a "return [ 'a', 'b'] " , we used the
>> ActiveChoice reactive parameter
>>
>>
>> On Thursday, October 15, 2020 at 11:32:33 PM UTC-5 janmont...@gmail.com
>> wrote:
>>
>>> I’ve used the extended choice parameter to pull a list of files from a
>>> directory in github and display a set of checkboxes. I’ll remember to grab
>>> you a snippet tomorrow during work!
>>>
>>>
>>>
>>> On Thu, Oct 15, 2020 at 17:01 Kari Cowan  wrote:
>>>
 I am working on a Jenkins job to rollback a Docker container to the
 previous version.  This on its own is pretty straight-forward, but what I
 want to do is get my list of available tags from the registry. As opposed
 to going to the registry-page and seeing what's available, then copy/paste
 a value into a form on Jenkins, I'd like to automate that step somehow - by
 grabbing the data from the registry page and displaying the options in a
 choice parameter in Jenkins on the build screen.

 For example, call in the registry url by ip, example,
 10.11.12.199:5000/v2/some-api/tags/list might display some JSON like:
 {"name":"some-api","tags":["qa_api-11","qa_api-12","qa_api-13"]}

 What's the best tool for this?  I'm no Groovy expert but would the
 Extensible Choice Parameter plugin coupled with a Groovy script be useful
 here? I'm not really clued up yet if this is possible in Groovy, but am
 open to suggestions.  Does anyone have any tips on that or other methods
 that are better?



 --
 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/CAE7w4hg_RpwfVYAh7m9FLc1oxCPZQuqwd-eMpj6kFgBdMsJoOA%40mail.gmail.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/d99e92f5-f7a8-493c-b90a-997aa6aec02fn%40googlegroups.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/CAE7w4hiWP_btV6D4oh0y0mPH92TpuwG7e-RdEM7BTP%3DbvDe-7Q%40mail.gmail.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/CADgiF9LDMDY5WZKfYdSZPq2x9-5pMW34kRaoPMeKfEbDt%3DJcVA%40mail.gmail.com.


Re: Automating the Choice Parameter on a job

2020-10-19 Thread Kari Cowan
This is clever - thanks.

I don't have a directory of files in my git project- but I am guessing I
could write something to add - like a deployment tag list that matches the
docker registry?

Ideally I would pull the docker register tag list and use that.


On Fri, Oct 16, 2020 at 1:15 PM janmont...@gmail.com <
janmonterru...@gmail.com> wrote:

>  import groovy.json.JsonSlurperClassic
>  def jsonSlurper = new JsonSlurperClassic()
> def response = jsonSlurper.parse(new URL("SOME REPO HERE"))
> return response
>
> It was something like that ^
>
> You can always start with a "return [ 'a', 'b'] " , we used the
> ActiveChoice reactive parameter
>
>
> On Thursday, October 15, 2020 at 11:32:33 PM UTC-5 janmont...@gmail.com
> wrote:
>
>> I’ve used the extended choice parameter to pull a list of files from a
>> directory in github and display a set of checkboxes. I’ll remember to grab
>> you a snippet tomorrow during work!
>>
>>
>>
>> On Thu, Oct 15, 2020 at 17:01 Kari Cowan  wrote:
>>
>>> I am working on a Jenkins job to rollback a Docker container to the
>>> previous version.  This on its own is pretty straight-forward, but what I
>>> want to do is get my list of available tags from the registry. As opposed
>>> to going to the registry-page and seeing what's available, then copy/paste
>>> a value into a form on Jenkins, I'd like to automate that step somehow - by
>>> grabbing the data from the registry page and displaying the options in a
>>> choice parameter in Jenkins on the build screen.
>>>
>>> For example, call in the registry url by ip, example,
>>> 10.11.12.199:5000/v2/some-api/tags/list might display some JSON like:
>>> {"name":"some-api","tags":["qa_api-11","qa_api-12","qa_api-13"]}
>>>
>>> What's the best tool for this?  I'm no Groovy expert but would the
>>> Extensible Choice Parameter plugin coupled with a Groovy script be useful
>>> here? I'm not really clued up yet if this is possible in Groovy, but am
>>> open to suggestions.  Does anyone have any tips on that or other methods
>>> that are better?
>>>
>>>
>>>
>>> --
>>> 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/CAE7w4hg_RpwfVYAh7m9FLc1oxCPZQuqwd-eMpj6kFgBdMsJoOA%40mail.gmail.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/d99e92f5-f7a8-493c-b90a-997aa6aec02fn%40googlegroups.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/CAE7w4hiWP_btV6D4oh0y0mPH92TpuwG7e-RdEM7BTP%3DbvDe-7Q%40mail.gmail.com.


Re: Matrix in Pipelines

2020-10-19 Thread 'christop...@googlemail.com' via Jenkins Users
You mean something like a dynamic axis created by a piece of script? I had 
a similar issue in the past and did not find a way.
There might be something with script blocks in a pipeline and dynamic 
stage-creation with a for-loop.
When I remember right I found some examples with google when I investigated 
this.

Roland Asmann schrieb am Montag, 19. Oktober 2020 um 10:16:51 UTC+2:

> Hi,
>
> Thanks for that. I see I forgot to mention something in my original 
> post: The nodes I want to run my job on should come from a label. So I 
> would need to get the 'values' in the matrix-part by figuring out which 
> nodes have this label set...
>
> Can I add a simple 1-, maybe 2-line script block in my pipeline to 
> retrieve those values and use them?
>
>
> On 19.10.2020 9:45, 'christop...@googlemail.com' via Jenkins Users wrote:
> > Hi,
> > 
> > I don't exactly understand your problem. Please have a look here:
> > https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/
> > 
> > you very easily can integrate matrix in a declarative pipeline. Insert 
> > your nodes as an axis of the matrix and add an 'agent' in the stage 
> > doing your job.
> > 
> > But maybe I missed a point somewhere...
> > 
> > 
> > Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48 UTC+2:
> > 
> > Hey everybody,
> > 
> > I have this job, written as a declarative pipeline, the now needs to
> > be run on 2 nodes instead of just 1. Before, I would use the
> > Matrix-Job for that, but I am not quite sure how to do this in my
> > pipeline...
> > I searched around a bit and found some example on how to do it with
> > a scripted pipeline, but I would prefer to stick to the declarative
> > format -- if possible. The reason for that is that my team is just
> > learning about pipelines and have just about mastered declarative. I
> > don't want to throw them in the deep end for scripted yet.
> > 
> > Is this possible in declarative? If so, tips would be helpful.
> > If not, at least 1 reply telling me this would also be helpful! ;-)
> > 
> > Thanks,
> > Roland
> > 
> > -- 
> > 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/DLoPOi8U5NI/unsubscribe 
>  >.
> > To unsubscribe from this group and all its topics, send an email to 
> > jenkinsci-use...@googlegroups.com 
> > .
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com?utm_medium=email_source=footer
> >.
>
> -- 
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>

-- 
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/12a60d25-485a-4cf3-a237-a45a470ba959n%40googlegroups.com.


Re: Matrix in Pipelines

2020-10-19 Thread Roland Asmann

Hi,

Thanks for that. I see I forgot to mention something in my original 
post: The nodes I want to run my job on should come from a label. So I 
would need to get the 'values' in the matrix-part by figuring out which 
nodes have this label set...


Can I add a simple 1-, maybe 2-line script block in my pipeline to 
retrieve those values and use them?



On 19.10.2020 9:45, 'christop...@googlemail.com' via Jenkins Users wrote:

Hi,

I don't exactly understand your problem. Please have a look here:
https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/

you very easily can integrate matrix in a declarative pipeline. Insert 
your nodes as an axis of the matrix and add an 'agent' in the stage 
doing your job.


But maybe I missed a point somewhere...


Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48 UTC+2:

Hey everybody,

I have this job, written as a declarative pipeline, the now needs to
be run on 2 nodes instead of just 1. Before, I would use the
Matrix-Job for that, but I am not quite sure how to do this in my
pipeline...
I searched around a bit and found some example on how to do it with
a scripted pipeline, but I would prefer to stick to the declarative
format -- if possible. The reason for that is that my team is just
learning about pipelines and have just about mastered declarative. I
don't want to throw them in the deep end for scripted yet.

Is this possible in declarative? If so, tips would be helpful.
If not, at least 1 reply telling me this would also be helpful! ;-)

Thanks,
Roland

--
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/DLoPOi8U5NI/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/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com 
.


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
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/3276e41f-55ad-e86d-28d8-89f8f7e8f2d9%40gmail.com.


Re: Matrix in Pipelines

2020-10-19 Thread 'christop...@googlemail.com' via Jenkins Users
Hi,

I don't exactly understand your problem. Please have a look here:
https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/

you very easily can integrate matrix in a declarative pipeline. Insert your 
nodes as an axis of the matrix and add an 'agent' in the stage doing your 
job.

But maybe I missed a point somewhere...


Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48 UTC+2:

> Hey everybody,
>
> I have this job, written as a declarative pipeline, the now needs to be 
> run on 2 nodes instead of just 1. Before, I would use the Matrix-Job for 
> that, but I am not quite sure how to do this in my pipeline...
> I searched around a bit and found some example on how to do it with a 
> scripted pipeline, but I would prefer to stick to the declarative format -- 
> if possible. The reason for that is that my team is just learning about 
> pipelines and have just about mastered declarative. I don't want to throw 
> them in the deep end for scripted yet.
>
> Is this possible in declarative? If so, tips would be helpful.
> If not, at least 1 reply telling me this would also be helpful! ;-)
>
> Thanks,
> Roland
>

-- 
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/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com.