aboutsummaryrefslogtreecommitdiff
path: root/bbot/agent/agent.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/agent/agent.cxx')
-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);