Skip to content

Commit 0e5c848

Browse files
authored
fix: set test.run.id as str (#622)
OpenTelemetry cannot encode 8 bytes integer in protobuf.
1 parent c30213c commit 0e5c848

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

mergify_cli/ci/junit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InvalidJunitXMLError(Exception):
2525

2626

2727
async def junit_to_spans(
28-
run_id: int,
28+
run_id: str,
2929
xml_content: bytes,
3030
test_language: str | None = None,
3131
test_framework: str | None = None,

mergify_cli/ci/upload.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def upload_spans(
5555
raise UploadError(logstr.getvalue())
5656

5757

58-
def connect_traces(run_id: int) -> None:
58+
def connect_traces(run_id: str) -> None:
5959
if detector.get_ci_provider() == "github_actions":
6060
console.print(
61-
f"::notice title=Mergify CI::MERGIFY_TEST_RUN_ID={run_id.to_bytes(8, 'big').hex()}",
61+
f"::notice title=Mergify CI::MERGIFY_TEST_RUN_ID={run_id}",
6262
soft_wrap=True,
6363
)
6464

@@ -73,7 +73,7 @@ async def upload( # noqa: PLR0913, PLR0917
7373
) -> None:
7474
spans = []
7575

76-
run_id = junit.ID_GENERATOR.generate_span_id()
76+
run_id = junit.ID_GENERATOR.generate_span_id().to_bytes(8, "big").hex()
7777

7878
for filename in files:
7979
try:

mergify_cli/tests/ci/test_junit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def test_parse(
2626
_get_cicd_pipeline_run_attempt: mock.Mock,
2727
) -> None:
2828
filename = pathlib.Path(__file__).parent / "junit_example.xml"
29-
run_id = 32312
29+
run_id = (32312).to_bytes(8, "big").hex()
3030
spans = await junit.junit_to_spans(
3131
run_id,
3232
filename.read_bytes(),

0 commit comments

Comments
 (0)