aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-10-24 09:25:59 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-24 13:11:30 +0200
commit6199917a8537a3c1f06ac6345d06a283c101fc6a (patch)
treec3777663dcd47e2542f4d345f038b2f5fca4569a
parentbc94f77ea57edfd3e5ba0d2505f451ce56bfd422 (diff)
Pass service_data kind+phase to constructors
-rw-r--r--mod/mod-ci-github-service-data.cxx13
-rw-r--r--mod/mod-ci-github-service-data.hxx15
-rw-r--r--mod/mod-ci-github.cxx13
3 files changed, 26 insertions, 15 deletions
diff --git a/mod/mod-ci-github-service-data.cxx b/mod/mod-ci-github-service-data.cxx
index e2e0440..ebb692b 100644
--- a/mod/mod-ci-github-service-data.cxx
+++ b/mod/mod-ci-github-service-data.cxx
@@ -105,9 +105,11 @@ namespace brep
timestamp iat_ea,
uint64_t iid,
string rid,
- string hs,
- bool rr)
- : kind (local), pre_check (false), re_request (rr),
+ enum kind k,
+ bool rr,
+ bool pc,
+ string hs)
+ : kind (k), pre_check (pc), re_request (rr),
warning_success (ws),
installation_access (move (iat_tok), iat_ea),
installation_id (iid),
@@ -125,10 +127,13 @@ namespace brep
timestamp iat_ea,
uint64_t iid,
string rid,
+ enum kind k,
+ bool rr,
+ bool pc,
string rs,
string rcu,
uint32_t prn)
- : kind (local), pre_check (true), re_request (false),
+ : kind (k), pre_check (pc), re_request (rr),
warning_success (ws),
installation_access (move (iat_tok), iat_ea),
installation_id (iid),
diff --git a/mod/mod-ci-github-service-data.hxx b/mod/mod-ci-github-service-data.hxx
index a6cb742..e816c21 100644
--- a/mod/mod-ci-github-service-data.hxx
+++ b/mod/mod-ci-github-service-data.hxx
@@ -11,8 +11,6 @@
namespace brep
{
- // @@@ Check is any data members are unused.
-
// Service data associated with the tenant (corresponds to GH check suite).
//
// It is always a top-level JSON object and the first member is always the
@@ -76,7 +74,7 @@ namespace brep
//
// @@ TODO Serialize these fields.
//
- enum {local, remote /*, queue */} kind;
+ enum kind {local, remote /*, queue */} kind;
bool pre_check;
bool re_request; // Re-requested (rebuild).
@@ -102,6 +100,8 @@ namespace brep
// The GitHub ID of the synthetic PR merge check run or absent if it
// hasn't been created yet.
//
+ // @@ TODO Remove once merge check run code has been removed.
+ //
optional<string> merge_node_id;
// The commit ID the branch push or pull request (and its check runs) are
@@ -147,8 +147,10 @@ namespace brep
timestamp iat_expires_at,
uint64_t installation_id,
string repository_node_id,
- string head_sha,
- bool re_request);
+ enum kind kind,
+ bool pre_check,
+ bool re_request,
+ string head_sha);
// The pull_request constructor.
//
@@ -157,6 +159,9 @@ namespace brep
timestamp iat_expires_at,
uint64_t installation_id,
string repository_node_id,
+ enum kind kind,
+ bool pre_check,
+ bool re_request,
string report_sha,
string repository_clone_url,
uint32_t pr_number);
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 6289d8b..058bd48 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -473,15 +473,15 @@ namespace brep
//
string sid (cs.repository.node_id + ":" + cs.check_suite.head_sha);
- // @@ Let's pass the "state" arguments explicitly in both constructors.
- //
service_data sd (warning_success,
iat->token,
iat->expires_at,
cs.installation.id,
move (cs.repository.node_id),
- move (cs.check_suite.head_sha),
- cs.action == "rerequested" /* re_request */);
+ service_data::local,
+ false /* pre_check */,
+ cs.action == "rerequested" /* re_request */,
+ move (cs.check_suite.head_sha));
// If this check suite is being re-run, replace the existing CI request if
// it exists; otherwise create a new one, doing nothing if a request
@@ -712,12 +712,13 @@ namespace brep
iat->expires_at,
pr.installation.id,
move (pr.repository.node_id),
+ service_data::local, // @@ TODO
+ true /* pre_check */,
+ false /* re_request */,
move (pr.pull_request.head_sha) /* report_sha */,
move (pr.repository.clone_url),
pr.pull_request.number);
- assert (sd.pre_check); // @@ Get rid (once ctor changed).
-
// Create an unloaded CI request for the pre-check phase (during which we
// wait for the PR's merge commit and behindness to become available).
//