About 48 hours new to yaml and JJB as we migrate from Hudson to Jenkins and 
have thousands of jobs to move (hence trying to find a better way to manage 
them).  In one case we have 4 sets of jobs (about 20 each) that have very 
similar options except for some of the params.  For the other jenkins 
options in these jobs, I am making variables under the job definitions and 
using them in the shell builder calls and in the job names and such.  I 
also have some defaults that are being used on a global level.

Currently I am implementing different templates for each set of jobs as the 
choice: params have different options per user.  I don't want to set these 
per job (even though I am not sure how to pass a nested option like that), 
as it would mean a lot of maintenance whenever I need to update them across 
a whole pack of jobs.  I want to make sure we can use JJB like the config 
slicing plugin on steroids... change in one place for a whole bunch of 
jobs.  So, basically everything but these dynamic items can be altered in 
one template that all the 80 jobs use.

I am thinking there has to be a way for me to define different choice: 
blocks and key them based on one of the params used in the job: 
definitions.  For example 

    jobs:
        - 'dev-deploy':
            type: dev
            product: productA
            deploy_user: "{dev_user}"

    jobs:
        - 'qa-deploy':
            type: qa
            product: productA
            deploy_user: "{qa_user}"

Now these are obviously using different templates (dev-deploy and 
qa-deploy).  The difference between the templates may be as small as email 
recipients and a choice: param like:

    parameters:
        - choice:
            name: DEPLOY_SERVER
            choices: ['hostname1', 'hostname2']

In the qa-deploy template it might look like:

    parameters:
        - choice:
            name: DEPLOY_SERVER
            choices: ['hostname3', 'hostname4']

I would like to do something like setup a default (which does not work like 
this but you get the idea):

- defaults:
    name: global
    dev_deploy_hosts: ['hostname1', 'hostname2']
    qa_deploy_hosts: ['hostname3', 'hostname4']

And then use those in a single template that all the jobs leverage, since 
the job names are parameterized.  Maybe a multi-level interpolation or 
something like:

    parameters:
       - choice:
           name: DEPLOY_SERVER
           choices: {{type}_deploy_hosts}

Where in the above type changes to dev or qa and then the value is replaced 
from globals by {dev_deploy_hosts} or {qa_deploy_hosts}

What am I missing?  I am sure it is either not possible or something simple 
I am missing.  Hoping it is the second.

Thanks.

P.S. Bonus points for an issue we also came across.  I can't seem to use 
variables in nested jenkins blocks.  For example this works:
    properties:
        - build-discarder:
            days-to-keep: -1
            num-to-keep: 15
            artifact-days-to-keep: -1
            artifact-num-to-keep: -1

But this does not when I set a defaults: of builds_to_keep: 10
    properties:
        - build-discarder:
            days-to-keep: -1
            num-to-keep: {builds_to_keep}
            artifact-days-to-keep: -1
            artifact-num-to-keep: -1


-- 
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/8c94ed79-c9d2-4a38-8f67-182558830e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to