[OpenStack-Infra] anyway to create ENV variables in JJB?

Antoine Musso hashar at free.fr
Mon Feb 24 09:46:59 UTC 2014


Le 24/02/2014 02:09, Sean Dague a écrit :
> After seeing grenade jobs fail the inner / outer timeout because it
> turns out there are > 5 minutes of time outside the main run job, I
> pulled together this new approach - https://review.openstack.org/#/c/75726/
> 
> Ideally it would be nice to not have to keep adding a
> DEVSTACK_GATE_TIMEOUT into all the jobs, but instead use the existing
> time definition from devstack-gate.yaml
> 
> 
>    wrappers:
>       - timeout:
>           timeout: 130
>           fail: true
> 
> What would be needed would be to make that timeout value available as an
> environmental variable some how.
> 
> Any thoughts on how to make that happen?

Hello,

The Jenkins "Build Timeout" plugin does not support parameters and would
fallback to a 3 minutes timeout whenever it is passed a non integer
value :-(

Some Java guru might be able to add support to the plugin so it
recognize build parameters properly (ex: TIMEOUT).


On the JJB side, you could use a parameters in a job-template:

- job-template:
    name: 'timeout-job'
    wrappers:
     - timeout:
         timeout: "{timeout}"
         fail: true

Then invoke the template filling the 'timeout' parameter, either at the
job level:

- project:
    name: project
    jobs:
     - timeout-job:
         timeout: 30

Or at the project level:

- project:
    name: project
    timeout: 30
    jobs:
     - timeout-job

In both cases you will end up with the following XML:

<project>
  ...
  <buildWrappers>
    <hudson.plugins.build__timeout.BuildTimeoutWrapper>
      <!-- And here you have {timeout} expanded to 30 -->
      <timeoutMinutes>30</timeoutMinutes>
      <failBuild>true</failBuild>
      ...
    </hudson.plugins.build__timeout.BuildTimeoutWrapper>
  </buildWrappers>
</project>


cheers,

-- 
Antoine "hashar" Musso



More information about the OpenStack-Infra mailing list