Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

scripts: Add the cid2civ script #562

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ repos:
hooks:
- id: interrogate
args: [--fail-under=60, --verbose]
# Unable to interrogate scripts without the .py extension:
# https://github.com/econchick/interrogate/issues/104
files: \.(py)$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? :) Can't we not add .py to the file instead?

25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This repository contains the tool `cloudimagedirectory-transformer`, which is us
It belongs to three other sub projects:

- [cloud-image-retriever](https://github.com/redhatcloudx/cloud-image-retriever): Used to retrieve unstructured image data from public cloud providers.
- [infrastructure](https://github.com/redhatcloudx/infrastructure): Defines the public cloud infrastructure [imagedirectory.cloud](https://imagedirectory.cloud/).
- [infrastructure](https://github.com/redhatcloudx/infrastructure): Defines the public cloud infrastructure [imagedirectory.cloud].
- [directory-frontend](https://github.com/redhatcloudx/cloud-image-directory-frontend) Used to visualize the dataset.

### Architecture diagram
Expand Down Expand Up @@ -59,10 +59,31 @@ poetry add --group dev bar

Use poetry to run pytest:

```commandline
```console
# Run all tests, including end-to-end tests that call out to cloud APIs:
poetry run pytest
```

## Validating images

Use the `cid2civ` script to download image metadata from [imagedirectory.cloud], analyze them
and generate files for testing via the [cloud image validation tool].

```console
# Print the supported arguments of the script:
poetry run scripts/cid2civ --help

# Download data about Azure images:
poetry run scripts/cid2civ download azure > cid.json

# Print a summary about the downloaded data:
poetry run scripts/cid2civ analyze cid.json

# Generate resources for the image validation:
poetry run scripts/cid2civ convert cid.json > civ.json
```

[Poetry]: https://python-poetry.org/
[installing poetry]: https://python-poetry.org/docs/#installation
[cloud image validation tool]: https://github.com/osbuild/cloud-image-val/
[imagedirectory.cloud]: https://imagedirectory.cloud/
1,581 changes: 804 additions & 777 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pre-commit = "^3.3.3"
ipython = "^8.14.0"
pytest-sugar = "^0.9.7"
rich = "^13.4.2"
docopt = "^0.6.2"
requests-file = "^1.5.1"

[tool.poetry.scripts]
cloudimagedirectory-transformer = "cloudimagedirectory.transformer:run"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to register cid2civ here, the same way we did it with the transformer (and the old cli in the past)? :)

Expand Down
Loading