utf-queue-client 1.12.4__tar.gz → 1.13.0b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/PKG-INFO +1 -1
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/setup.py +2 -1
- utf-queue-client-1.13.0b1/test/test_publish_release_info.py +72 -0
- utf-queue-client-1.13.0b1/utf_queue_client/scripts/publish_release_info_cli.py +122 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/publish_test_results_cli.py +1 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/PKG-INFO +1 -1
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/SOURCES.txt +2 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/entry_points.txt +1 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/README.md +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/setup.cfg +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_async_consumer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_data_lake_data_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_legacy_base_model.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_models.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_opentelemetry_data_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_publish_test_results.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_sqa_test_result_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_ubai_search.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_ubai_update_retention.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_ubai_upload.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/async_consumer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/base_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/data_lake_data_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/opentelemetry_data_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/sqa_test_result_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/ubai_artifact_upload_request_producer.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/exceptions/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/models/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/models/base_model.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/models/model_factory.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/models/schemas/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/ubai_search_cli.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/ubai_update_retention_cli.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/ubai_upload_cli.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/utils/__init__.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/utils/queue_metrics_exporter.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/utils/queue_span_exporter.py +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/dependency_links.txt +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/requires.txt +0 -0
- {utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/top_level.txt +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from setuptools import setup, find_packages # noqa: H301
|
|
7
7
|
|
|
8
8
|
NAME = "utf-queue-client"
|
|
9
|
-
VERSION = "1.
|
|
9
|
+
VERSION = "1.13.0b1"
|
|
10
10
|
# To install the library, run the following
|
|
11
11
|
#
|
|
12
12
|
# python setup.py install
|
|
@@ -53,6 +53,7 @@ setup(
|
|
|
53
53
|
"ubai_search_cli = utf_queue_client.scripts.ubai_search_cli:cli_entrypoint",
|
|
54
54
|
"publish_test_results_cli = utf_queue_client.scripts.publish_test_results_cli:cli_entrypoint",
|
|
55
55
|
"ubai_update_retention_cli = utf_queue_client.scripts.ubai_update_retention_cli:cli_entrypoint",
|
|
56
|
+
"publish_release_info_cli = utf_queue_client.scripts.publish_release_info_cli:cli_entrypoint"
|
|
56
57
|
],
|
|
57
58
|
},
|
|
58
59
|
include_package_data=True,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from otel_extensions import inject_context_to_env, instrumented
|
|
3
|
+
import os
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
from utf_queue_client.scripts.publish_release_info_cli import publish_release_information, update_artifacts_retention_days_to_keep_forever
|
|
7
|
+
import requests
|
|
8
|
+
from unittest import mock
|
|
9
|
+
from unittest.mock import MagicMock, patch
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.fixture
|
|
13
|
+
def publish_release_info():
|
|
14
|
+
yield [
|
|
15
|
+
("releaseDate", "2023-06-16"),
|
|
16
|
+
("branchName", "release/gecko_sdk_3.2"),
|
|
17
|
+
("releaseType", "GA"),
|
|
18
|
+
("releaseName", "23Q2-GA"),
|
|
19
|
+
("SDKBuildNum", "407"),
|
|
20
|
+
("installerURLSDK", "https://jenkins-cbs-gecko-sdk.silabs.net/job/Gecko_SDK_Suite_super/job/release%252F21q4/284/"),
|
|
21
|
+
("IARVersionNum", "9.20.4"),
|
|
22
|
+
("GCCVersionNum", "10.3.1"),
|
|
23
|
+
("CommanderVersionNum", "v1.8.1"),
|
|
24
|
+
("SEVersionNum", "1.2.4"),
|
|
25
|
+
("WSTKFirmwareVersionNum", "v1.4.4")
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@instrumented
|
|
30
|
+
def test_publish_release_info(request, publish_release_info):
|
|
31
|
+
args = ["--username", "svc_sqabot", "--password", "password"]
|
|
32
|
+
for k, v in publish_release_info:
|
|
33
|
+
args += ["--data", k, v]
|
|
34
|
+
|
|
35
|
+
base_dir = os.path.dirname(os.path.dirname(__file__))
|
|
36
|
+
@inject_context_to_env
|
|
37
|
+
def call_cli_script():
|
|
38
|
+
assert "TRACEPARENT" in os.environ
|
|
39
|
+
process = subprocess.Popen(
|
|
40
|
+
[
|
|
41
|
+
sys.executable,
|
|
42
|
+
os.path.join(
|
|
43
|
+
base_dir, "utf_queue_client", "scripts", "publish_release_info_cli.py"
|
|
44
|
+
),
|
|
45
|
+
]
|
|
46
|
+
+ args,
|
|
47
|
+
)
|
|
48
|
+
process.communicate()
|
|
49
|
+
assert process.poll() == 0
|
|
50
|
+
|
|
51
|
+
call_cli_script()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_publish_release_information():
|
|
55
|
+
requests_post = requests.post
|
|
56
|
+
requests.post = MagicMock()
|
|
57
|
+
publish_release_information("", "", {})
|
|
58
|
+
assert requests.post.call_count == 2
|
|
59
|
+
requests.post = requests_post
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_update_artifacts_retention_days_to_keep_forever():
|
|
63
|
+
requests_patch = requests.patch
|
|
64
|
+
requests.patch = MagicMock()
|
|
65
|
+
data_dict = {"branchName": "release/gec", "SDKBuildNum": "407"}
|
|
66
|
+
update_artifacts_retention_days_to_keep_forever(data_dict)
|
|
67
|
+
assert requests.patch.call_count == 1
|
|
68
|
+
requests.patch = requests_patch
|
|
69
|
+
patch_response = MagicMock()
|
|
70
|
+
mocked_patch =mock.patch.object(requests, "patch", return_value=patch_response)
|
|
71
|
+
patch_response.status_code = 200
|
|
72
|
+
update_artifacts_retention_days_to_keep_forever(data_dict)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from utf_queue_client.scripts import setup_telemetry
|
|
3
|
+
from retry import retry
|
|
4
|
+
from typing import Iterable, Tuple
|
|
5
|
+
from otel_extensions import instrumented
|
|
6
|
+
import requests
|
|
7
|
+
|
|
8
|
+
NUM_RETRIES = 6
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click.option(
|
|
13
|
+
"--username",
|
|
14
|
+
type=str,
|
|
15
|
+
required=True,
|
|
16
|
+
help="username",
|
|
17
|
+
)
|
|
18
|
+
@click.option(
|
|
19
|
+
"--password",
|
|
20
|
+
type=str,
|
|
21
|
+
required=True,
|
|
22
|
+
help="password",
|
|
23
|
+
)
|
|
24
|
+
@click.option(
|
|
25
|
+
"--data",
|
|
26
|
+
multiple=True,
|
|
27
|
+
type=(str, str),
|
|
28
|
+
required=True,
|
|
29
|
+
help="data in dictionary format",
|
|
30
|
+
)
|
|
31
|
+
def cli_entrypoint(username, password, data):
|
|
32
|
+
cli(username, password, data)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def cli(username: str, password: str, data: Iterable[Tuple[str, str]]):
|
|
36
|
+
with setup_telemetry():
|
|
37
|
+
data_dict = {}
|
|
38
|
+
for key, value in data:
|
|
39
|
+
data_dict[key] = value
|
|
40
|
+
|
|
41
|
+
@retry(Exception, delay=5, backoff=2, max_delay=30, tries=NUM_RETRIES + 1)
|
|
42
|
+
def retry_wrapper():
|
|
43
|
+
response = publish_release_information(username, password, data_dict)
|
|
44
|
+
if response is not None:
|
|
45
|
+
update_artifacts_retention_days_to_keep_forever(data_dict)
|
|
46
|
+
retry_wrapper()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@instrumented
|
|
50
|
+
def publish_release_information(username: str, password: str, data_dict: dict):
|
|
51
|
+
url = 'https://iot-reports.silabs.net/api/v1/auth'
|
|
52
|
+
|
|
53
|
+
# Create a dictionary with the username and password
|
|
54
|
+
credentials = {
|
|
55
|
+
'username': username,
|
|
56
|
+
'password': password
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
response = requests.post(url, json=credentials, verify=False)
|
|
61
|
+
response.raise_for_status() # Raise an exception for 4xx/5xx status codes
|
|
62
|
+
|
|
63
|
+
# Extract the JWT token from the response
|
|
64
|
+
jwt_token = response.json()['access_token']
|
|
65
|
+
|
|
66
|
+
except requests.exceptions.RequestException as e:
|
|
67
|
+
print(f"Error: {e}")
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
url = 'https://releaseinfo.silabs.net/api/v1/releases'
|
|
71
|
+
|
|
72
|
+
# Create the Authorization header with the Bearer token
|
|
73
|
+
headers = {
|
|
74
|
+
'Authorization': f'JWT {jwt_token}'
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# Send the POST request with the headers
|
|
78
|
+
response = requests.post(url, json=data_dict, headers=headers, verify=False)
|
|
79
|
+
|
|
80
|
+
# Check the response status code
|
|
81
|
+
if response.status_code == 201:
|
|
82
|
+
# Request successful
|
|
83
|
+
print('Publish release information successful!')
|
|
84
|
+
print('Response:', response.json())
|
|
85
|
+
return True
|
|
86
|
+
else:
|
|
87
|
+
# Request failed
|
|
88
|
+
print('Publish release information failed.')
|
|
89
|
+
print('Status Code:', response.status_code)
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@instrumented
|
|
94
|
+
def update_artifacts_retention_days_to_keep_forever(data_dict: dict):
|
|
95
|
+
url = 'https://ubai.silabs.net/api/v1/artifacts'
|
|
96
|
+
|
|
97
|
+
artifact_search_spec = {
|
|
98
|
+
"metadata": {
|
|
99
|
+
"branch": data_dict["branchName"],
|
|
100
|
+
"build_number": data_dict["SDKBuildNum"]
|
|
101
|
+
},
|
|
102
|
+
"retentionDays": -1
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# Send the PATCH request with the headers
|
|
106
|
+
response = requests.patch(url, json=artifact_search_spec, verify=False)
|
|
107
|
+
|
|
108
|
+
# Check the response status code
|
|
109
|
+
if response.status_code == 200:
|
|
110
|
+
# Request successful
|
|
111
|
+
print("Updated Retention days in UBAI for release artifact to keep forever!")
|
|
112
|
+
print("Response:", response.json())
|
|
113
|
+
else:
|
|
114
|
+
# Request failed
|
|
115
|
+
print('Update Retention days in UBAI for release artifact to keep forever failed.')
|
|
116
|
+
print('Status Code:', response.status_code)
|
|
117
|
+
print('Response:', response.json())
|
|
118
|
+
return None
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if __name__ == "__main__":
|
|
122
|
+
cli_entrypoint()
|
|
@@ -6,6 +6,7 @@ test/test_data_lake_data_producer.py
|
|
|
6
6
|
test/test_legacy_base_model.py
|
|
7
7
|
test/test_models.py
|
|
8
8
|
test/test_opentelemetry_data_producer.py
|
|
9
|
+
test/test_publish_release_info.py
|
|
9
10
|
test/test_publish_test_results.py
|
|
10
11
|
test/test_sqa_test_result_producer.py
|
|
11
12
|
test/test_ubai_search.py
|
|
@@ -31,6 +32,7 @@ utf_queue_client/models/base_model.py
|
|
|
31
32
|
utf_queue_client/models/model_factory.py
|
|
32
33
|
utf_queue_client/models/schemas/__init__.py
|
|
33
34
|
utf_queue_client/scripts/__init__.py
|
|
35
|
+
utf_queue_client/scripts/publish_release_info_cli.py
|
|
34
36
|
utf_queue_client/scripts/publish_test_results_cli.py
|
|
35
37
|
utf_queue_client/scripts/ubai_search_cli.py
|
|
36
38
|
utf_queue_client/scripts/ubai_update_retention_cli.py
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/entry_points.txt
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
[console_scripts]
|
|
2
|
+
publish_release_info_cli = utf_queue_client.scripts.publish_release_info_cli:cli_entrypoint
|
|
2
3
|
publish_test_results_cli = utf_queue_client.scripts.publish_test_results_cli:cli_entrypoint
|
|
3
4
|
ubai_search_cli = utf_queue_client.scripts.ubai_search_cli:cli_entrypoint
|
|
4
5
|
ubai_update_retention_cli = utf_queue_client.scripts.ubai_update_retention_cli:cli_entrypoint
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/test/test_opentelemetry_data_producer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/async_consumer.py
RENAMED
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/clients/base_producer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/exceptions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/models/model_factory.py
RENAMED
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/models/schemas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/ubai_search_cli.py
RENAMED
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/scripts/ubai_upload_cli.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client/utils/queue_span_exporter.py
RENAMED
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/requires.txt
RENAMED
|
File without changes
|
{utf-queue-client-1.12.4 → utf-queue-client-1.13.0b1}/utf_queue_client.egg-info/top_level.txt
RENAMED
|
File without changes
|