diff --git a/apps_ci/scripts/catalog_update.py b/apps_ci/scripts/catalog_update.py index cb1c51d..f295ced 100644 --- a/apps_ci/scripts/catalog_update.py +++ b/apps_ci/scripts/catalog_update.py @@ -40,6 +40,17 @@ def get_trains(location: str) -> typing.Tuple[dict, dict]: else: catalog_data[train_name][app_name][k] = v + # We will add capabilities and run as context from latest version to catalog data now + latest_version = app_data.get('latest_version') + metadata_info = {'capabilities': [], 'run_as_context': []} + if latest_version in app_data.get('versions', {}): + version_metadata_info = app_data['versions'][latest_version].get('app_metadata', {}) + metadata_info.update({ + 'capabilities': version_metadata_info.get('capabilities', metadata_info['capabilities']), + 'run_as_context': version_metadata_info.get('run_as_context', metadata_info['run_as_context']), + }) + catalog_data[train_name][app_name].update(metadata_info) + return catalog_data, versions_data diff --git a/apps_validation/json_schema_utils.py b/apps_validation/json_schema_utils.py index 573f4eb..1f06805 100644 --- a/apps_validation/json_schema_utils.py +++ b/apps_validation/json_schema_utils.py @@ -17,6 +17,34 @@ }, 'required': ['categories'], } + +APP_CAPABILITIES_SCHEMA = { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'description': {'type': 'string'}, + 'name': {'type': 'string'}, + }, + 'required': ['description', 'name'], + }, +} + +APP_RUN_AS_CONTEXT_SCHEMA = { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'description': {'type': 'string'}, + 'gid': {'type': 'integer'}, + 'group_name': {'type': 'string'}, + 'user_name': {'type': 'string'}, + 'uid': {'type': 'integer'}, + }, + 'required': ['description'], + }, +} + APP_METADATA_JSON_SCHEMA = { 'type': 'object', 'properties': { @@ -62,31 +90,8 @@ 'pattern': '[0-9]+.[0-9]+.[0-9]+', }, 'lib_version_hash': {'type': 'string'}, - 'run_as_context': { - 'type': 'array', - 'items': { - 'type': 'object', - 'properties': { - 'description': {'type': 'string'}, - 'gid': {'type': 'integer'}, - 'group_name': {'type': 'string'}, - 'user_name': {'type': 'string'}, - 'uid': {'type': 'integer'}, - }, - 'required': ['description'], - }, - }, - 'capabilities': { - 'type': 'array', - 'items': { - 'type': 'object', - 'properties': { - 'description': {'type': 'string'}, - 'name': {'type': 'string'}, - }, - 'required': ['description', 'name'], - }, - }, + 'run_as_context': APP_RUN_AS_CONTEXT_SCHEMA, + 'capabilities': APP_CAPABILITIES_SCHEMA, 'host_mounts': { 'type': 'array', 'items': { @@ -219,6 +224,8 @@ 'icon_url': { 'type': ['string', 'null'], }, + 'run_as_context': APP_RUN_AS_CONTEXT_SCHEMA, + 'capabilities': APP_CAPABILITIES_SCHEMA, 'maintainers': { 'type': 'array', 'items': {