Loading Client/src/main.cpp +33 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ namespace asio = boost::asio; using asio::ip::tcp; namespace beast = boost::beast; namespace websocket = beast::websocket; using bfs = boost::filesytsem; void write_client_data(websocket::stream<tcp::socket> &builder_stream, ClientData client_data) { Logger::debug("Writing client data"); Loading Loading @@ -114,6 +115,7 @@ void parse_arguments(ClientData &client_data, int argc, char **argv) { ("help", "produce help message") ("debug", po::bool_switch(), "enable debug information") ("force", po::bool_switch(), "force the build, overwriting any existing image file") ("transfer_context", po::bool_switch(), "trasnfer the contents of the current directory to the build host") ("arch", po::value<std::string>()->default_value("x86_64"), "select architecture, valid options are x86_64 and ppc64le(Currently this does nothing)") ("backend", po::value<std::string>()->default_value("unspecified"), Loading Loading @@ -152,6 +154,7 @@ void parse_arguments(ClientData &client_data, int argc, char **argv) { client_data.arch = Arch::to_arch(vm["arch"].as<std::string>()); client_data.backend = Backend::to_backend(vm["backend"].as<std::string>()); client_data.log_priority = Logger::get_priority(); client_data.transfer_context = vm["transfer_context"].as<bool>(); // Make sure variables are set as required po::notify(vm); Loading Loading @@ -281,6 +284,32 @@ void show_cursor() { std::cout << "\e[?25h"; } // Write build context to builder void write_context(websocket::stream<tcp::socket> &builder_stream, const ClientData &client_data) { // Create unique directory bfs::path context_path = unique_path(bfs::temp_directory_path() + "/%%%%-%%%%-%%%%"); bfs::create_directories(context_path); // If requested transfer entire context if(client_data.transfer_context) { // Copy definition to container.def bfs:: // Tar current directory(context) } else { // Transfer just the definition file // tar just the definition file } // Transfer context write_file(builder_stream, context_path); // Remove context path boost::filesytsem::remove_all(context_path); } int main(int argc, char *argv[]) { // Remove buffering from cout std::cout.setf(std::ios::unitbuf); Loading Loading @@ -329,8 +358,10 @@ int main(int argc, char *argv[]) { // Write client data to builder write_client_data(builder_stream, client_data); // Write definition to builder write_file(builder_stream, client_data.definition_path); // Write build context/recipe WaitingAnimation wait_transfer("Transfering context payload to builder"); write_context(builder_stream, client_data); wait_transfer.stop_success("Transfered context"); // stream builder output stream_build(builder_stream); Loading Common/include/ClientData.h +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public: LogPriority log_priority; ArchType arch; BackendType backend; bool transfer_context; std::string container_path; std::string definition_path; std::string queue_host; Loading @@ -64,6 +65,7 @@ namespace boost { ar & client_data.log_priority; ar & client_data.arch; ar & client_data.backend; ar & client_data.context_path; ar & client_data.container_path; // Client side container image path ar & client_data.definition_path; // Client side definition path ar & client_data.queue_host; Loading Loading
Client/src/main.cpp +33 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ namespace asio = boost::asio; using asio::ip::tcp; namespace beast = boost::beast; namespace websocket = beast::websocket; using bfs = boost::filesytsem; void write_client_data(websocket::stream<tcp::socket> &builder_stream, ClientData client_data) { Logger::debug("Writing client data"); Loading Loading @@ -114,6 +115,7 @@ void parse_arguments(ClientData &client_data, int argc, char **argv) { ("help", "produce help message") ("debug", po::bool_switch(), "enable debug information") ("force", po::bool_switch(), "force the build, overwriting any existing image file") ("transfer_context", po::bool_switch(), "trasnfer the contents of the current directory to the build host") ("arch", po::value<std::string>()->default_value("x86_64"), "select architecture, valid options are x86_64 and ppc64le(Currently this does nothing)") ("backend", po::value<std::string>()->default_value("unspecified"), Loading Loading @@ -152,6 +154,7 @@ void parse_arguments(ClientData &client_data, int argc, char **argv) { client_data.arch = Arch::to_arch(vm["arch"].as<std::string>()); client_data.backend = Backend::to_backend(vm["backend"].as<std::string>()); client_data.log_priority = Logger::get_priority(); client_data.transfer_context = vm["transfer_context"].as<bool>(); // Make sure variables are set as required po::notify(vm); Loading Loading @@ -281,6 +284,32 @@ void show_cursor() { std::cout << "\e[?25h"; } // Write build context to builder void write_context(websocket::stream<tcp::socket> &builder_stream, const ClientData &client_data) { // Create unique directory bfs::path context_path = unique_path(bfs::temp_directory_path() + "/%%%%-%%%%-%%%%"); bfs::create_directories(context_path); // If requested transfer entire context if(client_data.transfer_context) { // Copy definition to container.def bfs:: // Tar current directory(context) } else { // Transfer just the definition file // tar just the definition file } // Transfer context write_file(builder_stream, context_path); // Remove context path boost::filesytsem::remove_all(context_path); } int main(int argc, char *argv[]) { // Remove buffering from cout std::cout.setf(std::ios::unitbuf); Loading Loading @@ -329,8 +358,10 @@ int main(int argc, char *argv[]) { // Write client data to builder write_client_data(builder_stream, client_data); // Write definition to builder write_file(builder_stream, client_data.definition_path); // Write build context/recipe WaitingAnimation wait_transfer("Transfering context payload to builder"); write_context(builder_stream, client_data); wait_transfer.stop_success("Transfered context"); // stream builder output stream_build(builder_stream); Loading
Common/include/ClientData.h +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public: LogPriority log_priority; ArchType arch; BackendType backend; bool transfer_context; std::string container_path; std::string definition_path; std::string queue_host; Loading @@ -64,6 +65,7 @@ namespace boost { ar & client_data.log_priority; ar & client_data.arch; ar & client_data.backend; ar & client_data.context_path; ar & client_data.container_path; // Client side container image path ar & client_data.definition_path; // Client side definition path ar & client_data.queue_host; Loading