From 2ad636b211b51cd662788840f424afc40028d659 Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Fri, 9 Aug 2024 15:41:02 +0100 Subject: [PATCH 1/6] Remove default component owner --- copier.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/copier.yml b/copier.yml index cd9b6730..8e6e2401 100644 --- a/copier.yml +++ b/copier.yml @@ -62,8 +62,7 @@ component_owner: type: str help: | Owner of the component in the Developer Portal Software Catalogue. - This will normally be group:default/ - default: "group:default/sscc" + This will normally be group:default/ # Template Options docker: From 7fe3d9e1b8f1523daac3a76fb49e945ba94f1ba2 Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Fri, 9 Aug 2024 15:51:38 +0100 Subject: [PATCH 2/6] Template type and lifecycle in catalog info --- copier.yml | 22 ++++++++++++++++++++++ template/catalog-info.yaml.jinja | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/copier.yml b/copier.yml index 8e6e2401..dcbf158e 100644 --- a/copier.yml +++ b/copier.yml @@ -64,6 +64,28 @@ component_owner: Owner of the component in the Developer Portal Software Catalogue. This will normally be group:default/ +component_type: + type: str + help: | + Type of the component in the Developer Portal Software Catalogue. + Most likely service, library or application (without quotes). + +component_lifecycle: + type: str + help: | + Project's current lifecycle stage, to be displayed in the Developer + Portal Software Catalogue. + choices: + - alpha + - beta + - deprecated + - development + - experimental + - production + - test + - unknown + default: experimental + # Template Options docker: type: bool diff --git a/template/catalog-info.yaml.jinja b/template/catalog-info.yaml.jinja index 84c68b35..f58977e0 100644 --- a/template/catalog-info.yaml.jinja +++ b/template/catalog-info.yaml.jinja @@ -5,6 +5,6 @@ metadata: title: {{ repo_name }} description: {{ description }} spec: - type: documentation - lifecycle: experimental + type: {{ component_type }} + lifecycle: {{ component_lifecycle }} owner: {{ component_owner }} From da41cf221cc6b4890da3f196218ba37679de318d Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Mon, 12 Aug 2024 07:50:14 +0100 Subject: [PATCH 3/6] Update examples and tests --- example-answers.yml | 4 +++- tests/test_example.py | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/example-answers.yml b/example-answers.yml index 8a94d7d4..0ff28f7f 100644 --- a/example-answers.yml +++ b/example-answers.yml @@ -1,6 +1,8 @@ author_email: tom.cobb@diamond.ac.uk author_name: Tom Cobb -component_owner: group:default/sscc +component_owner: group:default/daq +component_type: service +component_lifecycle: experimental description: An expanded https://github.com/DiamondLightSource/python-copier-template to illustrate how it looks with all the options enabled. distribution_name: dls-python-copier-template-example docker: true diff --git a/tests/test_example.py b/tests/test_example.py index 185a588c..e772a833 100644 --- a/tests/test_example.py +++ b/tests/test_example.py @@ -163,3 +163,26 @@ def test_works_in_pyright_strict_mode(tmp_path: Path): # Ensure pyright is still happy run = make_venv(tmp_path) run(f"./venv/bin/pyright {tmp_path}") + + +def test_catalog_info(tmp_path: Path): + copy_project(tmp_path) + catalog_info_path = tmp_path / "catalog-info.yaml" + with catalog_info_path.open("r") as stream: + catalog_info = yaml.safe_load(stream) + assert catalog_info == { + "apiVersion": "backstage.io/v1alpha1", + "kind": "Component", + "metadata": { + "name": "dls-python-copier-template-example", + "title": "python-copier-template-example", + "description": "An expanded " + "https://github.com/DiamondLightSource/python-copier-template " + "to illustrate how it looks with all the options enabled.", + }, + "spec": { + "type": "service", + "lifecycle": "experimental", + "owner": "group:default/daq", + }, + } From a1ae26451c02e5a7e8874958e037a635415b1464 Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Mon, 12 Aug 2024 09:45:40 +0100 Subject: [PATCH 4/6] Improve docstring of component_owner --- copier.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index dcbf158e..eee3ea2f 100644 --- a/copier.yml +++ b/copier.yml @@ -61,7 +61,8 @@ author_email: component_owner: type: str help: | - Owner of the component in the Developer Portal Software Catalogue. + The unique name of the person or group who owns this component in + the Developer Portal Software Catalogue. This will normally be group:default/ component_type: From c67b546f3c7cc5faa4cbd00495fe01bc49f4a6ec Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Mon, 12 Aug 2024 09:50:32 +0100 Subject: [PATCH 5/6] Set choices for component type and lifecycle to supported values --- copier.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/copier.yml b/copier.yml index eee3ea2f..0b5d8dc1 100644 --- a/copier.yml +++ b/copier.yml @@ -70,6 +70,12 @@ component_type: help: | Type of the component in the Developer Portal Software Catalogue. Most likely service, library or application (without quotes). + choices: + - library + - service + - user-interface + - website + default: library component_lifecycle: type: str @@ -77,14 +83,9 @@ component_lifecycle: Project's current lifecycle stage, to be displayed in the Developer Portal Software Catalogue. choices: - - alpha - - beta - - deprecated - - development - experimental - production - - test - - unknown + - deprecated default: experimental # Template Options From 5f202bf1159c9396f75f312544579679c2b46179 Mon Sep 17 00:00:00 2001 From: Callum Forrester Date: Tue, 27 Aug 2024 12:12:37 +0100 Subject: [PATCH 6/6] Add more detail on how to get a list of valid groups from dev portal --- copier.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 0b5d8dc1..84dec3b4 100644 --- a/copier.yml +++ b/copier.yml @@ -63,7 +63,12 @@ component_owner: help: | The unique name of the person or group who owns this component in the Developer Portal Software Catalogue. - This will normally be group:default/ + This will normally be group:default/. For a full list of groups visit + https://dev-portal.diamond.ac.uk/catalog?filters%5Bkind%5D=group&filters%5Buser%5D=all + and hover over each group link to see its group ID, e.g. + https://dev-portal.diamond.ac.uk/catalog/default/group/accelerator-controls + would go here as group:default/accelerator-controls. + component_type: type: str