Skip to content

Commit

Permalink
fix: set test.run.id as str (#622)
Browse files Browse the repository at this point in the history
OpenTelemetry cannot encode 8 bytes integer in protobuf.
  • Loading branch information
jd authored Feb 14, 2025
1 parent c30213c commit 0e5c848
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mergify_cli/ci/junit.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class InvalidJunitXMLError(Exception):


async def junit_to_spans(
run_id: int,
run_id: str,
xml_content: bytes,
test_language: str | None = None,
test_framework: str | None = None,
6 changes: 3 additions & 3 deletions mergify_cli/ci/upload.py
Original file line number Diff line number Diff line change
@@ -55,10 +55,10 @@ def upload_spans(
raise UploadError(logstr.getvalue())


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

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

run_id = junit.ID_GENERATOR.generate_span_id()
run_id = junit.ID_GENERATOR.generate_span_id().to_bytes(8, "big").hex()

for filename in files:
try:
2 changes: 1 addition & 1 deletion mergify_cli/tests/ci/test_junit.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ async def test_parse(
_get_cicd_pipeline_run_attempt: mock.Mock,
) -> None:
filename = pathlib.Path(__file__).parent / "junit_example.xml"
run_id = 32312
run_id = (32312).to_bytes(8, "big").hex()
spans = await junit.junit_to_spans(
run_id,
filename.read_bytes(),

0 comments on commit 0e5c848

Please sign in to comment.