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

Bare minimum ssh-ng:// extensions for Hydra #12479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/libstore/remote-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,22 @@ BuildResult RemoteStore::buildDerivation(const StorePath & drvPath, const BasicD
auto conn(getConnection());
conn->putBuildDerivationRequest(*this, &conn.daemonException, drvPath, drv, buildMode);
conn.processStderr();
return WorkerProto::Serialise<BuildResult>::read(*this, *conn);
return conn->getBuildDerivationResponse(*this, &conn.daemonException);
}


std::function<BuildResult()> RemoteStore::buildDerivationAsync(
const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode)
{
// Until we have C++23 std::move_only_function
auto conn = std::make_shared<ConnectionHandle>(getConnection());
(*conn)->putBuildDerivationRequest(*this, &conn->daemonException, drvPath, drv, buildMode);
conn->processStderr();

return [this,conn]() -> BuildResult {
return (*conn)->getBuildDerivationResponse(*this, &conn->daemonException);
};
}


Expand Down
10 changes: 10 additions & 0 deletions src/libstore/remote-store.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ public:
BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode) override;

/**
* Note, the returned function must only be called once, or we'll
* try to read from the connection twice.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* try to read from the connection twice.
* try to read from the connection twice.
* This function is used by Hydra.

*
* @todo Use C++23 `std::move_only_function`.
*/
std::function<BuildResult()> buildDerivationAsync(
const StorePath & drvPath, const BasicDerivation & drv,
BuildMode buildMode);

void ensurePath(const StorePath & path) override;

void addTempRoot(const StorePath & path) override;
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/ssh-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ ref<RemoteStore::Connection> SSHStore::openConnection()
}
command.insert(command.end(),
extraRemoteProgramArgs.begin(), extraRemoteProgramArgs.end());
conn->sshConn = master.startCommand(std::move(command));
conn->sshConn = master.startCommand(std::move(command), std::list{extraSshArgs});
conn->to = FdSink(conn->sshConn->in.get());
conn->from = FdSource(conn->sshConn->out.get());
return conn;
Expand Down
5 changes: 5 additions & 0 deletions src/libstore/ssh-store.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ struct SSHStoreConfig : virtual RemoteStoreConfig, virtual CommonSSHStoreConfig
const Setting<Strings> remoteProgram{
this, {"nix-daemon"}, "remote-program", "Path to the `nix-daemon` executable on the remote machine."};

/**
* Hack for hydra
*/
Strings extraSshArgs = {};

const std::string name() override
{
return "Experimental SSH Store";
Expand Down
Loading