diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-11-05 12:01:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-11-05 12:01:16 +0200 |
commit | 9748779eba0df8bd0d2f592fbbb9839348b80dfe (patch) | |
tree | 1738c6c13ea7ee1db5b3f0d1aecb28862cc7aed4 /mod | |
parent | 64d93803d18f9137179293bbee1364ee2022ebb6 (diff) |
Sketch service_data::completed flag
Diffstat (limited to 'mod')
-rw-r--r-- | mod/mod-ci-github-service-data.hxx | 5 | ||||
-rw-r--r-- | mod/mod-ci-github.cxx | 30 |
2 files changed, 34 insertions, 1 deletions
diff --git a/mod/mod-ci-github-service-data.hxx b/mod/mod-ci-github-service-data.hxx index 0dd52ca..bb845cb 100644 --- a/mod/mod-ci-github-service-data.hxx +++ b/mod/mod-ci-github-service-data.hxx @@ -114,6 +114,11 @@ namespace brep vector<check_run> check_runs; + // Flag indicating that all the elements in check_runs are built and this + // check suite is completed. + // + bool completed; + // The GitHub ID of the synthetic conclusion check run or absent if it // hasn't been created yet. // diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index b2e0c41..a3e2586 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -1194,6 +1194,13 @@ namespace brep return nullptr; } + // Ignore attempts to add new builds to a completed check run. This can + // happen, for example, if a new build configuration is added before + // the tenant is archived. + // + if (sd.completed) + return nullptr; + // The builds for which we will be creating check runs. // vector<reference_wrapper<const build>> bs; @@ -1356,6 +1363,12 @@ namespace brep return nullptr; } + // Similar to build_queued(), ignore attempts to add new builds to a + // completed check run. + // + if (sd.completed) + return nullptr; + optional<check_run> cr; // Updated check run. string bid (gh_check_run_name (b)); // Full build id. @@ -1500,8 +1513,15 @@ namespace brep return nullptr; } + // Similar to build_queued(), ignore attempts to add new builds to a + // completed check run. + // + if (sd.completed) + return nullptr; + // Here we need to update the state of this check run and, if there are no - // more unbuilt ones, update the synthetic conclusion check run. + // more unbuilt ones, update the synthetic conclusion check run and mark + // the check run as completed. // // Absent means we still have unbuilt check runs. // @@ -1585,6 +1605,8 @@ namespace brep else iat = &sd.installation_access; + bool completed (false); + // Note: we treat the failure to obtain the installation access token the // same as the failure to notify GitHub (state is updated but not marked // synced). @@ -1781,12 +1803,15 @@ namespace brep << ": unable to update conclusion check run " << *sd.conclusion_node_id; } + + completed = true; } } } return [iat = move (new_iat), cr = move (cr), + completed = completed, error = move (error), warn = move (warn)] (const tenant_service& ts) -> optional<string> { @@ -1832,6 +1857,9 @@ namespace brep sd.check_runs.push_back (cr); } + if (completed) + sd.completed = true; + return sd.json (); }; } |