Skip to content

Commit

Permalink
Add log-detective link to error output
Browse files Browse the repository at this point in the history
Fixes #460
  • Loading branch information
kwk committed May 2, 2024
1 parent 8591c55 commit faa2654
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion snapshot_manager/snapshot_manager/build_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class BuildState:

def render_as_markdown(self) -> str:
"""Return an HTML string representation of this Build State to be used in a github issue"""
link = f'<a href="{self.build_log_url}">build log</a>'
link = f'<a href="{self.build_log_url}">build log</a>, <a href="https://logdetective.com/contribute/copr/{self.build_id:08}/{self.chroot}]">contribute to log-detective</a>'
if self.url_build_log is None:
link = f'<a href="{self.build_page_url}">build page</a>'
return f"""
Expand Down
26 changes: 13 additions & 13 deletions snapshot_manager/tests/build_status_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_render_as_markdown(self):
expected = """
<details>
<summary>
<code>foo</code> on <code>fedora-40-x86_64</code> (see <a href="https://example.com/url_build_log">build log</a>)
<code>foo</code> on <code>fedora-40-x86_64</code> (see <a href="https://example.com/url_build_log">build log</a>, <a href="https://logdetective.com/contribute/copr/00001234/fedora-40-x86_64]">contribute to log-detective</a>)
</summary>
This is the context for the error
</details>
Expand Down Expand Up @@ -136,12 +136,12 @@ def test_render_as_markdown(self):
"""Test that a list of errors is rendered properly to HTML"""
# fmt: off
kwargs = {"copr_ownername": "foo", "copr_projectname": "bar"}
e1 = build_status.BuildState(url_build_log="http://e1", err_ctx="e1", err_cause=build_status.ErrorCause.ISSUE_NETWORK, chroot="chroot-a", package_name="package-a", **kwargs)
e2 = build_status.BuildState(url_build_log="http://e2", err_ctx="e2", err_cause=build_status.ErrorCause.ISSUE_NETWORK, chroot="chroot-a", package_name="package-b", **kwargs)
e3 = build_status.BuildState(url_build_log="http://e3", err_ctx="e3", err_cause=build_status.ErrorCause.ISSUE_NETWORK, chroot="chroot-a", package_name="package-c", **kwargs)
e4 = build_status.BuildState(url_build_log="http://e4", err_ctx="e4", err_cause=build_status.ErrorCause.ISSUE_TEST, chroot="chroot-c", package_name="package-a", **kwargs)
e5 = build_status.BuildState(url_build_log="http://e5", err_ctx="e5", err_cause=build_status.ErrorCause.ISSUE_TEST, chroot="chroot-c", package_name="package-b", **kwargs)
e6 = build_status.BuildState(url_build_log="http://e6", err_ctx="e6", err_cause=build_status.ErrorCause.ISSUE_TEST, chroot="chroot-c", package_name="package-c", **kwargs)
e1 = build_status.BuildState(build_id=111, url_build_log="http://e1", err_ctx="e1", err_cause=build_status.ErrorCause.ISSUE_NETWORK, chroot="chroot-a", package_name="package-a", **kwargs)
e2 = build_status.BuildState(build_id=222, url_build_log="http://e2", err_ctx="e2", err_cause=build_status.ErrorCause.ISSUE_NETWORK, chroot="chroot-a", package_name="package-b", **kwargs)
e3 = build_status.BuildState(build_id=333, url_build_log="http://e3", err_ctx="e3", err_cause=build_status.ErrorCause.ISSUE_NETWORK, chroot="chroot-a", package_name="package-c", **kwargs)
e4 = build_status.BuildState(build_id=444, url_build_log="http://e4", err_ctx="e4", err_cause=build_status.ErrorCause.ISSUE_TEST, chroot="chroot-c", package_name="package-a", **kwargs)
e5 = build_status.BuildState(build_id=555, url_build_log="http://e5", err_ctx="e5", err_cause=build_status.ErrorCause.ISSUE_TEST, chroot="chroot-c", package_name="package-b", **kwargs)
e6 = build_status.BuildState(build_id=666, url_build_log="http://e6", err_ctx="e6", err_cause=build_status.ErrorCause.ISSUE_TEST, chroot="chroot-c", package_name="package-c", **kwargs)
# fmt: on
unsorted: build_status.BuildStateList = [e3, e6, e1, e5, e4, e2]

Expand All @@ -153,42 +153,42 @@ def test_render_as_markdown(self):
expected = """<ul><li><b>network_issue</b><ol><li>
<details>
<summary>
<code>package-a</code> on <code>chroot-a</code> (see <a href="http://e1">build log</a>)
<code>package-a</code> on <code>chroot-a</code> (see <a href="http://e1">build log</a>, <a href="https://logdetective.com/contribute/copr/00000111/chroot-a]">contribute to log-detective</a>)
</summary>
e1
</details>
</li><li>
<details>
<summary>
<code>package-b</code> on <code>chroot-a</code> (see <a href="http://e2">build log</a>)
<code>package-b</code> on <code>chroot-a</code> (see <a href="http://e2">build log</a>, <a href="https://logdetective.com/contribute/copr/00000222/chroot-a]">contribute to log-detective</a>)
</summary>
e2
</details>
</li><li>
<details>
<summary>
<code>package-c</code> on <code>chroot-a</code> (see <a href="http://e3">build log</a>)
<code>package-c</code> on <code>chroot-a</code> (see <a href="http://e3">build log</a>, <a href="https://logdetective.com/contribute/copr/00000333/chroot-a]">contribute to log-detective</a>)
</summary>
e3
</details>
</li></ol></li><li><b>test</b><ol><li>
<details>
<summary>
<code>package-a</code> on <code>chroot-c</code> (see <a href="http://e4">build log</a>)
<code>package-a</code> on <code>chroot-c</code> (see <a href="http://e4">build log</a>, <a href="https://logdetective.com/contribute/copr/00000444/chroot-c]">contribute to log-detective</a>)
</summary>
e4
</details>
</li><li>
<details>
<summary>
<code>package-b</code> on <code>chroot-c</code> (see <a href="http://e5">build log</a>)
<code>package-b</code> on <code>chroot-c</code> (see <a href="http://e5">build log</a>, <a href="https://logdetective.com/contribute/copr/00000555/chroot-c]">contribute to log-detective</a>)
</summary>
e5
</details>
</li><li>
<details>
<summary>
<code>package-c</code> on <code>chroot-c</code> (see <a href="http://e6">build log</a>)
<code>package-c</code> on <code>chroot-c</code> (see <a href="http://e6">build log</a>, <a href="https://logdetective.com/contribute/copr/00000666/chroot-c]">contribute to log-detective</a>)
</summary>
e6
</details>
Expand Down

0 comments on commit faa2654

Please sign in to comment.