Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

181 fix catalog info template #187

Merged
merged 6 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions copier.yml
coretl marked this conversation as resolved.
Show resolved Hide resolved
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).
garryod marked this conversation as resolved.
Show resolved Hide resolved
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",
},
}
Loading