Page MenuHomePhabricator

Zuul can only apply one parameter function. Prevent us from injecting both php55 and extension dependencies
Closed, ResolvedPublic

Description

https://gerrit.wikimedia.org/r/267856 is a simple test, merely meant to highlight the issue happening and reported on T125495.

Zuul can only invoke ONE parameter function for a job and the job would need two:

  • set PHP_BIN to switch to PHP5
  • set EXT_DEPENDENCIES

The root cause is CI config change https://gerrit.wikimedia.org/r/#/c/266039/ done as part of T119675: Adjust CI for PHP5.5 support.

+  - name: ^.*php55.*$
+    parameter-function: set_php_bin

Since it matches mwext-testextension-php55, that overrides the dependency injector :-/

Seems like we will need a single parameter function to be applied on all jobs and port the job regex to the parameter function which will then invoke other functions as needed. Something like:

jobs:
 - name: ^.*$
   parameter-function: 'set_parameters'

And our custom set_parameters method would looks like:

import re

def set_parameters(item, job, params):
    if 'php55' in job.name:
        params['PHP_BIN'] = 'php5'

    if re.match( /^mwext-(testextension|qunit|mw-selenium)/, job.name:
        params = set_ext_dependencies(item, job params)
     ...

def set_ext_dependencies(item, job, params):
    # currently existing function

So this way we have all jobs being applied set_parameters and instead of dealing with job filter in the layout file, we deal with them in the python file.

Not much idea how to write an integration test that will cover that though. The parameter function is being called in zuul/launcher/gearman.py by Gearman.updateBuildParams. Unit tests for a new set_parameters() function would probably be sufficient.

Event Timeline

hashar created this task.Feb 2 2016, 10:40 AM
hashar updated the task description. (Show Details)
hashar raised the priority of this task from to Unbreak Now!.
hashar added subscribers: gerritbot, Nikerabbit, hashar and 3 others.
Paladox set Security to None.Feb 2 2016, 11:01 AM
Paladox added a subscriber: Paladox.

Change 268031 had a related patch set uploaded (by Legoktm):
Use a wrapper parameter-function so jobs can have multiple functions

https://gerrit.wikimedia.org/r/268031

Change 268031 merged by jenkins-bot:
Use a wrapper parameter-function so jobs can have multiple functions

https://gerrit.wikimedia.org/r/268031

Legoktm closed this task as Resolved.Feb 8 2016, 1:14 AM

Implemented. I'll file a follow-up for writing tests for set_parameters.

antoine-approve