Skip to content

Commit 57edd26

Browse files
Merge pull request BraneFramework#305 from BraneFramework/download
fix(ctl): Add nightly support for downloading services
2 parents 4269067 + 2f0aa24 commit 57edd26

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

brane-ctl/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ human-panic = "2.0.0"
2424
humantime = "2.1.0"
2525
jsonwebtoken = "9.1.0"
2626
shlex = "1.3.0"
27+
semver = "1.0.0"
2728
tempfile = "3.10.1"
2829

2930
# Workspace dependencies

brane-ctl/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ pub(crate) enum DownloadSubcommand {
192192
)]
193193
arch: Arch,
194194
/// The version of the services to download.
195-
#[clap(short, long, default_value=env!("CARGO_PKG_VERSION"), global=true, help="The version of the images to download from GitHub. You can specify 'latest' to download the latest version (but that might be incompatible with this CTL version)")]
196-
version: Version,
195+
#[clap(short, long, default_value=env!("CARGO_PKG_VERSION"), global=true, help="The version of the images to download from GitHub.")]
196+
version: semver::Version,
197197
/// Whether to overwrite existing images or not.
198198
#[clap(
199199
short = 'F',

brane-ctl/src/download.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use enum_debug::EnumDebug as _;
2525
use log::{debug, info, warn};
2626
use specifications::arch::Arch;
2727
use specifications::container::Image;
28-
use specifications::version::Version;
2928
use tempfile::TempDir;
3029

3130
pub use crate::errors::DownloadError as Error;
@@ -169,7 +168,7 @@ pub async fn services(
169168
fix_dirs: bool,
170169
path: impl AsRef<Path>,
171170
arch: Arch,
172-
version: Version,
171+
version: semver::Version,
173172
force: bool,
174173
kind: DownloadServicesSubcommand,
175174
) -> Result<(), Error> {
@@ -232,21 +231,21 @@ pub async fn services(
232231
match &kind {
233232
DownloadServicesSubcommand::Central => {
234233
// Resolve the address to use
235-
let address: String = if version.is_latest() {
236-
format!("https://github.com/braneframework/brane/releases/latest/download/instance-{}.tar.gz", arch.brane())
234+
let address: String = if version.pre.as_str() == "nightly" {
235+
format!("https://github.com/braneframework/brane/releases/download/nightly/central-instance-{}.tar.gz", arch.brane())
237236
} else {
238-
format!("https://github.com/braneframework/brane/releases/download/v{}/instance-{}.tar.gz", version, arch.brane())
237+
format!("https://github.com/braneframework/brane/releases/download/v{}/central-instance-{}.tar.gz", version, arch.brane())
239238
};
240239
debug!("Will download from: {}", address);
241240

242241
// Hand it over the shared code
243-
download_brane_services(address, path, format!("instance-{}", arch.brane()), force).await?;
242+
download_brane_services(address, path, format!("central-instance-{}", arch.brane()), force).await?;
244243
},
245244

246245
DownloadServicesSubcommand::Worker => {
247246
// Resolve the address to use
248-
let address: String = if version.is_latest() {
249-
format!("https://github.com/braneframework/brane/releases/latest/download/worker-instance-{}.tar.gz", arch.brane())
247+
let address: String = if version.pre.as_str() == "nightly" {
248+
format!("https://github.com/braneframework/brane/releases/download/nightly/worker-instance-{}.tar.gz", arch.brane())
250249
} else {
251250
format!("https://github.com/braneframework/brane/releases/download/v{}/worker-instance-{}.tar.gz", version, arch.brane())
252251
};

xtask/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ clap_mangen = "0.2.26"
1616
directories = "6.0.0"
1717
flate2 = { version = "1.0.13" }
1818
paste = "1.0.0"
19+
semver = { version = "1.0.0" }
1920
tar = "0.4.21"
2021
toml = "0.8.8"
2122

@@ -33,7 +34,6 @@ specifications = { workspace = true }
3334
# Optional
3435
humantime = { version = "2.1.0", optional = true }
3536
jsonwebtoken = { version = "9.1.0", optional = true }
36-
semver = { version = "1.0.0", optional = true }
3737

3838
brane-cc = { workspace = true, optional = true }
3939
brane-cfg = { workspace = true, optional = true }
@@ -56,7 +56,7 @@ cli = [
5656
"dep:humantime",
5757
"dep:jsonwebtoken",
5858
]
59-
ci = ["dep:semver"]
59+
ci = []
6060

6161
[lints]
6262
workspace = true

0 commit comments

Comments
 (0)