Skip to content
Merged
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
4 changes: 2 additions & 2 deletions brane-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
},
};
Expand Down
11 changes: 1 addition & 10 deletions brane-cli/src/build_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.**
///
Expand All @@ -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
Expand Down
20 changes: 15 additions & 5 deletions brane-cli/src/build_ecu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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;

Expand Down Expand Up @@ -159,13 +159,14 @@
/// * `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<String, BuildError> {
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.

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
let base = document.base.clone().unwrap_or_else(|| String::from("ubuntu:24.04"));

// Add default heading
writeln_build!(contents, "# Generated by Brane")?;
Expand Down Expand Up @@ -207,7 +208,16 @@
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")?;
Expand Down Expand Up @@ -268,7 +278,7 @@
/// * `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,
Expand Down
4 changes: 2 additions & 2 deletions brane-cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub fn ensure_packages_dir(create: bool) -> Result<PathBuf, UtilError> {
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 });
}
Expand Down Expand Up @@ -346,7 +346,7 @@ pub fn ensure_datasets_dir(create: bool) -> Result<PathBuf, UtilError> {
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 });
}
Expand Down
2 changes: 1 addition & 1 deletion brane-cli/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions brane-job/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@
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()));

Check warning

Code scanning / devskim

An HTTP-based URL without TLS was detected. Warning

Insecure URL
debug!("Performing request to '{}'...", address);
let res = proxy
.get(&address, None)
Expand Down Expand Up @@ -989,7 +989,7 @@
image,
ImageSource::Path(container_path.into()),
vec![
"-d".into(),
"--debug".into(),
"--application-id".into(),
"unspecified".into(),
"--location-id".into(),
Expand Down
Loading