2013-08-12 13:27:50 -07:00
|
|
|
# Copyright 2013 OpenStack Foundation
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
2014-06-19 10:41:35 -07:00
|
|
|
import re
|
|
|
|
|
2013-09-20 14:58:20 -07:00
|
|
|
|
2013-07-29 10:46:53 -07:00
|
|
|
def set_log_url(item, job, params):
|
2013-07-09 10:53:27 -07:00
|
|
|
if hasattr(item.change, 'refspec'):
|
2014-12-12 14:54:41 +11:00
|
|
|
path = "%s/%s/%s/%s/" % (
|
2013-07-09 10:53:27 -07:00
|
|
|
params['ZUUL_CHANGE'][-2:], params['ZUUL_CHANGE'],
|
|
|
|
params['ZUUL_PATCHSET'], params['ZUUL_PIPELINE'])
|
2013-08-01 15:54:12 -07:00
|
|
|
elif hasattr(item.change, 'ref'):
|
2014-12-12 14:54:41 +11:00
|
|
|
path = "%s/%s/%s/" % (
|
2013-07-09 10:53:27 -07:00
|
|
|
params['ZUUL_NEWREV'][:2], params['ZUUL_NEWREV'],
|
|
|
|
params['ZUUL_PIPELINE'])
|
2013-08-01 15:54:12 -07:00
|
|
|
else:
|
2015-03-10 11:55:24 -07:00
|
|
|
path = params['ZUUL_PIPELINE'] + '/'
|
2013-07-09 10:53:27 -07:00
|
|
|
params['BASE_LOG_PATH'] = path
|
2014-12-17 12:09:59 +11:00
|
|
|
params['LOG_PATH'] = path + '%s/%s/' % (job.name,
|
|
|
|
params['ZUUL_UUID'][:7])
|
2013-08-12 13:27:50 -07:00
|
|
|
|
|
|
|
|
2014-06-19 10:41:35 -07:00
|
|
|
def reusable_node(item, job, params):
|
|
|
|
if 'OFFLINE_NODE_WHEN_COMPLETE' in params:
|
|
|
|
del params['OFFLINE_NODE_WHEN_COMPLETE']
|
|
|
|
|
|
|
|
|
2015-12-22 06:03:57 +00:00
|
|
|
def set_node_options(item, job, params):
|
2016-01-07 17:29:18 -08:00
|
|
|
# Force tox to pass through ZUUL_ variables
|
|
|
|
zuul_params = [x for x in params.keys() if x.startswith('ZUUL_')]
|
2016-01-08 12:08:33 -08:00
|
|
|
params['TOX_TESTENV_PASSENV'] = ' '.join(zuul_params)
|
2015-10-30 17:36:39 +02:00
|
|
|
# Set up log url parameter for all jobs
|
2013-08-12 13:27:50 -07:00
|
|
|
set_log_url(item, job, params)
|
2016-09-22 02:16:52 +00:00
|
|
|
# Default to single use node. Potentially overridden below.
|
2014-06-19 10:41:35 -07:00
|
|
|
# Select node to run job on.
|
2013-08-12 13:27:50 -07:00
|
|
|
params['OFFLINE_NODE_WHEN_COMPLETE'] = '1'
|
2016-03-11 14:59:40 -08:00
|
|
|
# Pass tags through for subunit2sql
|
|
|
|
params['JOB_TAGS'] = ' '.join(sorted(job.tags))
|
2016-10-06 09:33:54 -04:00
|
|
|
proposal_re = r'^.*(propose|upstream)-(.*?)-(constraints-.*|updates?|update-(liberty|mitaka|newton)|plugins-list|openstack-constraints)$' # noqa
|
2015-10-07 15:56:50 -07:00
|
|
|
release_re = r'^.*-(forge|jenkinsci|mavencentral|pypi-(both|wheel)|npm)-upload$'
|
2015-07-28 12:28:50 -04:00
|
|
|
hook_re = r'^hook-(.*?)-(rtfd)$'
|
2016-02-04 20:01:27 -08:00
|
|
|
wheel_re = r'^wheel-(build|release)-.*$'
|
2016-07-17 14:08:50 -04:00
|
|
|
reprepro_re = r'^reprepro-(import|release|sign)-.*$'
|
2016-07-15 15:48:25 +00:00
|
|
|
signing_re = r'^(.*-tarball-signing|tag-releases)$'
|
2016-07-19 10:59:28 +02:00
|
|
|
# jobs run on the persistent proposal, release, signing, and wheel
|
|
|
|
# build workers
|
2016-02-04 07:28:24 -08:00
|
|
|
if (re.match(proposal_re, job.name) or
|
|
|
|
re.match(release_re, job.name) or
|
|
|
|
re.match(hook_re, job.name) or
|
2016-07-11 18:55:00 -04:00
|
|
|
re.match(reprepro_re, job.name) or
|
2016-07-19 08:18:36 +02:00
|
|
|
re.match(signing_re, job.name) or
|
2016-02-04 07:28:24 -08:00
|
|
|
re.match(wheel_re, job.name)):
|
2014-06-19 10:41:35 -07:00
|
|
|
reusable_node(item, job, params)
|