Skip to content

Commit

Permalink
181 fix catalog info template (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
callumforrester authored Aug 29, 2024
2 parents 123b250 + 5f202bf commit ef12f1b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 6 deletions.
34 changes: 31 additions & 3 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,37 @@ author_email:
component_owner:
type: str
help: |
Owner of the component in the Developer Portal Software Catalogue.
This will normally be group:default/<your_group>
default: "group:default/sscc"
The unique name of the person or group who owns this component in
the Developer Portal Software Catalogue.
This will normally be group:default/<your_group>. 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
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
help: |
Project's current lifecycle stage, to be displayed in the Developer
Portal Software Catalogue.
choices:
- experimental
- production
- deprecated
default: experimental

# Template Options
docker:
Expand Down
4 changes: 3 additions & 1 deletion example-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
author_email: [email protected]
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
Expand Down
4 changes: 2 additions & 2 deletions template/catalog-info.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ metadata:
title: {{ repo_name }}
description: {{ description }}
spec:
type: documentation
lifecycle: experimental
type: {{ component_type }}
lifecycle: {{ component_lifecycle }}
owner: {{ component_owner }}
23 changes: 23 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}

0 comments on commit ef12f1b

Please sign in to comment.