ci: refresh open task evidence when the accepted root moves
This commit was merged in pull request #41.
This commit is contained in:
1 parent
6e4a7d5c10
commit
a93cb0e921
2 files changed
+13
-2
No files matched your search
@@ -396,7 +396,9 @@ def register_consumer_tasks(client, root_sha, entry, issue_cache):
|
|||||||
if issue["state"] == "open":
|
if issue["state"] == "open":
|
||||||
comments = tracking_comments(client, issues_url, issue)
|
comments = tracking_comments(client, issues_url, issue)
|
||||||
key_line = f"<!-- marqdo:candidate-inputs {task['key']} -->"
|
key_line = f"<!-- marqdo:candidate-inputs {task['key']} -->"
|
||||||
if not any(key_line in note.splitlines() for note in [issue["body"], *comments]):
|
baselines = [note.splitlines() for note in [issue["body"], *comments]
|
||||||
|
if note.splitlines()[:1] == [marker]]
|
||||||
|
if not {key_line, f"- Root candidate: {root_sha}"} <= set(baselines[-1]):
|
||||||
verify_root_base(client, root_sha)
|
verify_root_base(client, root_sha)
|
||||||
client.post(f"{issues_url}/{issue['number']}/comments", {"body": body})
|
client.post(f"{issues_url}/{issue['number']}/comments", {"body": body})
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class FakeForge:
|
|||||||
"published_at": PUBLISHED}
|
"published_at": PUBLISHED}
|
||||||
self.releases = [self.release]
|
self.releases = [self.release]
|
||||||
self.protected = True
|
self.protected = True
|
||||||
|
self.root_sha = BASE
|
||||||
self.tag_sha = SOURCE
|
self.tag_sha = SOURCE
|
||||||
self.pipeline_sha = SOURCE
|
self.pipeline_sha = SOURCE
|
||||||
self.wrong_account = False
|
self.wrong_account = False
|
||||||
@@ -90,7 +91,7 @@ class FakeForge:
|
|||||||
f"/repos/{REPO}/tags/{TAG}": {"name": TAG, "commit": {"sha": self.tag_sha}},
|
f"/repos/{REPO}/tags/{TAG}": {"name": TAG, "commit": {"sha": self.tag_sha}},
|
||||||
"/repos/cflmy/marqdo": {"default_branch": "main"},
|
"/repos/cflmy/marqdo": {"default_branch": "main"},
|
||||||
"/repos/cflmy/marqdo/branches/main": {"protected": self.protected,
|
"/repos/cflmy/marqdo/branches/main": {"protected": self.protected,
|
||||||
"commit": {"id": BASE}},
|
"commit": {"id": self.root_sha}},
|
||||||
"/user": ({"login": "admin", "is_admin": True} if self.wrong_account
|
"/user": ({"login": "admin", "is_admin": True} if self.wrong_account
|
||||||
else {**ACTOR, "is_admin": False}),
|
else {**ACTOR, "is_admin": False}),
|
||||||
}[path]
|
}[path]
|
||||||
@@ -193,6 +194,14 @@ class ReconcileTest(unittest.TestCase):
|
|||||||
self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1)
|
self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1)
|
||||||
self.run_scan(apply=True)
|
self.run_scan(apply=True)
|
||||||
self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1)
|
self.assertEqual(len(self.forge.comments[CONSUMER_ISSUES + "/100/comments"]), 1)
|
||||||
|
new_root = "f" * 40
|
||||||
|
self.forge.root_sha = new_root
|
||||||
|
with patch.object(reconcile, "managed_repositories", return_value=(new_root, graph, {REPO: COMPONENT})):
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
self.run_scan(apply=True)
|
||||||
|
notes = self.forge.comments[CONSUMER_ISSUES + "/100/comments"]
|
||||||
|
self.assertEqual(len(notes), 2)
|
||||||
|
self.assertIn(f"- Root candidate: {new_root}", notes[-1]["body"])
|
||||||
|
|
||||||
def test_apply_creates_one_verified_tracker_then_rechecks_it(self):
|
def test_apply_creates_one_verified_tracker_then_rechecks_it(self):
|
||||||
entry, = self.run_scan(apply=True)["results"]
|
entry, = self.run_scan(apply=True)["results"]
|
||||||
|
|||||||
Reference in new issue
Block a user