fastlane/ci

Websocket Logs are backfilled

nakhbari opened this issue · 5 comments

The websocket should send all the logs up until that point on a new connection. This includes the scenario where the build is complete, we should send all the logs.

Ha, yeah I forgot to implement this in the new JSON controller. The way we implemented it in the non-JSON controller is not by using a socket connection, but just the regular API

More info here

if current_build_runner
existing_rows = current_build_runner.all_build_output_log_rows.map(&:html).join("\n")
else
# `current_build_runner` is only defined if the build was just run a while back
# if the server was restarted, we're gonna end here in this code block
build_log_artifact = build.artifacts.find do |current_artifact|
# We can improve the detection in the future, to actually mark an artifact as "default output"
current_artifact.type.include?("log") && current_artifact.reference.end_with?("fastlane.log")
end
if build_log_artifact
artifact_file_content = File.read(build_log_artifact.provider.retrieve!(artifact: build_log_artifact))
existing_rows = convert_ansi_to_html(artifact_file_content.gsub("\n", "<br />"))
else
raise "Couldn't load previous output for build #{build_number}"
end

When it comes to fetching the previous output, this is blocked by the distributed worker work, as we'll need to know how it's being stored

Yeah i think i'm gonna copy the current implementation for now.

I think for the worker it would make sense to always use the websocket and just backfill the logs that have been missed on a new connection. With the last line being an EOT we will close the websocket.

@snatchev do you think this fits as a part of the distributed builds?

This feature is live in #1093