diff options
Diffstat (limited to 'releases')
48 files changed, 821 insertions, 0 deletions
diff --git a/releases/euphrates/apex.yaml b/releases/euphrates/apex.yaml new file mode 100644 index 000000000..78920761d --- /dev/null +++ b/releases/euphrates/apex.yaml @@ -0,0 +1,37 @@ +# 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: apex +project-type: installer +release-model: stable +upstream: https://wiki.openstack.org/wiki/TripleO + +releases: + - version: opnfv-5.0.0 + location: + apex: 2f1c99daeee9cf0e89a8e833e034e7a5979ae894 + - version: opnfv-5.1.0 + location: + apex: f15d50c2009f1f865ac6f4171347940313727547 + +branches: + - name: stable/euphrates + location: + apex: f27da77b87837e025907f689890b413c8f183c59 + - name: stable/euphrates + location: + apex-tripleo-heat-templates: 676db53c4423693441112640cf362e93931161ae + - name: stable/euphrates + location: + apex-puppet-tripleo: 14bc31f54ea943547a3319b479ea7b8cd9661e85 + - name: stable/euphrates + location: + apex-os-net-config: a6c3f2a2c853ca489cceff959a52d7f75bf4ffe0 + +release-notes: http://docs.opnfv.org/en/stable-euphrates/submodules/apex/docs/release/release-notes/release-notes.html diff --git a/releases/euphrates/armband.yaml b/releases/euphrates/armband.yaml new file mode 100644 index 000000000..c96b1a3ef --- /dev/null +++ b/releases/euphrates/armband.yaml @@ -0,0 +1,9 @@ +--- +project: armband +project-type: installer +release-model: stable + +branches: + - name: stable/euphrates + location: + armband: 26f7f4fffa50452fd6e5cb5c2afbae63449afc00 diff --git a/releases/euphrates/availability.yaml b/releases/euphrates/availability.yaml new file mode 100644 index 000000000..79f448edc --- /dev/null +++ b/releases/euphrates/availability.yaml @@ -0,0 +1,9 @@ +--- +project: availability +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + availability: 374fe9ba9a1fc9c10eb6fa44a25b177f1e9ad96c diff --git a/releases/euphrates/bamboo.yaml b/releases/euphrates/bamboo.yaml new file mode 100644 index 000000000..bbda8b831 --- /dev/null +++ b/releases/euphrates/bamboo.yaml @@ -0,0 +1,9 @@ +--- +project: bamboo +project-type: tools +release-model: stable + +branches: + - name: stable/euphrates + location: + bamboo: 37ed3fde974e656893edbfcee2ad5f0c1b1e2011 diff --git a/releases/euphrates/barometer.yaml b/releases/euphrates/barometer.yaml new file mode 100644 index 000000000..ac1894ed7 --- /dev/null +++ b/releases/euphrates/barometer.yaml @@ -0,0 +1,9 @@ +--- +project: barometer +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + barometer: cb183a3dbe6c1bf0955a0260292709020d2ef338 diff --git a/releases/euphrates/bottlenecks.yaml b/releases/euphrates/bottlenecks.yaml new file mode 100644 index 000000000..7c6725ad0 --- /dev/null +++ b/releases/euphrates/bottlenecks.yaml @@ -0,0 +1,9 @@ +--- +project: bottlenecks +project-type: testing +release-model: stable + +branches: + - name: stable/euphrates + location: + bottlenecks: 0cd98516d581bc661772473be92f7e4d5a26036d diff --git a/releases/euphrates/calipso.yaml b/releases/euphrates/calipso.yaml new file mode 100644 index 000000000..ebccd6008 --- /dev/null +++ b/releases/euphrates/calipso.yaml @@ -0,0 +1,9 @@ +--- +project: calipso +project-type: tools +release-model: stable + +branches: + - name: stable/euphrates + location: + calipso: c8440f4158805fed1c49d1f06cd71f324eac26a2 diff --git a/releases/euphrates/compass4nfv.yaml b/releases/euphrates/compass4nfv.yaml new file mode 100644 index 000000000..e46e01b18 --- /dev/null +++ b/releases/euphrates/compass4nfv.yaml @@ -0,0 +1,9 @@ +--- +project: compass4nfv +project-type: installer +release-model: stable + +branches: + - name: stable/euphrates + location: + compass4nfv: 435cd3756a833db0515eb70c1d8ec4adca90950f diff --git a/releases/euphrates/container4nfv.yaml b/releases/euphrates/container4nfv.yaml new file mode 100644 index 000000000..ec5dc8e98 --- /dev/null +++ b/releases/euphrates/container4nfv.yaml @@ -0,0 +1,9 @@ +--- +project: container4nfv +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + container4nfv: dbd4804f6353c5ba49af784502654991520e02e6 diff --git a/releases/euphrates/daisy.yaml b/releases/euphrates/daisy.yaml new file mode 100644 index 000000000..4f3cb1529 --- /dev/null +++ b/releases/euphrates/daisy.yaml @@ -0,0 +1,9 @@ +--- +project: daisy +project-type: installer +release-model: stable + +branches: + - name: stable/euphrates + location: + daisy: ef7ce0b8c457cf9831d9556572ab13d7d4c660f6 diff --git a/releases/euphrates/doctor.yaml b/releases/euphrates/doctor.yaml new file mode 100644 index 000000000..6f4499781 --- /dev/null +++ b/releases/euphrates/doctor.yaml @@ -0,0 +1,9 @@ +--- +project: doctor +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + doctor: 06980156b3eed6a6e456d3105c70b68386c1dfb7 diff --git a/releases/euphrates/domino.yaml b/releases/euphrates/domino.yaml new file mode 100644 index 000000000..52bc01ccf --- /dev/null +++ b/releases/euphrates/domino.yaml @@ -0,0 +1,9 @@ +--- +project: domino +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + domino: 5aca24e307f2eb11026a086fbe3db6f0cbeb6699 diff --git a/releases/euphrates/fds.yaml b/releases/euphrates/fds.yaml new file mode 100644 index 000000000..4377bf98b --- /dev/null +++ b/releases/euphrates/fds.yaml @@ -0,0 +1,9 @@ +--- +project: fds +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + fds: 5eed588472406181f8182731e03eb09e2c20f588 diff --git a/releases/euphrates/fuel.yaml b/releases/euphrates/fuel.yaml new file mode 100644 index 000000000..91d2304c7 --- /dev/null +++ b/releases/euphrates/fuel.yaml @@ -0,0 +1,9 @@ +--- +project: fuel +project-type: installer +release-model: stable + +branches: + - name: stable/euphrates + location: + fuel: fe9be64738ff1a1091e7df5b04b391fb15d6abc0 diff --git a/releases/euphrates/functest.yaml b/releases/euphrates/functest.yaml new file mode 100644 index 000000000..f793771d9 --- /dev/null +++ b/releases/euphrates/functest.yaml @@ -0,0 +1,9 @@ +--- +project: functest +project-type: testing +release-model: stable + +branches: + - name: stable/euphrates + location: + functest: e556a792b6b0c7275c20c779688f4ffc383b7f2a diff --git a/releases/euphrates/ipv6.yaml b/releases/euphrates/ipv6.yaml new file mode 100644 index 000000000..a0b4cbfd6 --- /dev/null +++ b/releases/euphrates/ipv6.yaml @@ -0,0 +1,9 @@ +--- +project: ipv6 +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + ipv6: 79ddbacd3ee05d8605ebd103042ca9502edb626f diff --git a/releases/euphrates/joid.yaml b/releases/euphrates/joid.yaml new file mode 100644 index 000000000..3cbb87d56 --- /dev/null +++ b/releases/euphrates/joid.yaml @@ -0,0 +1,9 @@ +--- +project: joid +project-type: installer +release-model: stable + +branches: + - name: stable/euphrates + location: + joid: ba3766e175571756f690b24448cb5dfae934ad80 diff --git a/releases/euphrates/kvmfornfv.yaml b/releases/euphrates/kvmfornfv.yaml new file mode 100644 index 000000000..7e541c4a6 --- /dev/null +++ b/releases/euphrates/kvmfornfv.yaml @@ -0,0 +1,9 @@ +--- +project: kvmfornfv +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + kvmfornfv: 3a36c490d63e834ee9454553a14995be839118e3 diff --git a/releases/euphrates/moon.yaml b/releases/euphrates/moon.yaml new file mode 100644 index 000000000..4f340468c --- /dev/null +++ b/releases/euphrates/moon.yaml @@ -0,0 +1,9 @@ +--- +project: moon +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + moon: 2c380003fa911fdfad85d2c7164b95160eb54963 diff --git a/releases/euphrates/nfvbench.yaml b/releases/euphrates/nfvbench.yaml new file mode 100644 index 000000000..f51e87607 --- /dev/null +++ b/releases/euphrates/nfvbench.yaml @@ -0,0 +1,9 @@ +--- +project: nfvbench +project-type: tools +release-model: stable + +branches: + - name: stable/euphrates + location: + nfvbench: cf9c95ccda2f5afbdf79c7debe5fcd88c05eaa6a diff --git a/releases/euphrates/octopus.yaml b/releases/euphrates/octopus.yaml new file mode 100644 index 000000000..f4a698db2 --- /dev/null +++ b/releases/euphrates/octopus.yaml @@ -0,0 +1,9 @@ +--- +project: octopus +project-type: infra +release-model: stable + +branches: + - name: stable/euphrates + location: + octopus: 1c1b92913c93cfddb9fee16bc9c15b1873fc4e04 diff --git a/releases/euphrates/opnfvdocs.yaml b/releases/euphrates/opnfvdocs.yaml new file mode 100644 index 000000000..0ea079642 --- /dev/null +++ b/releases/euphrates/opnfvdocs.yaml @@ -0,0 +1,9 @@ +--- +project: opnfvdocs +project-type: infra +release-model: stable + +branches: + - name: stable/euphrates + location: + opnfvdocs: 18d0ebca65b68e56497c08cc489e4ecc3c649fa9 diff --git a/releases/euphrates/orchestra.yaml b/releases/euphrates/orchestra.yaml new file mode 100644 index 000000000..b97361e3c --- /dev/null +++ b/releases/euphrates/orchestra.yaml @@ -0,0 +1,9 @@ +--- +project: orchestra +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + orchestra: 1f0d8ed7261f1b202476680b2e3fc2d41b399cc9 diff --git a/releases/euphrates/ovn4nfv.yaml b/releases/euphrates/ovn4nfv.yaml new file mode 100644 index 000000000..ba605207c --- /dev/null +++ b/releases/euphrates/ovn4nfv.yaml @@ -0,0 +1,9 @@ +--- +project: ovn4nfv +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + ovn4nfv: 2c6027fb46d1a55f767cc2882d946c794ca5843c diff --git a/releases/euphrates/ovno.yaml b/releases/euphrates/ovno.yaml new file mode 100644 index 000000000..39ca54cc0 --- /dev/null +++ b/releases/euphrates/ovno.yaml @@ -0,0 +1,9 @@ +--- +project: ovno +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + ovno: f49eab063a13bb89bd90f583bd6d814c3a7d21d2 diff --git a/releases/euphrates/parser.yaml b/releases/euphrates/parser.yaml new file mode 100644 index 000000000..7eb055e57 --- /dev/null +++ b/releases/euphrates/parser.yaml @@ -0,0 +1,9 @@ +--- +project: parser +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + parser: 3447589a78375d4dab41608a3504f56a6e4ac9c9 diff --git a/releases/euphrates/pharos.yaml b/releases/euphrates/pharos.yaml new file mode 100644 index 000000000..023776261 --- /dev/null +++ b/releases/euphrates/pharos.yaml @@ -0,0 +1,12 @@ +--- +project: pharos +project-type: infra +release-model: stable + +branches: + - name: stable/euphrates + location: + pharos: 1d7a94bf5ab86f28b3183f52644d00801cde815b + - name: stable/euphrates + location: + pharos-tools: d46ab54583a6c20bfa5bea581f512474f488e788 diff --git a/releases/euphrates/promise.yaml b/releases/euphrates/promise.yaml new file mode 100644 index 000000000..799077f12 --- /dev/null +++ b/releases/euphrates/promise.yaml @@ -0,0 +1,9 @@ +--- +project: promise +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + promise: 2ff86a92816faa4d71d2b0e260a5f44ce51d9b2c diff --git a/releases/euphrates/qtip.yaml b/releases/euphrates/qtip.yaml new file mode 100644 index 000000000..51c07d937 --- /dev/null +++ b/releases/euphrates/qtip.yaml @@ -0,0 +1,9 @@ +--- +project: qtip +project-type: testing +release-model: stable + +branches: + - name: stable/euphrates + location: + qtip: 3f929d991ea4ca402aaf4db46752f703771f44ea diff --git a/releases/euphrates/samplevnf.yaml b/releases/euphrates/samplevnf.yaml new file mode 100644 index 000000000..33f1a9028 --- /dev/null +++ b/releases/euphrates/samplevnf.yaml @@ -0,0 +1,9 @@ +--- +project: samplevnf +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + samplevnf: af6b18166ddbe9331c529256cb71c11e8b280982 diff --git a/releases/euphrates/sdnvpn.yaml b/releases/euphrates/sdnvpn.yaml new file mode 100644 index 000000000..371fe9a6a --- /dev/null +++ b/releases/euphrates/sdnvpn.yaml @@ -0,0 +1,9 @@ +--- +project: sdnvpn +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + sdnvpn: e66856ba6b9275582aa4fc370d2b9abf48b5381f diff --git a/releases/euphrates/sfc.yaml b/releases/euphrates/sfc.yaml new file mode 100644 index 000000000..ebd7a0eec --- /dev/null +++ b/releases/euphrates/sfc.yaml @@ -0,0 +1,9 @@ +--- +project: sfc +project-type: feature +release-model: stable + +branches: + - name: stable/euphrates + location: + sfc: 2b785ea6a618b031cde2fd327f33733ab9c352e9 diff --git a/releases/euphrates/snaps.yaml b/releases/euphrates/snaps.yaml new file mode 100644 index 000000000..9aaa018ef --- /dev/null +++ b/releases/euphrates/snaps.yaml @@ -0,0 +1,9 @@ +--- +project: snaps +project-type: tools +release-model: stable + +branches: + - name: stable/euphrates + location: + snaps: fd18b6790cd9b59851bce6746cc83f27d3e18e4f diff --git a/releases/euphrates/storperf.yaml b/releases/euphrates/storperf.yaml new file mode 100644 index 000000000..c7cf60c4d --- /dev/null +++ b/releases/euphrates/storperf.yaml @@ -0,0 +1,9 @@ +--- +project: storperf +project-type: testing +release-model: stable + +branches: + - name: stable/euphrates + location: + storperf: 577bb77e605f78934260d6578bf07fb5071f3354 diff --git a/releases/euphrates/vswitchperf.yaml b/releases/euphrates/vswitchperf.yaml new file mode 100644 index 000000000..3ae3b08c3 --- /dev/null +++ b/releases/euphrates/vswitchperf.yaml @@ -0,0 +1,9 @@ +--- +project: vswitchperf +project-type: testing +release-model: stable + +branches: + - name: stable/euphrates + location: + vswitchperf: d126de94bea2e5d0e237dc6a3373fd3d53e3cfa3 diff --git a/releases/euphrates/yardstick.yaml b/releases/euphrates/yardstick.yaml new file mode 100644 index 000000000..36cf6a5ae --- /dev/null +++ b/releases/euphrates/yardstick.yaml @@ -0,0 +1,9 @@ +--- +project: yardstick +project-type: testing +release-model: stable + +branches: + - name: stable/euphrates + location: + yardstick: 3431cd1801023e2ee09b520fc9f7a890677ff7b1 diff --git a/releases/fraser/auto.yaml b/releases/fraser/auto.yaml new file mode 100644 index 000000000..fa2f58ba7 --- /dev/null +++ b/releases/fraser/auto.yaml @@ -0,0 +1,9 @@ +--- +project: auto +project-type: feature +release-model: stable + +branches: + - name: stable/fraser + location: + auto: 5c8112dd4434e726da1325b0a699b9839f2f3d6b diff --git a/releases/fraser/availability.yaml b/releases/fraser/availability.yaml new file mode 100644 index 000000000..1b35af76c --- /dev/null +++ b/releases/fraser/availability.yaml @@ -0,0 +1,9 @@ +--- +project: availability +project-type: feature +release-model: stable + +branches: + - name: stable/fraser + location: + availability: c1ee3631b59009ff61450808e2bd33fe1d4b17f2 diff --git a/releases/fraser/compass4nfv.yaml b/releases/fraser/compass4nfv.yaml new file mode 100644 index 000000000..5b5c777c5 --- /dev/null +++ b/releases/fraser/compass4nfv.yaml @@ -0,0 +1,12 @@ +--- +project: compass4nfv +project-type: installer +release-model: stable + +branches: + - name: stable/fraser + location: + compass4nfv: 9c5ae544e3f1adbc5bb0df1fc7388012bdf642fa + - name: stable/fraser + location: + compass-containers: 15a7cbc925bed896c3c09a5635454c33dbffbadc diff --git a/releases/fraser/functest.yaml b/releases/fraser/functest.yaml new file mode 100644 index 000000000..9956e9681 --- /dev/null +++ b/releases/fraser/functest.yaml @@ -0,0 +1,12 @@ +--- +project: functest +project-type: testing +release-model: stable + +branches: + - name: stable/fraser + location: + functest: 99d75d87e31d4f9e078c899bd643da5474963aba + - name: stable/fraser + location: + functest-kubernetes: 64d61b6a116d3b12e0f4f42c3240262ea6359fd8 diff --git a/releases/fraser/ipv6.yaml b/releases/fraser/ipv6.yaml new file mode 100644 index 000000000..853847cc2 --- /dev/null +++ b/releases/fraser/ipv6.yaml @@ -0,0 +1,9 @@ +--- +project: ipv6 +project-type: feature +release-model: stable + +branches: + - name: stable/fraser + location: + ipv6: 809dba7f52ff1571a760a01376530de23c5d97c9 diff --git a/releases/fraser/sdnvpn.yaml b/releases/fraser/sdnvpn.yaml new file mode 100644 index 000000000..b0a3906e8 --- /dev/null +++ b/releases/fraser/sdnvpn.yaml @@ -0,0 +1,9 @@ +--- +project: sdnvpn +project-type: feature +release-model: stable + +branches: + - name: stable/fraser + location: + sdnvpn: cc10bd492affb033b68d3b8f4cb1d8c9d554f995 diff --git a/releases/schema.yaml b/releases/schema.yaml new file mode 100644 index 000000000..c3838760a --- /dev/null +++ b/releases/schema.yaml @@ -0,0 +1,56 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## +--- +$schema: 'http://json-schema.org/schema#' +$id: 'https://github.com/opnfv/releng/blob/master/releases/schema.yaml' + +additionalProperties: false + +required: + - 'project' + - 'project-type' + +properties: + project: + type: 'string' + release-model: + type: 'string' + enum: ['stable', 'non-release'] + project-type: + type: 'string' + enum: ['installer', 'testing', 'feature', 'tools', 'infra'] + upstream: + type: 'string' + releases: + type: 'array' + items: + type: 'object' + properties: + version: + type: 'string' + # Matches semantic versioning (X.Y.Z) + pattern: '^opnfv-([0-9]+\.){2}[0-9]+$' + location: + type: 'object' + required: ['version', 'location'] + additionalProperties: false + branches: + type: 'array' + items: + type: 'object' + properties: + name: + type: 'string' + pattern: '^stable/[a-z]+$' + location: + type: 'object' + required: ['name', 'location'] + additionalProperties: false + release-notes: + type: 'string' + format: 'uri' diff --git a/releases/scripts/create_branch.py b/releases/scripts/create_branch.py new file mode 100644 index 000000000..fa3c92def --- /dev/null +++ b/releases/scripts/create_branch.py @@ -0,0 +1,143 @@ +#!/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/create_jobs.py b/releases/scripts/create_jobs.py new file mode 100644 index 000000000..2478217a9 --- /dev/null +++ b/releases/scripts/create_jobs.py @@ -0,0 +1,145 @@ +#!/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 Branches +""" + +import argparse +import logging +import os +import re +import yaml +import subprocess + +# import ruamel +from ruamel.yaml import YAML + + +logging.basicConfig(level=logging.INFO) + + +def has_string(filepath, string): + """ + Return True if the given filepath contains the regex string + """ + with open(filepath) as yaml_file: + for line in yaml_file: + if string.search(line): + return True + return False + + +def jjb_files(project, release): + """ + Return sets of YAML file names that contain 'stream' for a given + project, and file that already contain the stream. + """ + files, skipped = set(), set() + file_ending = re.compile(r'ya?ml$') + search_string = re.compile(r'^\s+stream:') + release_string = re.compile(r'- %s:' % release) + jjb_path = os.path.join('jjb', project) + + if not os.path.isdir(jjb_path): + logging.warn("JJB directory does not exist at %s, skipping job " + "creation", jjb_path) + return (files, skipped) + + for file_name in os.listdir(jjb_path): + file_path = os.path.join(jjb_path, file_name) + if os.path.isfile(file_path) and file_ending.search(file_path): + if has_string(file_path, release_string): + skipped.add(file_path) + elif has_string(file_path, search_string): + files.add(file_path) + return (files, skipped) + + +def main(): + """ + Create Jenkins Jobs for stable branches in Release File + """ + parser = argparse.ArgumentParser() + parser.add_argument('--file', '-f', + type=argparse.FileType('r'), + required=True) + args = parser.parse_args() + + project_yaml = yaml.safe_load(args.file) + + # Get the release name from the file path + release = os.path.split(os.path.dirname(args.file.name))[1] + + create_jobs(release, project_yaml) + + +def create_jobs(release, project_yaml): + """Add YAML to JJB files for release stream""" + logger = logging.getLogger(__file__) + + # We assume here project keep their subrepo jobs under the part + # project name. Otherwise we'll have to look for jjb/<repo> for each + # branch listed. + project, _ = next(iter(project_yaml['branches'][0]['location'].items())) + + yaml_parser = YAML() + yaml_parser.preserve_quotes = True + yaml_parser.explicit_start = True + # yaml_parser.indent(mapping=4, sequence=0, offset=0) + # These are some esoteric values that produce indentation matching our jjb + # configs + # yaml_parser.indent(mapping=3, sequence=3, offset=2) + # yaml_parser.indent(sequence=4, offset=2) + yaml_parser.indent(mapping=2, sequence=4, offset=2) + + (job_files, skipped_files) = jjb_files(project, release) + + if skipped_files: + logger.info("Jobs already exists for %s in files: %s", + project, ', '.join(skipped_files)) + # Exit if there are not jobs to create + if not job_files: + return + logger.info("Creating Jenkins Jobs for %s in files: %s", + project, ', '.join(job_files)) + + stable_branch_stream = """\ + %s: + branch: 'stable/{stream}' + gs-pathname: '/{stream}' + disabled: false + """ % release + + stable_branch_yaml = yaml_parser.load(stable_branch_stream) + stable_branch_yaml[release].yaml_set_anchor(release, always_dump=True) + + for job_file in job_files: + yaml_jjb = yaml_parser.load(open(job_file)) + if 'stream' not in yaml_jjb[0]['project']: + continue + + # TODO: Some JJB files don't have 'stream' + project_config = yaml_jjb[0]['project']['stream'] + # There is an odd issue where just appending adds a newline before the + # branch config, so we append (presumably after master) instead. + project_config.insert(1, stable_branch_yaml) + + # NOTE: In the future, we may need to override one or multiple of the + # following ruamal Emitter methods: + # * ruamel.yaml.emitter.Emitter.expect_block_sequence_item + # * ruamel.yaml.emitter.Emitter.write_indent + # To hopefully replace the need to shell out to sed... + yaml_parser.dump(yaml_jjb, open(job_file, 'w')) + args = ['sed', '-i', 's/^ //', job_file] + subprocess.Popen(args, stdout=subprocess.PIPE, shell=False) + + +if __name__ == "__main__": + main() diff --git a/releases/scripts/defaults.cfg b/releases/scripts/defaults.cfg new file mode 100644 index 000000000..6bc876588 --- /dev/null +++ b/releases/scripts/defaults.cfg @@ -0,0 +1,2 @@ +[gerrit] +url=https://gerrit.opnfv.org/gerrit/ diff --git a/releases/scripts/requirements.txt b/releases/scripts/requirements.txt new file mode 100644 index 000000000..5a7d216e9 --- /dev/null +++ b/releases/scripts/requirements.txt @@ -0,0 +1,5 @@ +pygerrit2 < 2.1.0 +PyYAML < 4.0 +jsonschema < 2.7.0 +rfc3987 +ruamel.yaml diff --git a/releases/scripts/verify_schema.py b/releases/scripts/verify_schema.py new file mode 100644 index 000000000..3a6163e2a --- /dev/null +++ b/releases/scripts/verify_schema.py @@ -0,0 +1,55 @@ +#!/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 +############################################################################## +""" +Verify YAML Schema +""" +import argparse +import logging +import jsonschema +import yaml + +LOADER = yaml.CSafeLoader if yaml.__with_libyaml__ else yaml.SafeLoader + + +def main(): + """ + Parse arguments and verify YAML + """ + logging.basicConfig(level=logging.INFO) + + parser = argparse.ArgumentParser() + parser.add_argument('--yaml', '-y', type=str, required=True) + parser.add_argument('--schema', '-s', type=str, required=True) + + args = parser.parse_args() + + with open(args.yaml) as _: + yaml_file = yaml.load(_, Loader=LOADER) + + with open(args.schema) as _: + schema_file = yaml.load(_, Loader=LOADER) + + # Load the schema + validation = jsonschema.Draft4Validator( + schema_file, + format_checker=jsonschema.FormatChecker() + ) + + # Look for errors + errors = 0 + for error in validation.iter_errors(yaml_file): + errors += 1 + logging.error(error) + if errors > 0: + raise RuntimeError("%d issues invalidate the release schema" % errors) + + +if __name__ == "__main__": + main() |