Files
komodo/client/periphery/rs/src/api/git.rs
T
Maxwell BeckerandJacky Fong 118ae9b92c 1.18.4 (#604)
* 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>
2025-06-24 16:32:39 -07:00

120 lines
3.0 KiB
Rust

use std::path::PathBuf;
use komodo_client::entities::{
EnvironmentVar, LatestCommit, RepoExecutionArgs,
RepoExecutionResponse, SystemCommand, update::Log,
};
use resolver_api::Resolve;
use serde::{Deserialize, Serialize};
/// Returns `null` if not a repo
#[derive(Debug, Clone, Serialize, Deserialize, Resolve)]
#[response(Option<LatestCommit>)]
#[error(serror::Error)]
pub struct GetLatestCommit {
pub name: String,
pub path: Option<String>,
}
//
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[response(PeripheryRepoExecutionResponse)]
#[error(serror::Error)]
pub struct CloneRepo {
pub args: RepoExecutionArgs,
/// Override git token with one sent from core.
pub git_token: Option<String>,
#[serde(default)]
pub environment: Vec<EnvironmentVar>,
/// Relative to repo root
#[serde(default = "default_env_file_path")]
pub env_file_path: String,
pub on_clone: Option<SystemCommand>,
pub on_pull: Option<SystemCommand>,
#[serde(default)]
pub skip_secret_interp: bool,
/// Propogate any secret replacers from core interpolation.
#[serde(default)]
pub replacers: Vec<(String, String)>,
}
fn default_env_file_path() -> String {
String::from(".env")
}
//
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[response(PeripheryRepoExecutionResponse)]
#[error(serror::Error)]
pub struct PullRepo {
pub args: RepoExecutionArgs,
/// Override git token with one sent from core.
pub git_token: Option<String>,
#[serde(default)]
pub environment: Vec<EnvironmentVar>,
#[serde(default = "default_env_file_path")]
pub env_file_path: String,
pub on_pull: Option<SystemCommand>,
#[serde(default)]
pub skip_secret_interp: bool,
/// Propogate any secret replacers from core interpolation.
#[serde(default)]
pub replacers: Vec<(String, String)>,
}
//
/// Either pull or clone depending on whether it exists.
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[response(PeripheryRepoExecutionResponse)]
#[error(serror::Error)]
pub struct PullOrCloneRepo {
pub args: RepoExecutionArgs,
/// Override git token with one sent from core.
pub git_token: Option<String>,
#[serde(default)]
pub environment: Vec<EnvironmentVar>,
#[serde(default = "default_env_file_path")]
pub env_file_path: String,
pub on_clone: Option<SystemCommand>,
pub on_pull: Option<SystemCommand>,
#[serde(default)]
pub skip_secret_interp: bool,
/// Propogate any secret replacers from core interpolation.
#[serde(default)]
pub replacers: Vec<(String, String)>,
}
//
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PeripheryRepoExecutionResponse {
pub res: RepoExecutionResponse,
pub env_file_path: Option<PathBuf>,
}
//
//
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[response(Log)]
#[error(serror::Error)]
pub struct RenameRepo {
pub curr_name: String,
pub new_name: String,
}
//
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[response(Log)]
#[error(serror::Error)]
pub struct DeleteRepo {
pub name: String,
/// Clears
pub is_build: bool,
}