diff --git a/README.rst b/README.rst index c3821640c6..5e01dce942 100644 --- a/README.rst +++ b/README.rst @@ -224,6 +224,10 @@ The top level of a deliverable file is a mapping with keys: This repository has no job for building an artifact, but should be tagged anyway. + ``retired`` + This repository is no longer used, but was present in old + versions of a deliverable. + ``releases`` A list of the releases for the deliverable. diff --git a/openstack_releases/flags.py b/openstack_releases/flags.py new file mode 100644 index 0000000000..897e132f5f --- /dev/null +++ b/openstack_releases/flags.py @@ -0,0 +1,26 @@ +# 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. + +"""Work with the flags within a deliverable file. +""" + +NO_ARTIFACT_BUILD_JOB = 'no-artifact-build-job' +RETIRED = 'retired' + + +def has_flag(deliverable_info, repo_name, flag_name): + """Return boolean indicating whether the flag is present for the repo. + """ + all_settings = deliverable_info.get('repository-settings', {}) + repo_settings = all_settings.get(repo_name, {}) + flags = repo_settings.get('flags', []) + return flag_name in flags diff --git a/openstack_releases/project_config.py b/openstack_releases/project_config.py index 9a37a1bda9..cfb2dbb97d 100644 --- a/openstack_releases/project_config.py +++ b/openstack_releases/project_config.py @@ -16,6 +16,8 @@ import requests import yaml +from openstack_releases import flags + ZUUL_LAYOUT_URL = 'http://git.openstack.org/cgit/openstack-infra/project-config/plain/zuul/layout.yaml' # noqa ZUUL_LAYOUT_FILENAME = 'openstack-infra/project-config/zuul/layout.yaml' @@ -53,14 +55,14 @@ def require_release_jobs_for_repo(deliverable_info, 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: + if flags.has_flag(deliverable_info, repo, flags.NO_ARTIFACT_BUILD_JOB): + return errors + + # If the repository is retired, we don't need to check for any + # jobs. + if flags.has_flag(deliverable_info, repo, flags.RETIRED): return errors if repo not in zuul_layout[_VALIDATE_KEY]: