diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-13 16:07:14 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-17 14:51:11 +0200 |
commit | 17d5a70735ae954ef6eefdc9190c6164440de312 (patch) | |
tree | b1edb7e4cc5fba58bab53ed931d52d964cd769b5 /mod/mod-ci-github.cxx | |
parent | bcecc41a017f4f4ed46bbe0ab2decdffe53a2130 (diff) |
ci-github: Handle branch deletions in handle_push_event()
Diffstat (limited to 'mod/mod-ci-github.cxx')
-rw-r--r-- | mod/mod-ci-github.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 28af0fa..ac98785 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -529,8 +529,6 @@ namespace brep // Note that the push request event has no action. // - // @@ TMP I said no before but there is a `deleted` member... - // return handle_push_request (move (ps), warning_success); } else @@ -1499,16 +1497,16 @@ namespace brep l3 ([&]{trace << "push event { " << ps << " }";}); - // The common log entry subject. - // - string sub ((ps.forced ? "forced push " : "push ") + ps.after + " to " + - ps.ref); - - // Cancel the CI tenant associated with the overwritten previous head - // commit if this is a forced push. + // Cancel the CI tenant associated with the overwritten/deleted previous + // head commit if this is a forced push or a branch deletion. // - if (ps.forced) + if (ps.forced || ps.deleted) { + // The common log entry subject. + // + string sub (ps.forced ? "forced push " + ps.after + " to " + ps.ref + : "deletion of " + ps.ref); + // Service id that will uniquely identify the CI tenant. // string sid (ps.repository.node_id + ':' + ps.before); @@ -1536,6 +1534,9 @@ namespace brep } } + if (ps.deleted) + return true; // Do nothing further if this was a branch deletion. + // While we don't need the installation access token in this request, // let's obtain it to flush out any permission issues early. Also, it is // valid for an hour so we will most likely make use of it. @@ -1600,7 +1601,8 @@ namespace brep chrono::seconds (0) /* delay */, duplicate_tenant_mode::ignore)) { - fail << sub << ": unable to create unloaded CI tenant"; + fail << "push " + ps.after + " to " + ps.ref + << ": unable to create unloaded CI tenant"; } return true; |