Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-remote: Fix missing log output #1699

Merged
merged 1 commit into from Nov 27, 2017

Conversation

aszlig
Copy link
Member

@aszlig aszlig commented Nov 25, 2017

The storeUri variable in the build-remote hook is declared very much to the start of the main function and a bunch of lines later, the same variable gets checked via hasPrefix() but it gets assigned after that check when the most suitable machine for the build was choosen.

So I guess this was just a typo in d16fd24 and what we really want is to either check the prefix after assigning storeUri or use bestMachine->storeUri directly.

I choose the latter, because the former could introduce even more regressions if the try block where the variable gets assigned terminates early.

Nevertheless, the reason why the log output didn't work is because hasPrefix() checked for ssh:// in front of storeUri, but if the storeUri isn't set correctly (or at all), we don't get the log file descriptor set up properly, leading to no log output.

I've adjusted the remote-builds test to include a regression test for this, so that we can make sure we get a build output when using remote builds.

In addition to that I've tested this with two of my build farms and the build logs are emitted correctly again.

The storeUri variable in the build-remote hook is declared very much to
the start of the main function and a bunch of lines later, the same
variable gets checked via hasPrefix() but it gets assigned *after* that
check when the most suitable machine for the build was choosen.

So I guess this was just a typo in d16fd24
and what we really want is to either checkd the prefix *after* assigning
storeUri or use bestMachine->storeUri directly.

I choose the latter, because the former could introduce even more
regressions if the try block where the variable gets assigned terminates
early.

Nevertheless, the reason why the log output didn't work is because
hasPrefix() checked for "ssh://" in front of storeUri, but if the
storeUri isn't set correctly (or at all), we don't get the log file
descriptor set up properly, leading to no log output.

I've adjusted the remote-builds test to include a regression test for
this, so that we can make sure we get a build output when using remote
builds.

In addition to that I've tested this with two of my build farms and the
build logs are emitted correctly again.

Signed-off-by: aszlig <aszlig@nix.build>
@shlevy
Copy link
Member

shlevy commented Nov 25, 2017

@adelbertc I think this might be why we were having trouble debugging remote builds

@edolstra edolstra merged commit 3c470c9 into NixOS:master Nov 27, 2017
@edolstra
Copy link
Member

Thanks @aszlig!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants