aboutsummaryrefslogtreecommitdiff
path: root/bbot/agent
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-30 21:34:43 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-10-04 13:39:30 +0300
commit7be84c43231c2dc59e44e4c783729d6cb4f5431b (patch)
treece0a451bd3656275a0ee792cf21f214a60bc6a6e /bbot/agent
parent0a7f4f3f59c1dbbe236dff8e36d6b753d9583932 (diff)
Add support for soft and hard rebuilds
Diffstat (limited to 'bbot/agent')
-rw-r--r--bbot/agent/agent.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx
index cfff5e4..cfd1e7d 100644
--- a/bbot/agent/agent.cxx
+++ b/bbot/agent/agent.cxx
@@ -803,7 +803,9 @@ try
tm.name,
tm.version,
result_status::abort,
- operation_results {}};
+ operation_results {},
+ nullopt /* worker_checksum */,
+ nullopt /* dependency_checksum */};
if (ops.fake_build ())
return r;
@@ -1087,6 +1089,8 @@ handle_signal (int sig)
}
}
+static const string agent_checksum ("1"); // Logic version.
+
int
main (int argc, char* argv[])
try
@@ -1296,6 +1300,8 @@ try
// 4. If a build task is returned, do it, upload the result, and go to #1
// (immediately).
//
+ // NOTE: consider updating agent_checksum if making any logic changes.
+ //
auto rand_sleep = [g = std::mt19937 (std::random_device {} ())] () mutable
{
return std::uniform_int_distribution<unsigned int> (50, 60) (g);
@@ -1365,6 +1371,7 @@ try
"fake-session", // Dummy session.
nullopt, // No challenge.
url, // Empty result URL.
+ agent_checksum,
move (t)};
url = "http://example.org";
@@ -1515,6 +1522,15 @@ try
if (!ops.trust ().empty ())
t.trust = ops.trust ();
+ // Reset the worker checksum if the task's agent checksum doesn't match
+ // the current one.
+ //
+ // Note that since the checksums are hierarchical, such reset will trigger
+ // resets of the "subordinate" checksums (dependency checksum, etc).
+ //
+ if (!tr.agent_checksum || *tr.agent_checksum != agent_checksum)
+ t.worker_checksum = nullopt;
+
const dir_path& d (); // The -<toolchain> directory.
const bootstrapped_machine_manifest& m ();
@@ -1562,7 +1578,10 @@ try
// Upload the result.
//
- result_request_manifest rq {tr.session, move (challenge), move (r)};
+ result_request_manifest rq {tr.session,
+ move (challenge),
+ agent_checksum,
+ move (r)};
{
const string& u (*tr.result_url);