Repository navigation
fix(cli): use published images outside a clone #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e205235
fix(cli): use published images outside a clone
LKSNDRTMLKV 40a7033
fix(cli): run every start through preflight_start
LKSNDRTMLKV 7d3d3c0
fix(cli): name the install root .env belongs in
LKSNDRTMLKV 742397f
Merge branch 'main' into fix/cli-published-images
LKSNDRTMLKV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,36 @@ | ||
| //! `odal update` — bring the node up to the latest version. | ||
| //! | ||
| //! What "latest" means depends on how the node is deployed, mirroring `odal up`: | ||
| //! • localhost / self-host (Dev) — node + resolver are built from source; there | ||
| //! is no published image to pull (pre-publish, GHCR even returns "denied"). | ||
| //! Update = rebuild from the current source and recreate the containers. | ||
| //! • remote / managed (Prod) — the node runs the published GHCR images. | ||
| //! Update = pull the latest images, then `odal up` to recreate. | ||
| //! Decided the way `odal up` decides whether to build — by whether this install | ||
| //! carries the engine source (`source_tree_present`), never by profile kind: | ||
| //! • source present — rebuild from it and recreate the containers. A pull | ||
| //! there would fetch images the next `odal up` replaces with a build anyway. | ||
| //! • no source — pull the published images for the pinned `ODAL_VERSION` | ||
| //! (`latest` when unset), then `odal up` to recreate. | ||
|
|
||
| use anyhow::Result; | ||
|
|
||
| use crate::{ | ||
| config::{Config, EnvKind}, | ||
| core::infra::{action_up, action_update, compose_file}, | ||
| config::Config, | ||
| core::infra::{action_up, action_update, compose_file, preflight_start, source_tree_present}, | ||
| }; | ||
|
|
||
| pub async fn run_update() -> Result<()> { | ||
| let cfg = Config::load()?; | ||
| let compose = compose_file()?; | ||
| match cfg.kind { | ||
| EnvKind::Dev => { | ||
| // Build-from-source install: `pull` would only ever hit "denied" for | ||
| // the unpublished node/resolver images. Rebuild + recreate instead. | ||
| println!( | ||
| "Rebuilding Odal Node from source ({})...", | ||
| compose.display() | ||
| ); | ||
| action_up(&compose, true).await?; | ||
| println!("Rebuilt and restarted. Run `odal status` to check health."); | ||
| } | ||
| EnvKind::Prod => { | ||
| println!("Pulling latest Odal Node images ({})...", compose.display()); | ||
| action_update(&compose).await?; | ||
| println!("Images updated. Run `odal up` to restart with the new images."); | ||
| } | ||
| if source_tree_present(&compose) { | ||
| // The rebuild recreates the containers, so it starts the node: hold it | ||
| // to every check `odal up` makes. | ||
| preflight_start(&compose, cfg.kind)?; | ||
| println!( | ||
| "Rebuilding Odal Node from source ({})...", | ||
| compose.display() | ||
| ); | ||
| action_up(&compose, true).await?; | ||
| println!("Rebuilt and restarted. Run `odal status` to check health."); | ||
| } else { | ||
| println!("Pulling Odal Node images ({})...", compose.display()); | ||
| action_update(&compose).await?; | ||
| println!("Images updated. Run `odal up` to restart with the new images."); | ||
| } | ||
| Ok(()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.