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

Commit

Permalink
feat(entity_model): Entity model
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaroslav Sevcik committed Jul 27, 2021
1 parent 2070434 commit 1179161
Show file tree
Hide file tree
Showing 59 changed files with 5,038 additions and 1,620 deletions.
132 changes: 99 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,46 +102,112 @@ you can run: `TEST_DATABASE_URL=postgres://... TOX_TESTENV_PASSENV=TEST_DATABASE

## Configuration for repositories

Repositories scanned by the Zoo may contain the `.zoo.yml` file. This file contains additional
Repositories scanned by the Zoo may contain the `.entities.yml` file. This file contains additional
information about the scanned repository and how and where it's used in production. If the Zoo
finds this file in the root of the project, it will read it and create a Service or a Library within
the Zoo with the provided information based on the collected data automatically.
Otherwise the data have to be added to the Zoo manually.
finds this file in the root of the project, it will read it and create specified Entities within
the Zoo with the provided information based on the collected data automatically. Currently The Zoo
is supporting 3 types of Entities:

- Base Entity - schema can be found in [component_base.py](zoo/entities/yaml_definitions/component_base.yaml)
- Service Entity - schema can be found in [component_service.py](zoo/entities/yaml_definitions/component_service.yaml)
- Library Entity - schema can be found in [component_library.py](zoo/entities/yaml_definitions/component_library.yaml)

Here is an example of this file:

```yaml
type: service
name: hello-world-service
owner: booking
impact: profit
status: beta
docs_url: 'https://example.com/hello-world-service'
slack_channel: 'http://example.com/slack/channel'
sentry_project: 'http://example.com/sentry/hello-world-service'
sonarqube_project: hello-world-service
pagerduty_url: 'https://example.com/pager/hello-world-service'
tags:
- tag1
- tag2
- tag3
environments:
-
name: staging
dashboard_url: 'https://staging.example.com/dashboard'
service_urls:
- 'https://staging.example.com/service'
health_check_url: 'https://staging.example.com/health_check'
-
name: production
dashboard_url: 'https://production.example.com/dashboard'
service_urls:
- 'https://production.example.com/service'
health_check_url: 'https://production.example.com/health_check'
apiVersion: v1alpha1
kind: component
metadata:
name: zoo-prod-db
label: The Zoo Production Database
owner: platform-software
group:
product_owner: John
project_owner: Doe
maintainers:
- [email protected]
- [email protected]
description: Production DB for The Zoo
tags:
- Django
- Production
- Service Catalog
links:
- name: Datadog
url: https://dashboard.datadog.com
icon: datadog
- name: Sentry
url: https://sentry.kiwi.com
spec:
type: database
---
apiVersion: v1alpha1
kind: component
metadata:
name: the-zoo
label: The Zoo
owner: platform-software
group:
product_owner: John
project_owner: Doe
maintainers:
- [email protected]
- [email protected]
description: Application providing service catalog and much more
tags:
- Zoo
- catalog
- production
links:
- name: Datadog
url: https://datadog.zoo.com
spec:
type: service
environments:
- name: production
dashboard_url: https://dashboard.datadog.com
health_check_url: https://zoo.health.com
service_urls:
- https://zoo.com
- name: sandbox
dashboard_url: https://dashboard.datadog.sandbox.com
health_check_url: https://zoo.health.sandbox.com
service_urls:
- https://zoo.sandbox.com
impact: employees
integrations:
pagerduty_service: pagerduty_service1234
sentry_project: sentry project 15234
lifecycle: production
---
apiVersion: v1alpha1
kind: component
metadata:
name: superfast-sort
label: Super Fast Sort
owner: platform-software
group:
product_owner: Sort
project_owner: Maker
maintainers:
- [email protected]
description: Library providing super fast sort
tags:
- Sort
- Python
links:
- name: Datadog
url: https://dashboard.datadog.com
- name: Sentry
url: https://sentry.skypicker.com
spec:
type: library
impact: employees
integrations:
sonarqube_project: sonarqube
lifecycle: production
```
Full schema for this file can be found in [zoo_yml.py](zoo/repos/zoo_yml.py)
## Documentation
### Architecture Decision Records
Expand Down
228 changes: 228 additions & 0 deletions test/api/query/snapshots/snap_test_entities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals

from snapshottest import Snapshot


snapshots = Snapshot()

snapshots['test_all 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_empty 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_first 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_first_after 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_last 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_last_before 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_with_group 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_with_library 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_with_links 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_with_service 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}

snapshots['test_with_source 1'] = {
'data': {
'allEntities': None
},
'errors': [
{
'locations': [
{
'column': 7,
'line': 3
}
],
'message': 'Resolved value from the connection field have to be iterable or instance of EntityConnection. Received "None"',
'path': [
'allEntities'
]
}
]
}
Loading

0 comments on commit 1179161

Please sign in to comment.