Skip to content

Commit

Permalink
fix(si): Ensure that running an update when no containers installed d…
Browse files Browse the repository at this point in the history
…oesn't trigger start

Before this cause, if a user ran `si update` during a fresh install,
the launcher would trigger a download of the containers AND it would
run the start workflow

If this a fresh install (i.e. no containers installed!) then we should
not trigger any updates other than the launcher itself
  • Loading branch information
stack72 committed Aug 23, 2023
1 parent e6fac8a commit efbab64
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/si-cli/src/cmd/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async fn invoke(app: &AppState, is_preview: bool) -> CliResult<()> {
.get_existing_container(container_identifier.clone())
.await?;
if existing.is_some() {
println!("Stopping container {}", container_identifier.clone());
app.container_engine()
.stop_container(existing.unwrap().id.unwrap().to_string())
.await?;
Expand Down
26 changes: 14 additions & 12 deletions lib/si-cli/src/cmd/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,23 @@ impl AppState {
let current_containers = self.container_engine().get_container_details().await?;

let mut containers = Vec::new();
let latest_containers: Vec<LatestContainer> = req.json().await?;
'outer: for latest in latest_containers {
for current in &current_containers {
if current.image != format!("{}/{}", latest.namespace, latest.repository) {
continue;
}
if !current_containers.is_empty() {
let latest_containers: Vec<LatestContainer> = req.json().await?;
'outer: for latest in latest_containers {
for current in &current_containers {
if current.image != format!("{}/{}", latest.namespace, latest.repository) {
continue;
}

if current.version != latest.digest {
containers.push(latest);
if current.version != latest.digest {
containers.push(latest);
}
continue 'outer;
}
continue 'outer;
}

// If we don't have the container locally we should fetch it
containers.push(latest);
// If we don't have the container locally we should fetch it
containers.push(latest);
}
}

let req = reqwest::get(format!("{host}/github/releases/latest")).await?;
Expand Down

0 comments on commit efbab64

Please sign in to comment.