mirror of
https://github.com/moghtech/komodo.git
synced 2026-08-24 08:00:17 +00:00
118ae9b92c
* update easy deps * update otel deps * implement template in types + update resource meta * ts types * dev-2 * dev-3 default template query is include * Toggle resource is template in resource header * dev-4 support CopyServer * gen ts * style template selector in New Resource menu * fix new menu show 0 * add template market in omni search bar * fix some dynamic import behavior * template badge on dashboard * dev-5 * standardize interpolation methods with nice api * core use new interpolation methods * refactor git usage * dev-6 refactor interpolation / git methods * fix pull stack passed replacers * new types * remove redundant interpolation for build secret args * clean up periphery docker client * dev-7 include ports in container summary, see if they actually come through * show container ports in container table * refresh processes without tasks (more efficient) * dev-8 keep container stats cache, include with ContainerListItem * gen types * display more container ports * dev-9 fix repo clone when repo doesn't exist initially * Add ports display to more spots * fix function name * add Periphery full container stats api, may be used later * server container stats list * dev-10 * 1.18.4 release * Use reset instead of invalidate to fix GetUser spam on token expiry (#618) --------- Co-authored-by: Jacky Fong <hello@huzky.dev>
38 lines
1.0 KiB
Rust
38 lines
1.0 KiB
Rust
use std::path::Path;
|
|
|
|
use komodo_client::entities::{
|
|
RepoExecutionArgs, RepoExecutionResponse,
|
|
};
|
|
|
|
/// This is a mix of clone / pull.
|
|
/// - If the folder doesn't exist, it will clone the repo.
|
|
/// - Second variable in tuple will be `true`
|
|
/// - If it does, it will ensure the remote is correct,
|
|
/// ensure the correct branch is (force) checked out,
|
|
/// force pull the repo, and switch to specified hash if provided.
|
|
#[tracing::instrument(
|
|
level = "debug",
|
|
skip(clone_args, access_token)
|
|
)]
|
|
pub async fn pull_or_clone<T>(
|
|
clone_args: T,
|
|
root_repo_dir: &Path,
|
|
access_token: Option<String>,
|
|
) -> anyhow::Result<(RepoExecutionResponse, bool)>
|
|
where
|
|
T: Into<RepoExecutionArgs> + std::fmt::Debug,
|
|
{
|
|
let args: RepoExecutionArgs = clone_args.into();
|
|
let folder_path = args.path(root_repo_dir);
|
|
|
|
if folder_path.exists() {
|
|
crate::pull(args, root_repo_dir, access_token)
|
|
.await
|
|
.map(|r| (r, false))
|
|
} else {
|
|
crate::clone(args, root_repo_dir, access_token)
|
|
.await
|
|
.map(|r| (r, true))
|
|
}
|
|
}
|