aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-03-18 12:30:00 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-15 09:05:27 +0200
commitb49feeaee7953b7f675cbdef29e7466eab19781a (patch)
tree39e9fb34060eda764f492fe4903a30ac6010e989
parent850aa60247642fe668bce8c3a78fd73b7aad5adf (diff)
Review
-rw-r--r--mod/mod-ci-github.cxx27
-rw-r--r--mod/mod-ci-github.hxx3
2 files changed, 26 insertions, 4 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 5ef1a82..d920031 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -305,16 +305,28 @@ namespace brep
}
}
- // Tenant service data.
+ // Service data associated with the tenant/check suite.
+ //
+ // It is always a top-level JSON object and the first member is always the
+ // schema version.
//
struct service_data
{
- string installation_access_token;
- string repository_id;
+ // The data schema version. Note: must be first member in the object.
+ //
+ uint64_t version = 1;
+
+ // Check suite-global data.
+ //
+ installation_access_token installation_access;
+
+ string repository_id; // GitHub-internal opaque repository id.
string head_sha;
// Construct from JSON.
//
+ // @@ Load version and check that == 1.
+ //
explicit
service_data (const string& json);
@@ -329,6 +341,9 @@ namespace brep
{
HANDLER_DIAG;
+ // @@ Let's turn this into l3 traces (grep for l2 to see examples).
+ //
+
cout << "<check_suite event>" << endl << cs << endl;
installation_access_token iat (
@@ -346,6 +361,9 @@ namespace brep
cs.repository.node_id,
cs.check_suite.head_sha));
+ // @@ TODO: use GitHub check suite id. I think node_id?
+ //
+
optional<start_result> r (
start (error,
warn,
@@ -850,6 +868,9 @@ namespace brep
resp () = default;
} rs;
+ // @@ TODO: need to check if installation access token expired. If so,
+ // get new one and update it in the service_data.
+
try
{
uint16_t sc (github_post (
diff --git a/mod/mod-ci-github.hxx b/mod/mod-ci-github.hxx
index 605368f..433ae3d 100644
--- a/mod/mod-ci-github.hxx
+++ b/mod/mod-ci-github.hxx
@@ -49,7 +49,8 @@ namespace brep
//
struct check_suite
{
- uint64_t id; // @@ Switch to node_id?
+ uint64_t id; // Note: used for installation access token (REST API).
+ string node_id;
string head_branch;
string head_sha;
string before;