diff options
Diffstat (limited to 'releases')
-rw-r--r-- | releases/gambia/armband.yaml | 17 | ||||
-rw-r--r-- | releases/gambia/auto.yaml | 9 | ||||
-rw-r--r-- | releases/gambia/compass4nfv.yaml | 12 | ||||
-rw-r--r-- | releases/gambia/doctor.yaml | 22 | ||||
-rw-r--r-- | releases/gambia/fuel.yaml | 17 | ||||
-rw-r--r-- | releases/gambia/ipv6.yaml | 17 | ||||
-rw-r--r-- | releases/gambia/samplevnf.yaml | 9 | ||||
-rw-r--r-- | releases/gambia/sandbox.yaml | 9 | ||||
-rw-r--r-- | releases/gambia/sfc.yaml | 9 | ||||
-rw-r--r-- | releases/gambia/yardstick.yaml | 9 | ||||
-rw-r--r-- | releases/scripts/create_branch.py | 143 | ||||
-rw-r--r-- | releases/scripts/repos.py | 31 |
12 files changed, 159 insertions, 145 deletions
diff --git a/releases/gambia/armband.yaml b/releases/gambia/armband.yaml new file mode 100644 index 000000000..0790de1e2 --- /dev/null +++ b/releases/gambia/armband.yaml @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +project: armband +project-type: installer +release-model: stable + +branches: + - name: stable/gambia + location: + armband: a880b5c0fe55397b73f0fcf8f8c87d523327099d diff --git a/releases/gambia/auto.yaml b/releases/gambia/auto.yaml new file mode 100644 index 000000000..f53a41131 --- /dev/null +++ b/releases/gambia/auto.yaml @@ -0,0 +1,9 @@ +--- +project: auto +project-type: feature +release-model: stable + +branches: + - name: stable/gambia + location: + auto: 1a2260efe5d15f95b8fa778a9ee8023121facd7e diff --git a/releases/gambia/compass4nfv.yaml b/releases/gambia/compass4nfv.yaml new file mode 100644 index 000000000..e0523889c --- /dev/null +++ b/releases/gambia/compass4nfv.yaml @@ -0,0 +1,12 @@ +--- +project: compass4nfv +project-type: installer +release-model: stable + +branches: + - name: stable/gambia + location: + compass4nfv: 33f94b43639dbe37b7e8e2b5eeb4c65064207c6b + - name: stable/gambia + location: + compass-containers: 20e229822b31b03e1120c3e5efd4ba131261617e diff --git a/releases/gambia/doctor.yaml b/releases/gambia/doctor.yaml new file mode 100644 index 000000000..3294fec6f --- /dev/null +++ b/releases/gambia/doctor.yaml @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 Nokia Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +project: doctor +project-type: feature +release-model: stable + +releases: + - version: opnfv-7.0.0 + location: + doctor: 3ddc2392b0ed364eede49ff006d64df3ea456350 + +branches: + - name: stable/gambia + location: + doctor: 3ddc2392b0ed364eede49ff006d64df3ea456350 diff --git a/releases/gambia/fuel.yaml b/releases/gambia/fuel.yaml new file mode 100644 index 000000000..8c86010f3 --- /dev/null +++ b/releases/gambia/fuel.yaml @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +project: fuel +project-type: installer +release-model: stable + +branches: + - name: stable/gambia + location: + fuel: 90a442136b0aff8380388ac0a94831d0904e3cb8 diff --git a/releases/gambia/ipv6.yaml b/releases/gambia/ipv6.yaml new file mode 100644 index 000000000..a566e547c --- /dev/null +++ b/releases/gambia/ipv6.yaml @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +project: ipv6 +project-type: feature +release-model: stable + +branches: + - name: stable/gambia + location: + ipv6: e36f753cf6e9ab0c02a400b6bac5c79b48268d44 diff --git a/releases/gambia/samplevnf.yaml b/releases/gambia/samplevnf.yaml new file mode 100644 index 000000000..1727730bc --- /dev/null +++ b/releases/gambia/samplevnf.yaml @@ -0,0 +1,9 @@ +--- +project: samplevnf +project-type: feature +release-model: stable + +branches: + - name: stable/gambia + location: + samplevnf: 4d59d3530d1c41734f15423142e64eb9c929c717 diff --git a/releases/gambia/sandbox.yaml b/releases/gambia/sandbox.yaml new file mode 100644 index 000000000..16f2df24e --- /dev/null +++ b/releases/gambia/sandbox.yaml @@ -0,0 +1,9 @@ +--- +project: sandbox +project-type: infra +release-model: stable + +branches: + - name: stable/gambia + location: + sandbox: c2012f5b642f17e6024db631b833414114a329d5 diff --git a/releases/gambia/sfc.yaml b/releases/gambia/sfc.yaml new file mode 100644 index 000000000..14152d36e --- /dev/null +++ b/releases/gambia/sfc.yaml @@ -0,0 +1,9 @@ +--- +project: sfc +project-type: feature +release-model: stable + +branches: + - name: stable/gambia + location: + sfc: 77bdb6a79a506f91959070dc8ff28949f2dff825 diff --git a/releases/gambia/yardstick.yaml b/releases/gambia/yardstick.yaml new file mode 100644 index 000000000..3c782c432 --- /dev/null +++ b/releases/gambia/yardstick.yaml @@ -0,0 +1,9 @@ +--- +project: yardstick +project-type: testing +release-model: stable + +branches: + - name: stable/gambia + location: + yardstick: 497292013ef0d7e1e014d76803d4f284618b4986 diff --git a/releases/scripts/create_branch.py b/releases/scripts/create_branch.py deleted file mode 100644 index fa3c92def..000000000 --- a/releases/scripts/create_branch.py +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python2 -# SPDX-License-Identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2018 The Linux Foundation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -""" -Create Gerrit Branchs -""" - -import argparse - -try: - import ConfigParser -except ImportError: - import configparser as ConfigParser - -import logging -import os -import yaml - -from requests.compat import quote -from requests.exceptions import RequestException - -from pygerrit2.rest import GerritRestAPI -from pygerrit2.rest.auth import HTTPDigestAuthFromNetrc, HTTPBasicAuthFromNetrc - - -logging.basicConfig(level=logging.INFO) - - -def quote_branch(arguments): - """ - Quote is used here to escape the '/' in branch name. By - default '/' is listed in 'safe' characters which aren't escaped. - quote is not used in the data of the PUT request, as quoting for - arguments is handled by the request library - """ - new_args = arguments.copy() - new_args['branch'] = quote(new_args['branch'], '') - return new_args - - -def create_branch(api, arguments): - """ - Create a branch using the Gerrit REST API - """ - logger = logging.getLogger(__file__) - - branch_data = """ - { - "ref": "%(branch)s" - "revision": "%(commit)s" - }""" % arguments - - # First verify the commit exists, otherwise the branch will be - # created at HEAD - try: - request = api.get("/projects/%(project)s/commits/%(commit)s" % - arguments) - logger.debug(request) - logger.debug("Commit exists: %(commit)s", arguments) - except RequestException as err: - if hasattr(err, 'response') and err.response.status_code in [404]: - logger.warn("Commit %(commit)s for %(project)s does" - " not exist. Not creating branch.", arguments) - logger.warn(err) - else: - logger.error("Error: %s", str(err)) - # Skip trying to create the branch - return - - # Try to create the branch and let us know if it already exist. - try: - request = api.put("/projects/%(project)s/branches/%(branch)s" % - quote_branch(arguments), branch_data) - logger.info("Branch %(branch)s for %(project)s successfully created", - arguments) - except RequestException as err: - if hasattr(err, 'response') and err.response.status_code in [412, 409]: - logger.info("Branch %(branch)s already created for %(project)s", - arguments) - logger.info(err) - else: - logger.error("Error: %s", str(err)) - - -def main(): - """Given a yamlfile that follows the release syntax, create branches - in Gerrit listed under branches""" - - config = ConfigParser.ConfigParser() - config.read(os.path.join(os.path.abspath(os.path.dirname(__file__)), - 'defaults.cfg')) - config.read([os.path.expanduser('~/releases.cfg'), 'releases.cfg']) - - gerrit_url = config.get('gerrit', 'url') - - parser = argparse.ArgumentParser() - parser.add_argument('--file', '-f', - type=argparse.FileType('r'), - required=True) - parser.add_argument('--basicauth', '-b', action='store_true') - args = parser.parse_args() - - GerritAuth = HTTPDigestAuthFromNetrc - if args.basicauth: - GerritAuth = HTTPBasicAuthFromNetrc - - try: - auth = GerritAuth(url=gerrit_url) - except ValueError as err: - logging.error("%s for %s", err, gerrit_url) - quit(1) - restapi = GerritRestAPI(url=gerrit_url, auth=auth) - - project = yaml.safe_load(args.file) - - create_branches(restapi, project) - - -def create_branches(restapi, project): - """Create branches for a specific project defined in the release - file""" - - branches = [] - for branch in project['branches']: - repo, ref = next(iter(branch['location'].items())) - branches.append({ - 'project': repo, - 'branch': branch['name'], - 'commit': ref - }) - - for branch in branches: - create_branch(restapi, branch) - - -if __name__ == "__main__": - main() diff --git a/releases/scripts/repos.py b/releases/scripts/repos.py index 47ce42d88..91c4e9300 100644 --- a/releases/scripts/repos.py +++ b/releases/scripts/repos.py @@ -63,20 +63,28 @@ def main(): type=str, help="Only print" "SHAs for the specified release") + parser.add_argument('--branches', '-b', + action='store_true', + default=False, + help="Print Branch info") + args = parser.parse_args() project = yaml.safe_load(args.file) - list_repos(project, args) + if args.branches: + list_branches(project, args) + else: + list_repos(project, args) def list_repos(project, args): """List repositories in the project file""" lookup = project.get('releases', []) + if 'releases' not in project: exit(0) - repos = set() for item in lookup: repo, ref = next(iter(item['location'].items())) @@ -90,5 +98,24 @@ def list_repos(project, args): print(repo) +def list_branches(project, args): + """List branches in the project file""" + + lookup = project.get('branches', []) + + if 'branches' not in project: + exit(0) + repos = set() + for item in lookup: + repo, ref = next(iter(item['location'].items())) + if args.names: + repos.add(Repo(repo)) + elif args.release and item['name'] == args.release: + repos.add(Repo(repo, ref)) + elif not args.release: + repos.add(Repo(repo, item['name'], ref)) + for repo in repos: + print(repo) + if __name__ == "__main__": main() |