Skip to content

Commit

Permalink
Expose Checkbox version in JSON output (submission.json) (new) (#1595)
Browse files Browse the repository at this point in the history
* Add Checkbox version to the Jinja2 template data

The Jinja2 template data already has `client_version`, which internally
uses the `plainbox.get_version_string()` function to return either the
Checkbox version as a string like

    Checkbox 3.3.1.dev333+gbe9508960.d20240701

either information about the Snap being used, if Checkbox is run as a
snap:

    checkbox 4.2.0-dev127 (10238)

This commit adds a `checkbox_version` field that always contains only
the Checkbox version, without any additional string, such as :

    3.3.1.dev333+gbe9508960.d20240701

This allows for a more precise tracking of what version of the Checkbox
framework is used for debugging purposes.

Fix #1580

* Add client_version and checkbox_version to submission JSON output

* Update JSON schema reference to include client_version and checkbox_version
  • Loading branch information
pieqq authored Nov 12, 2024
1 parent 07fe80a commit 542c748
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions checkbox-ng/plainbox/impl/exporter/jinja2.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@


from plainbox import get_version_string
from plainbox import __version__ as checkbox_version
from plainbox.abc import ISessionStateExporter
from plainbox.impl.exporter import SessionStateExporterBase
from plainbox.impl.result import OUTCOME_METADATA_MAP
Expand Down Expand Up @@ -109,6 +110,7 @@ def __init__(
self._client_version = client_version or get_version_string()
# Remember client name
self._client_name = client_name
self._checkbox_version = checkbox_version

self.option_list = None
self.template = None
Expand Down Expand Up @@ -195,6 +197,7 @@ def dump_from_session_manager(self, session_manager, stream):
"OUTCOME_METADATA_MAP": OUTCOME_METADATA_MAP,
"client_name": self._client_name,
"client_version": self._client_version,
"checkbox_version": self._checkbox_version,
"manager": session_manager,
"app_blob": app_blob_data,
"options": self.option_list,
Expand All @@ -220,6 +223,7 @@ def dump_from_session_manager_list(self, session_manager_list, stream):
"OUTCOME_METADATA_MAP": OUTCOME_METADATA_MAP,
"client_name": self._client_name,
"client_version": self._client_version,
"checkbox_version": self._checkbox_version,
"manager_list": session_manager_list,
"app_blob": {},
"options": self.option_list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{%- set system_information = state.system_information -%}
{
"title": {{ state.metadata.title | jsonify | safe }},
"client_version": {{ client_version | jsonify | safe }},
"checkbox_version": {{ checkbox_version | jsonify | safe }},
{%- if "testplan_id" in app_blob %}
{%- if app_blob['testplan_id'] %}
"testplan_id": {{ app_blob['testplan_id'] | jsonify | safe }},
Expand Down
6 changes: 6 additions & 0 deletions submission-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"title": {
"type": "string"
},
"client_version": {
"type": "string"
},
"checkbox_version": {
"type": "string"
},
"testplan_id": {
"type": "string"
},
Expand Down

0 comments on commit 542c748

Please sign in to comment.