diff --git a/brane-api/src/main.rs b/brane-api/src/main.rs index 3e55b867..1c11e370 100644 --- a/brane-api/src/main.rs +++ b/brane-api/src/main.rs @@ -27,7 +27,7 @@ use brane_cfg::node::{CentralConfig, NodeConfig}; use brane_prx::client::ProxyClient; use clap::Parser; use dotenvy::dotenv; -use error_trace::trace; +use error_trace::{ErrorTrace as _, trace}; use juniper::EmptySubscription; use log::{LevelFilter, debug, error, info, warn}; use scylla::{Session, SessionBuilder}; @@ -58,7 +58,7 @@ async fn main() { let node_config: NodeConfig = match NodeConfig::from_path(&opts.node_config_path) { Ok(config) => config, Err(err) => { - error!("Failed to load NodeConfig file: {}", err); + error!("Failed to load NodeConfig file: {}", err.trace()); std::process::exit(1); }, }; diff --git a/brane-cli/src/build_common.rs b/brane-cli/src/build_common.rs index 93510c2c..e9b57056 100644 --- a/brane-cli/src/build_common.rs +++ b/brane-cli/src/build_common.rs @@ -41,15 +41,6 @@ macro_rules! writeln_build { -/***** COMMON CONSTANTS */ -/// The URL which we use to pull the latest branelet executable from. -pub const BRANELET_URL: &str = - concat!("https://github.com/braneframework/brane/releases/download/", concat!("v", env!("CARGO_PKG_VERSION")), "/branelet"); - - - - - /***** COMMON FUNCTIONS *****/ /// **Edited: now returning BuildErrors. Also leaving .lock removal to the main handle function.** /// @@ -59,7 +50,7 @@ pub const BRANELET_URL: &str = /// * `package_dir`: The directory to clean (we assume this has been canonicalized and thus exists). /// * `files`: The files to remove from the build directory. /// -/// **Returns** +/// **Returns** /// Nothing - although this function will print BuildErrors as warnings to stderr using the logger. pub fn clean_directory(package_dir: &Path, files: Vec<&str>) { // Remove the build files diff --git a/brane-cli/src/build_ecu.rs b/brane-cli/src/build_ecu.rs index caa59f3b..503c3302 100644 --- a/brane-cli/src/build_ecu.rs +++ b/brane-cli/src/build_ecu.rs @@ -13,7 +13,7 @@ use specifications::arch::Arch; use specifications::container::{ContainerInfo, LocalContainerInfo}; use specifications::package::PackageInfo; -use crate::build_common::{BRANELET_URL, build_docker_image, clean_directory}; +use crate::build_common::{build_docker_image, clean_directory}; use crate::errors::BuildError; use crate::utils::ensure_package_dir; @@ -159,13 +159,14 @@ async fn build( /// * `context`: The directory to find the executable in. /// * `override_branelet`: Whether or not to override the branelet executable. If so, assumes the new one is copied to the temporary build folder by the time the DockerFile is run. /// -/// **Returns** +/// **Returns** /// A String that is the new DockerFile on success, or a BuildError otherwise. fn generate_dockerfile(document: &ContainerInfo, context: &Path, override_branelet: bool) -> Result { let mut contents = String::new(); // Get the base image from the document - let base = document.base.clone().unwrap_or_else(|| String::from("ubuntu:20.04")); + // FIXME: We should really make sure that brane-let is compiled on this image as well. + let base = document.base.clone().unwrap_or_else(|| String::from("ubuntu:24.04")); // Add default heading writeln_build!(contents, "# Generated by Brane")?; @@ -207,7 +208,16 @@ fn generate_dockerfile(document: &ContainerInfo, context: &Path, override_branel writeln_build!(contents, "ADD ./container/branelet /branelet")?; } else { // It's the prebuild one - writeln_build!(contents, "ADD {}-$BRANELET_ARCH /branelet", BRANELET_URL)?; + + // Versions that go by pre-release alias instead of a version number + let special_versions = ["nightly", "test"]; + + let release_name = + if special_versions.contains(&env!("CARGO_PKG_VERSION_PRE")) { env!("CARGO_PKG_VERSION_PRE") } else { env!("CARGO_PKG_VERSION") }; + + let url = format!("https://github.com/BraneFramework/brane/releases/download/{release_name}/branelet-linux"); + + writeln_build!(contents, "ADD {url}-$BRANELET_ARCH /branelet")?; } // Always make it executable writeln_build!(contents, "RUN chmod +x /branelet")?; @@ -268,7 +278,7 @@ fn generate_dockerfile(document: &ContainerInfo, context: &Path, override_branel /// * `package_dir`: The directory where we can build the package and store it once done. /// - `convert_crlf`: If true, will not ask to convert CRLF files but instead just do it. /// -/// **Returns** +/// **Returns** /// Nothing if the directory was created successfully, or a BuildError otherwise. fn prepare_directory( document: &ContainerInfo, diff --git a/brane-cli/src/utils.rs b/brane-cli/src/utils.rs index 6585951f..df9c3fd3 100644 --- a/brane-cli/src/utils.rs +++ b/brane-cli/src/utils.rs @@ -298,7 +298,7 @@ pub fn ensure_packages_dir(create: bool) -> Result { ensure_data_dir(create)?; // Now create the directory - fs::create_dir(&packages_dir).map_err(|source| UtilError::BranePackageDirCreateError { path: packages_dir.clone(), source })?; + fs::create_dir_all(&packages_dir).map_err(|source| UtilError::BranePackageDirCreateError { path: packages_dir.clone(), source })?; } else { return Err(UtilError::BranePackageDirNotFound { path: packages_dir }); } @@ -346,7 +346,7 @@ pub fn ensure_datasets_dir(create: bool) -> Result { if create { // Make sure the parent directory exists, then create this directory ensure_data_dir(create)?; - fs::create_dir(&data_dir).map_err(|source| UtilError::BraneDatasetsDirCreateError { path: data_dir.clone(), source })?; + fs::create_dir_all(&data_dir).map_err(|source| UtilError::BraneDatasetsDirCreateError { path: data_dir.clone(), source })?; } else { return Err(UtilError::BraneDatasetsDirNotFound { path: data_dir }); } diff --git a/brane-cli/src/vm.rs b/brane-cli/src/vm.rs index 37290a34..fb9aed3a 100644 --- a/brane-cli/src/vm.rs +++ b/brane-cli/src/vm.rs @@ -124,7 +124,7 @@ impl VmPlugin for OfflinePlugin { image_source: ImageSource::Path(package_dir.join(info.package_name).join(info.package_version.to_string()).join("image.tar")), command: vec![ - "-d".into(), + "--debug".into(), "--application-id".into(), "test".into(), "--location-id".into(), diff --git a/brane-job/src/worker.rs b/brane-job/src/worker.rs index df9ffbc1..13b21a20 100644 --- a/brane-job/src/worker.rs +++ b/brane-job/src/worker.rs @@ -770,7 +770,7 @@ async fn get_container( debug!("Downloading image '{}' from '{}'...", image, endpoint); // Send a GET-request to the correct location - let address: String = format!("{}/packages/{}/{}", endpoint, image.name, image.version.as_ref().unwrap_or(&"latest".into())); + let address: String = format!("http://{}/packages/{}/{}", endpoint, image.name, image.version.as_ref().unwrap_or(&"latest".into())); debug!("Performing request to '{}'...", address); let res = proxy .get(&address, None) @@ -989,7 +989,7 @@ async fn execute_task_local( image, ImageSource::Path(container_path.into()), vec![ - "-d".into(), + "--debug".into(), "--application-id".into(), "unspecified".into(), "--location-id".into(),