aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-ci-github.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-11-04 12:42:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-11-04 12:42:30 +0200
commitfa54faa17f1f6b2f1d0737fdca0123ddba999fd9 (patch)
tree0d55e80fcdb6c558bfadc3f63bb4d49c24ec2f1d /mod/mod-ci-github.cxx
parent486fe4de562d88d15ee44febf2ebd12d6b0db492 (diff)
Review
Diffstat (limited to 'mod/mod-ci-github.cxx')
-rw-r--r--mod/mod-ci-github.cxx64
1 files changed, 22 insertions, 42 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index e7dd7b5..b2e0c41 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -1736,34 +1736,8 @@ namespace brep
if (cr.state_synced)
{
- // Check run was created/updated successfully to built.
- //
- // @@ TMP Feels like this should also be done inside
- // gq_{create,update}_check_run() -- where cr.state is set if the
- // create/update succeeds -- but I think we didn't want to pass a
- // result_status into a gq_ function because converting to a GitHub
- // conclusion/title/summary is reasonably complicated.
- //
- // @@@ We need to redo that code:
- //
- // - Pass the vector of check runs with new state (and status) set.
- // - Update synchronized flag inside those functions.
- // - Update the state to built if it's already built on GitHub --
- // but then what do we set the status to?
- //
- // @@ TMP This scenario can only arise for updates to building.
- // For creations a new CR will always be created so the
- // returned state will always be what we asked for; and we
- // never update to queued.
- //
- // As for updates to building, if GH has already been updated
- // to built then the build_built() lambda will soon save the
- // built state and valid status so nothing more should need to
- // be done. In fact, whenever updating to building we do stop
- // immediately if it's already built on GH.
- //
- // - Maybe signal in return value (optional<bool>?) that there is
- // a discrepancy.
+ // Check run was created/updated successfully to built (with
+ // status we specified).
//
cr.status = b.status;
@@ -1833,24 +1807,30 @@ namespace brep
if (iat)
sd.installation_access = *iat;
- if (check_run* scr = sd.find_check_run (cr.build_id))
+ // Only update the check_run state in service data if it matches the
+ // state (specifically, status) on GitHub.
+ //
+ if (cr.state_synced)
{
- // This will most commonly generate a duplicate warning (see above).
- // We could save the old state and only warn if it differs but let's
- // not complicate things for now.
- //
-#if 0
- if (scr->state != build_state::building)
+ if (check_run* scr = sd.find_check_run (cr.build_id))
{
- warn << "check run " << cr.build_id << ": out of order built "
- << "notification service data update; existing state: "
- << scr->state_string ();
- }
+ // This will most commonly generate a duplicate warning (see above).
+ // We could save the old state and only warn if it differs but let's
+ // not complicate things for now.
+ //
+#if 0
+ if (scr->state != build_state::building)
+ {
+ warn << "check run " << cr.build_id << ": out of order built "
+ << "notification service data update; existing state: "
+ << scr->state_string ();
+ }
#endif
- *scr = cr;
+ *scr = cr;
+ }
+ else
+ sd.check_runs.push_back (cr);
}
- else
- sd.check_runs.push_back (cr);
return sd.json ();
};