From 436b523914cb0d92cbbd0e77f9935c0425b1daa1 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Jul 12 2017 20:13:28 +0000 Subject: PDC: scripts to create product-releases. I used these to populate https://pdc.fedoraproject.org/rest_api/v1/product-versions/ Signed-off-by: Ralph Bean --- diff --git a/docs/source/sop_mass_branching.rst b/docs/source/sop_mass_branching.rst index 7dd4fa5..9a28c32 100644 --- a/docs/source/sop_mass_branching.rst +++ b/docs/source/sop_mass_branching.rst @@ -88,6 +88,14 @@ to update rawhide and create the new collection in the database. If only a few cleanups a re needed it might be better to do that with the regular branch commands. +PDC +--- + +The "product-release" needs to be created in PDC. + +In the ``scripts/pdc/`` directory, run: + + $ python create-product-release.py fedora $TOKEN fedora $NEW_VERSION Ansible ------- diff --git a/scripts/pdc/create-product-release.py b/scripts/pdc/create-product-release.py new file mode 100644 index 0000000..a266d04 --- /dev/null +++ b/scripts/pdc/create-product-release.py @@ -0,0 +1,33 @@ +""" create-product-version.py - Create a new "product version" in PDC. + +https://pdc..fedoraproject.org/rest_api/v1/product-versions/ + +Product versions are used by Greenwave to identify gating criteria. + +You can run this on pdc-backend01, the token is in /etc/pdc.d/ +You can also find the token in the private git repo. +""" + +import argparse + +import pdc_client + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument('servername', help='PDC server name. See /etc/pdc.d/') +parser.add_argument('token', help='PDC token for authentication.') +parser.add_argument('product', help='Name of the product') +parser.add_argument('version', help='Version (26, 27, ..)') + +args = parser.parse_args() + + +if __name__ == '__main__': + print("Connecting to PDC args.server %r with token %r" % (args.servername, args.token)) + pdc = pdc_client.PDCClient(args.servername, token=args.token) + + pdc['product-versions']._(dict( + name='%s %s' % (args.product, args.version), + product=args.product, + short=args.product.lower(), + version=args.version, + )) diff --git a/scripts/pdc/create-product.py b/scripts/pdc/create-product.py new file mode 100644 index 0000000..d6882f3 --- /dev/null +++ b/scripts/pdc/create-product.py @@ -0,0 +1,31 @@ +""" create-product.py - Create a new "product" in PDC. + +https://pdc..fedoraproject.org/rest_api/v1/products/ + +We will almost always only have one product: "Fedora". + +You can run this on pdc-backend01, the token is in /etc/pdc.d/ +You can also find the token in the private git repo. +""" + +import argparse + +import pdc_client + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument('servername', help='PDC server name. See /etc/pdc.d/') +parser.add_argument('token', help='PDC token for authentication.') +parser.add_argument('short', help='Short identifier for the product.') +parser.add_argument('name', help='Name of the product.') + +args = parser.parse_args() + + +if __name__ == '__main__': + print("Connecting to PDC args.server %r with token %r" % (args.servername, args.token)) + pdc = pdc_client.PDCClient(args.servername, token=args.token) + + pdc['products']._(dict( + name=args.name, + short=args.short, + ))