diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-22 07:05:57 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-22 07:56:00 +0200 |
commit | a4c1f60c813783722d889a30d0d98aff177633bf (patch) | |
tree | 658d9ffe61501671206855860349a31272844b0f | |
parent | de4d7616b37f7d0c3bb3a2f0a3a60e4693472675 (diff) |
Get building again
-rw-r--r-- | mod/ci-common.cxx | 6 | ||||
-rw-r--r-- | mod/mod-ci-github.cxx | 60 | ||||
-rw-r--r-- | mod/mod-ci-github.hxx | 6 |
3 files changed, 40 insertions, 32 deletions
diff --git a/mod/ci-common.cxx b/mod/ci-common.cxx index caf9f40..b3fc432 100644 --- a/mod/ci-common.cxx +++ b/mod/ci-common.cxx @@ -534,7 +534,7 @@ namespace brep s.next ("", ""); // End of manifest. } - optional<string> ci_start:: + pair<optional<string>, ci_start::duplicate_tenant_result> ci_start:: create (const basic_mark& error, const basic_mark&, const basic_mark* trace, @@ -557,7 +557,7 @@ namespace brep catch (const system_error& e) { error << "unable to generate request id: " << e; - return nullopt; + return {nullopt, duplicate_tenant_result::ignored}; // @@ TODO HACKED AROUND } // Use the generated request id if the tenant service id is not specified. @@ -605,7 +605,7 @@ namespace brep *trace << "unloaded CI request " << t.id << " for service " << t.service->id << ' ' << t.service->type << " is created"; - return move (t.id); + return {move (t.id), duplicate_tenant_result::created}; // @@ TODO HACKED AROUND } optional<ci_start::start_result> ci_start:: diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 56f6d89..b9dc80f 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -825,8 +825,32 @@ namespace brep } function<optional<string> (const tenant_service&)> ci_github:: - build_unloaded_pre_check (service_data&& sd, - const diag_epilogue& log_writer) const noexcept + build_unloaded (tenant_service&& ts, + const diag_epilogue& log_writer) const noexcept + { + NOTIFICATION_DIAG (log_writer); + + service_data sd; + try + { + sd = service_data (*ts.data); + } + catch (const invalid_argument& e) + { + error << "failed to parse service data: " << e; + return nullptr; + } + + return sd.pre_check + ? build_unloaded_pre_check (move (ts), move (sd), log_writer) + : build_unloaded_load (move (ts), move (sd), log_writer); + } + + function<optional<string> (const tenant_service&)> ci_github:: + build_unloaded_pre_check ( + tenant_service&&, + service_data&& sd, + const diag_epilogue& log_writer) const noexcept { NOTIFICATION_DIAG (log_writer); @@ -842,9 +866,13 @@ namespace brep } function<optional<string> (const tenant_service&)> ci_github:: - build_unloaded_load (service_data&& sd, - const diag_epilogue& log_writer) const noexcept + build_unloaded_load ( + tenant_service&& ts, + service_data&& sd, + const diag_epilogue& log_writer) const noexcept { + NOTIFICATION_DIAG (log_writer); + // @@@ TODO: load the tenant: should be the same for both branch push and // PR. // @@ -1204,28 +1232,6 @@ namespace brep }; } - function<optional<string> (const tenant_service&)> ci_github:: - build_unloaded (tenant_service&& ts, - const diag_epilogue& log_writer) const noexcept - { - NOTIFICATION_DIAG (log_writer); - - service_data sd; - try - { - sd = service_data (*ts.data); - } - catch (const invalid_argument& e) - { - error << "failed to parse service data: " << e; - return nullptr; - } - - return sd.pre_check - ? build_unloaded_pre_check (move (sd), log_writer) - : build_unloaded_load (move (sd), log_writer) - } - // Build state change notifications (see tenant-services.hxx for // background). Mapping our state transitions to GitHub pose multiple // problems: @@ -2017,7 +2023,7 @@ namespace brep *build_db_, move (ts), chrono::seconds (30) /* interval */, chrono::seconds (0) /* delay */) - .has_value (); + .first.has_value (); // @@ TODO HACKED AROUND } string ci_github:: diff --git a/mod/mod-ci-github.hxx b/mod/mod-ci-github.hxx index c24e0a5..e919065 100644 --- a/mod/mod-ci-github.hxx +++ b/mod/mod-ci-github.hxx @@ -47,11 +47,13 @@ namespace brep const diag_epilogue& log_writer) const noexcept override; function<optional<string> (const tenant_service&)> - build_unloaded_pre_check (service_data&&, + build_unloaded_pre_check (tenant_service&&, + service_data&&, const diag_epilogue&) const noexcept; function<optional<string> (const tenant_service&)> - build_unloaded_load (service_data&&, + build_unloaded_load (tenant_service&&, + service_data&&, const diag_epilogue&) const noexcept; virtual function<optional<string> (const tenant_service&)> |