Loading Builder/src/main.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -154,6 +154,9 @@ void write_file(websocket::stream<tcp::socket&> &client_stream, std::ifstream container; container.exceptions(std::ofstream::failbit | std::ofstream::badbit); container.open(file_name, std::fstream::in | std::fstream::binary); if(container.fail()) { throw std::runtime_error("Failed to open file for reading: " + file_name); } const auto file_size = boost::filesystem::file_size(file_name); // Write the file in chunks to the client Loading Loading @@ -186,7 +189,10 @@ void read_context(websocket::stream<tcp::socket&> &client_stream) { read_file(client_stream, "cb-context.tar.gz"); // Untar the context bp::system("tar xf cb-context.tar.gz"); int tar_rc = bp::system("tar xf cb-context.tar.gz"); if(tar_rc != 0) { throw std::runtime_error("Error untarring build context"); } // Change current directory to context bfs::current_path("./cb-context"); Loading Client/src/main.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ void write_file(websocket::stream<tcp::socket> &stream, std::ifstream container; container.exceptions(std::ofstream::failbit | std::ofstream::badbit); container.open(file_name, std::fstream::in | std::fstream::binary); if(container.fail()) { throw std::runtime_error("Failed to open file for reading: " + file_name); } const auto file_size = bfs::file_size(file_name); // Write the file in chunks to the client Loading Loading @@ -296,7 +299,10 @@ void write_context(websocket::stream<tcp::socket> &builder_stream, const ClientD // If requested copy current context directory to context tmp if(client_data.transfer_context) { bp::system("cp -r ./* " + context_temp_path); int cp_rc = bp::system("cp -r ./* " + context_temp_path); if(cp_rc != 0) { throw std::runtime_error("Error copying build context"); } Logger::debug("Copied full context"); } Loading @@ -306,7 +312,10 @@ void write_context(websocket::stream<tcp::socket> &builder_stream, const ClientD // Tar context tmp directory to cb-context.tar.gz auto original_pwd = bfs::current_path(); bfs::current_path(temp_path); bp::system("tar zcvf cb-context.tar.gz cb_context"); int tar_rc = bp::system("tar zcvf cb-context.tar.gz cb-context"); if(tar_rc != 0) { throw std::runtime_error("Error creating build context tarball"); } bfs::current_path(original_pwd); Logger::debug("Created tarball of context directory"); Loading Loading
Builder/src/main.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -154,6 +154,9 @@ void write_file(websocket::stream<tcp::socket&> &client_stream, std::ifstream container; container.exceptions(std::ofstream::failbit | std::ofstream::badbit); container.open(file_name, std::fstream::in | std::fstream::binary); if(container.fail()) { throw std::runtime_error("Failed to open file for reading: " + file_name); } const auto file_size = boost::filesystem::file_size(file_name); // Write the file in chunks to the client Loading Loading @@ -186,7 +189,10 @@ void read_context(websocket::stream<tcp::socket&> &client_stream) { read_file(client_stream, "cb-context.tar.gz"); // Untar the context bp::system("tar xf cb-context.tar.gz"); int tar_rc = bp::system("tar xf cb-context.tar.gz"); if(tar_rc != 0) { throw std::runtime_error("Error untarring build context"); } // Change current directory to context bfs::current_path("./cb-context"); Loading
Client/src/main.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ void write_file(websocket::stream<tcp::socket> &stream, std::ifstream container; container.exceptions(std::ofstream::failbit | std::ofstream::badbit); container.open(file_name, std::fstream::in | std::fstream::binary); if(container.fail()) { throw std::runtime_error("Failed to open file for reading: " + file_name); } const auto file_size = bfs::file_size(file_name); // Write the file in chunks to the client Loading Loading @@ -296,7 +299,10 @@ void write_context(websocket::stream<tcp::socket> &builder_stream, const ClientD // If requested copy current context directory to context tmp if(client_data.transfer_context) { bp::system("cp -r ./* " + context_temp_path); int cp_rc = bp::system("cp -r ./* " + context_temp_path); if(cp_rc != 0) { throw std::runtime_error("Error copying build context"); } Logger::debug("Copied full context"); } Loading @@ -306,7 +312,10 @@ void write_context(websocket::stream<tcp::socket> &builder_stream, const ClientD // Tar context tmp directory to cb-context.tar.gz auto original_pwd = bfs::current_path(); bfs::current_path(temp_path); bp::system("tar zcvf cb-context.tar.gz cb_context"); int tar_rc = bp::system("tar zcvf cb-context.tar.gz cb-context"); if(tar_rc != 0) { throw std::runtime_error("Error creating build context tarball"); } bfs::current_path(original_pwd); Logger::debug("Created tarball of context directory"); Loading