provide a way to turn off the build-job validation check

Some projects want to tag repositories that do not have explicit build
artifacts. This patch adds a somewhat generic "flag" system for adding
this and similar settings on a per-repository basis.

Change-Id: I40d73987f91409e760177b573c1c300c091ef09e
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-06-06 13:11:00 -04:00
parent 5e430814f5
commit 33313ff757
3 changed files with 41 additions and 2 deletions

View File

@ -198,6 +198,17 @@ The top level of a deliverable file is a mapping with keys:
none
Do not link to anything, just show the version number.
``repository-settings``
Mapping of special settings to control the behavior for each repository, keyed
by the repository name.
``flags``
A list of flags attached to the repository.
``no-artifact-build-job``
This repository has no job for building an artifact, but should
be tagged anyway.
``releases``
A list of the releases for the deliverable.
@ -286,3 +297,21 @@ be described by ``deliverables/mitaka/neutron.yaml`` containing:
hash: 19b18f05037dae4bbbada848aae6421da18ab490
- repo: openstack/neutron-vpnaas
hash: a1b12601a64a2359b2224fd4406c5db008484700
To allow tagging for repositories without build artifacts, set the
``no-artifact-build-job`` flag.
::
---
launchpad: astara
send-announcements-to: openstack-announce@lists.openstack.org
repository-settings:
openstack/astara-appliance:
flags:
- no-artifact-build-job
releases:
- version: 9.0.0.0b1
projects:
- repo: openstack/astara-appliance
hash: c21a64ea7b3b0fbdab8592afecdd31d9b8e64a6a

View File

@ -172,7 +172,7 @@ def main():
# Check for release jobs (if we ship a tarball)
if link_mode != 'none':
pce = project_config.require_release_jobs_for_repo(
zuul_layout, project['repo'])
deliverable_info, zuul_layout, project['repo'])
for msg, is_error in pce:
print(msg)
if is_error:

View File

@ -44,7 +44,7 @@ def get_zuul_layout_data(url=ZUUL_LAYOUT_URL):
return raw
def require_release_jobs_for_repo(zuul_layout, repo):
def require_release_jobs_for_repo(deliverable_info, zuul_layout, repo):
"""Check the repository for release jobs.
Returns a list of tuples containing a message and a boolean
@ -53,6 +53,16 @@ def require_release_jobs_for_repo(zuul_layout, repo):
"""
errors = []
# Look up the flags for this repository.
all_settings = deliverable_info.get('repository-settings', {})
repo_settings = all_settings.get(repo, {})
flags = repo_settings.get('flags', [])
# If the repository is configured as not having an artifact to
# build, we don't need to check for any jobs.
if 'no-artifact-build-job' in flags:
return errors
if repo not in zuul_layout[_VALIDATE_KEY]:
errors.append(
('did not find %s in %s' % (repo, ZUUL_LAYOUT_FILENAME),