deploy 1.19.0-dev-7

This commit is contained in:
mbecker20
2025-08-10 18:52:01 -07:00
parent 95ffa5b4f5
commit 7c2403b7d1
9 changed files with 128 additions and 71 deletions

32
Cargo.lock generated
View File

@@ -904,7 +904,7 @@ dependencies = [
[[package]]
name = "cache"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"tokio",
@@ -1071,7 +1071,7 @@ dependencies = [
[[package]]
name = "command"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"komodo_client",
"run_command",
@@ -1080,7 +1080,7 @@ dependencies = [
[[package]]
name = "config"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"colored",
"indexmap 2.10.0",
@@ -1320,7 +1320,7 @@ checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
[[package]]
name = "database"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"async-compression",
@@ -1619,7 +1619,7 @@ dependencies = [
[[package]]
name = "environment"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"formatting",
@@ -1629,7 +1629,7 @@ dependencies = [
[[package]]
name = "environment_file"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"thiserror 2.0.12",
]
@@ -1719,7 +1719,7 @@ dependencies = [
[[package]]
name = "formatting"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"serror",
]
@@ -1881,7 +1881,7 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
[[package]]
name = "git"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"cache",
@@ -2487,7 +2487,7 @@ dependencies = [
[[package]]
name = "interpolate"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"komodo_client",
@@ -2618,7 +2618,7 @@ dependencies = [
[[package]]
name = "komodo_cli"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"chrono",
@@ -2643,7 +2643,7 @@ dependencies = [
[[package]]
name = "komodo_client"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"async_timing_util",
@@ -2677,7 +2677,7 @@ dependencies = [
[[package]]
name = "komodo_core"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"arc-swap",
@@ -2747,7 +2747,7 @@ dependencies = [
[[package]]
name = "komodo_periphery"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"arc-swap",
@@ -2868,7 +2868,7 @@ dependencies = [
[[package]]
name = "logger"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"komodo_client",
@@ -3610,7 +3610,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "periphery_client"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"komodo_client",
@@ -4141,7 +4141,7 @@ dependencies = [
[[package]]
name = "response"
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
dependencies = [
"anyhow",
"axum",

View File

@@ -8,7 +8,7 @@ members = [
]
[workspace.package]
version = "1.19.0-dev-6"
version = "1.19.0-dev-7"
edition = "2024"
authors = ["mbecker20 <becker.maxh@gmail.com>"]
license = "GPL-3.0-or-later"

View File

@@ -18,8 +18,8 @@ use komodo_client::{
user::{CreateApiKey, CreateApiKeyResponse, DeleteApiKey},
},
entities::{
JsonObject,
action::{Action, ActionArgumentsFormat},
FileFormat, JsonObject,
action::Action,
alert::{Alert, AlertData, SeverityLevel},
config::core::CoreConfig,
komodo_timestamp,
@@ -397,10 +397,10 @@ fn delete_file(
fn parse_action_arguments(
args: &str,
format: ActionArgumentsFormat,
format: FileFormat,
) -> anyhow::Result<JsonObject> {
match format {
ActionArgumentsFormat::KeyValue => {
FileFormat::KeyValue => {
let args = parse_key_value_list(args)
.context("Failed to parse args as key value list")?
.into_iter()
@@ -408,11 +408,11 @@ fn parse_action_arguments(
.collect();
Ok(args)
}
ActionArgumentsFormat::Toml => toml::from_str(args)
FileFormat::Toml => toml::from_str(args)
.context("Failed to parse Toml to Action args"),
ActionArgumentsFormat::Yaml => serde_yaml_ng::from_str(args)
FileFormat::Yaml => serde_yaml_ng::from_str(args)
.context("Failed to parse Yaml to action args"),
ActionArgumentsFormat::Json => serde_json::from_str(args)
FileFormat::Json => serde_json::from_str(args)
.context("Failed to parse Json to action args"),
}
}

View File

@@ -10,7 +10,7 @@ use crate::{
deserializers::{
file_contents_deserializer, option_file_contents_deserializer,
},
entities::{I64, NoData},
entities::{FileFormat, I64, NoData},
};
use super::{
@@ -147,15 +147,6 @@ pub struct ActionConfig {
#[builder(default)]
pub reload_deno_deps: bool,
#[serde(default)]
#[builder(default)]
pub arguments_format: ActionArgumentsFormat,
/// Default arguments to give to the Action for use in the script at `ARGS`.
#[serde(default)]
#[builder(default)]
pub arguments: String,
/// Typescript file contents using pre-initialized `komodo` client.
/// Supports variable / secret interpolation.
#[serde(default, deserialize_with = "file_contents_deserializer")]
@@ -165,6 +156,17 @@ pub struct ActionConfig {
))]
#[builder(default)]
pub file_contents: String,
/// Specify the format in which the arguments are defined.
/// Default: `key_value` (like environment)
#[serde(default)]
#[builder(default)]
pub arguments_format: FileFormat,
/// Default arguments to give to the Action for use in the script at `ARGS`.
#[serde(default)]
#[builder(default)]
pub arguments: String,
}
fn default_schedule_enabled() -> bool {
@@ -207,24 +209,12 @@ impl Default for ActionConfig {
webhook_secret: Default::default(),
reload_deno_deps: Default::default(),
arguments_format: Default::default(),
arguments: Default::default(),
file_contents: Default::default(),
arguments: Default::default(),
}
}
}
#[typeshare]
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize,
)]
pub enum ActionArgumentsFormat {
#[default]
KeyValue,
Toml,
Yaml,
Json,
}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Default)]
pub struct ActionActionState {

View File

@@ -1410,6 +1410,19 @@ pub enum ScheduleFormat {
Cron,
}
#[typeshare]
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize,
)]
#[serde(rename_all = "snake_case")]
pub enum FileFormat {
#[default]
KeyValue,
Toml,
Yaml,
Json,
}
/// Used with ExecuteTerminal to capture the exit code
pub const KOMODO_EXIT_CODE: &str = "__KOMODO_EXIT_CODE:";

View File

@@ -63,11 +63,11 @@ export enum ScheduleFormat {
Cron = "Cron",
}
export enum ActionArgumentsFormat {
KeyValue = "KeyValue",
Toml = "Toml",
Yaml = "Yaml",
Json = "Json",
export enum FileFormat {
KeyValue = "key_value",
Toml = "toml",
Yaml = "yaml",
Json = "json",
}
export interface ActionConfig {
@@ -120,14 +120,18 @@ export interface ActionConfig {
* this can usually be kept false outside of development.
*/
reload_deno_deps?: boolean;
arguments_format?: ActionArgumentsFormat;
/** Default arguments to give to the Action for use in the script at `ARGS`. */
arguments?: string;
/**
* Typescript file contents using pre-initialized `komodo` client.
* Supports variable / secret interpolation.
*/
file_contents?: string;
/**
* Specify the format in which the arguments are defined.
* Default: `key_value` (like environment)
*/
arguments_format?: FileFormat;
/** Default arguments to give to the Action for use in the script at `ARGS`. */
arguments?: string;
}
/** Represents an empty json object: `{}` */

View File

@@ -52,11 +52,11 @@ export declare enum ScheduleFormat {
English = "English",
Cron = "Cron"
}
export declare enum ActionArgumentsFormat {
KeyValue = "KeyValue",
Toml = "Toml",
Yaml = "Yaml",
Json = "Json"
export declare enum FileFormat {
KeyValue = "key_value",
Toml = "toml",
Yaml = "yaml",
Json = "json"
}
export interface ActionConfig {
/** Whether this action should run at startup. */
@@ -108,14 +108,18 @@ export interface ActionConfig {
* this can usually be kept false outside of development.
*/
reload_deno_deps?: boolean;
arguments_format?: ActionArgumentsFormat;
/** Default arguments to give to the Action for use in the script at `ARGS`. */
arguments?: string;
/**
* Typescript file contents using pre-initialized `komodo` client.
* Supports variable / secret interpolation.
*/
file_contents?: string;
/**
* Specify the format in which the arguments are defined.
* Default: `key_value` (like environment)
*/
arguments_format?: FileFormat;
/** Default arguments to give to the Action for use in the script at `ARGS`. */
arguments?: string;
}
/** Represents an empty json object: `{}` */
export interface NoData {

View File

@@ -18,13 +18,13 @@ export var ScheduleFormat;
ScheduleFormat["English"] = "English";
ScheduleFormat["Cron"] = "Cron";
})(ScheduleFormat || (ScheduleFormat = {}));
export var ActionArgumentsFormat;
(function (ActionArgumentsFormat) {
ActionArgumentsFormat["KeyValue"] = "KeyValue";
ActionArgumentsFormat["Toml"] = "Toml";
ActionArgumentsFormat["Yaml"] = "Yaml";
ActionArgumentsFormat["Json"] = "Json";
})(ActionArgumentsFormat || (ActionArgumentsFormat = {}));
export var FileFormat;
(function (FileFormat) {
FileFormat["KeyValue"] = "key_value";
FileFormat["Toml"] = "toml";
FileFormat["Yaml"] = "yaml";
FileFormat["Json"] = "json";
})(FileFormat || (FileFormat = {}));
export var ActionState;
(function (ActionState) {
/** Unknown case */

View File

@@ -106,6 +106,51 @@ export const ActionConfig = ({ id }: { id: string }) => {
},
},
},
{
label: "Arguments",
description: "Manage the action file default arguments.",
components: {
arguments: (args, set) => {
const format =
update.arguments_format ??
config.arguments_format ??
Types.FileFormat.KeyValue;
return (
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<SecretsSearch />
<Select
value={format}
onValueChange={(arguments_format: Types.FileFormat) =>
set({ arguments_format })
}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
{Object.values(Types.FileFormat).map((format) => (
<SelectItem value={format}>{format}</SelectItem>
))}
</SelectContent>
</Select>
</div>
<MonacoEditor
value={args}
onValueChange={(args) => set({ arguments: args })}
language={
update.arguments_format ??
config.arguments_format ??
Types.FileFormat.KeyValue
}
readOnly={disabled}
/>
<ActionInfo id={id} />
</div>
);
},
},
},
{
label: "Alert",
labelHidden: true,
@@ -217,7 +262,8 @@ export const ActionConfig = ({ id }: { id: string }) => {
components: {
run_at_startup: {
label: "Run on Startup",
description: "Run this action on completion of startup of Komodo Core",
description:
"Run this action on completion of startup of Komodo Core",
},
},
},