libutil: allow builders to create all activity types
this restriction was added in 4af2611bd1
and extended later. it makes little sense to allow *one* activity type
specifically and drop all others on the floor, especially since broken
builders can create transfer activities with ids that would be used by
other, "real" activities. the only thing achieved here is to drop logs
written in json format in the build sandbox, which does not help much.
we may revisit this restriction later during other log-related rework.
Change-Id: I8bda494083877b71a2f958470fa52380f6ec4968
This commit is contained in:
@@ -1239,7 +1239,7 @@ try {
|
||||
});
|
||||
|
||||
if (const auto state = handleJSONLogMessage(
|
||||
currentLogLine, *act, builderActivities, "the derivation builder", false
|
||||
currentLogLine, *act, builderActivities, "the derivation builder"
|
||||
))
|
||||
{
|
||||
return *state;
|
||||
@@ -1323,7 +1323,9 @@ try {
|
||||
if (c == '\n') {
|
||||
auto json = parseJSONMessage(currentHookLine, "the derivation builder");
|
||||
if (json) {
|
||||
auto s = handleJSONLogMessage(*json, worker.act, hook->activities, "the derivation builder", true);
|
||||
auto s = handleJSONLogMessage(
|
||||
*json, worker.act, hook->activities, "the derivation builder"
|
||||
);
|
||||
// ensure that logs from a builder using `ssh-ng://` as protocol
|
||||
// are also available to `nix log`.
|
||||
if (s && logSink) {
|
||||
|
||||
+9
-12
@@ -310,8 +310,7 @@ std::optional<Logger::BufferState> handleJSONLogMessage(
|
||||
JSON & json,
|
||||
const Activity & act,
|
||||
std::map<ActivityId, Activity> & activities,
|
||||
std::string_view source,
|
||||
bool trusted
|
||||
std::string_view source
|
||||
)
|
||||
{
|
||||
try {
|
||||
@@ -319,13 +318,12 @@ std::optional<Logger::BufferState> handleJSONLogMessage(
|
||||
|
||||
if (action == "start") {
|
||||
auto type = (ActivityType) json["type"];
|
||||
if (trusted || type == actFileTransfer)
|
||||
activities.emplace(
|
||||
json["id"],
|
||||
act.addChild(
|
||||
(Verbosity) json["level"], type, json["text"], getFields(json["fields"])
|
||||
)
|
||||
);
|
||||
activities.emplace(
|
||||
json["id"],
|
||||
act.addChild(
|
||||
(Verbosity) json["level"], type, json["text"], getFields(json["fields"])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
else if (action == "stop")
|
||||
@@ -360,8 +358,7 @@ std::optional<Logger::BufferState> handleJSONLogMessage(
|
||||
const std::string & msg,
|
||||
const Activity & act,
|
||||
std::map<ActivityId, Activity> & activities,
|
||||
std::string_view source,
|
||||
bool trusted
|
||||
std::string_view source
|
||||
)
|
||||
{
|
||||
auto json = parseJSONMessage(msg, source);
|
||||
@@ -369,7 +366,7 @@ std::optional<Logger::BufferState> handleJSONLogMessage(
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return handleJSONLogMessage(*json, act, activities, source, trusted);
|
||||
return handleJSONLogMessage(*json, act, activities, source);
|
||||
}
|
||||
|
||||
Activity::~Activity()
|
||||
|
||||
@@ -422,8 +422,7 @@ std::optional<Logger::BufferState> handleJSONLogMessage(
|
||||
JSON & json,
|
||||
const Activity & act,
|
||||
std::map<ActivityId, Activity> & activities,
|
||||
std::string_view source,
|
||||
bool trusted
|
||||
std::string_view source
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -434,7 +433,6 @@ std::optional<Logger::BufferState> handleJSONLogMessage(
|
||||
const std::string & msg,
|
||||
const Activity & act,
|
||||
std::map<ActivityId, Activity> & activities,
|
||||
std::string_view source,
|
||||
bool trusted
|
||||
std::string_view source
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user