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

NAS-131119 / 25.04 / Grab capabilities/run as context from latest app version available #53

Merged
merged 2 commits into from
Sep 20, 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
11 changes: 11 additions & 0 deletions apps_ci/scripts/catalog_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
sonicaj marked this conversation as resolved.
Show resolved Hide resolved
'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


Expand Down
57 changes: 32 additions & 25 deletions apps_validation/json_schema_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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': {
Expand Down
Loading