Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/periphery/src/api/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl Resolve<crate::api::Args> for build::Build {
"Pre Build",
pre_build_path.as_path(),
&pre_build.command,
KomodoCommandMode::Multiline,
if pre_build.shell_mode { KomodoCommandMode::Shell } else { KomodoCommandMode::Multiline },
&replacers,
)
.instrument(span)
Expand Down
4 changes: 2 additions & 2 deletions bin/periphery/src/api/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl Resolve<crate::api::Args> for ComposeUp {
"Pre Deploy",
pre_deploy_path.as_path(),
&stack.config.pre_deploy.command,
KomodoCommandMode::Multiline,
if stack.config.pre_deploy.shell_mode { KomodoCommandMode::Shell } else { KomodoCommandMode::Multiline },
&replacers,
)
.instrument(span)
Expand Down Expand Up @@ -760,7 +760,7 @@ impl Resolve<crate::api::Args> for ComposeUp {
"Post Deploy",
post_deploy_path.as_path(),
&stack.config.post_deploy.command,
KomodoCommandMode::Multiline,
if stack.config.post_deploy.shell_mode { KomodoCommandMode::Shell } else { KomodoCommandMode::Multiline },
&replacers,
)
.instrument(span)
Expand Down
4 changes: 2 additions & 2 deletions bin/periphery/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub async fn handle_post_repo_execution(
"On Clone",
path.as_path(),
on_clone.command,
KomodoCommandMode::Multiline,
if on_clone.shell_mode { KomodoCommandMode::Shell } else { KomodoCommandMode::Multiline },
&replacers,
)
.await
Expand All @@ -214,7 +214,7 @@ pub async fn handle_post_repo_execution(
"On Pull",
path.as_path(),
on_pull.command,
KomodoCommandMode::Multiline,
if on_pull.shell_mode { KomodoCommandMode::Shell } else { KomodoCommandMode::Multiline },
&replacers,
)
.await
Expand Down
2 changes: 2 additions & 0 deletions client/core/rs/src/entities/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ pub struct SystemCommand {
pub path: String,
#[serde(default, deserialize_with = "file_contents_deserializer")]
pub command: String,
#[serde(default)]
pub shell_mode: bool,
}

impl SystemCommand {
Expand Down
1 change: 1 addition & 0 deletions client/core/ts/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ export interface ImageRegistryConfig {
export interface SystemCommand {
path?: string;
command?: string;
shell_mode?: boolean;
}

/** The build configuration. */
Expand Down
1 change: 1 addition & 0 deletions ui/public/client/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ export interface ImageRegistryConfig {
export interface SystemCommand {
path?: string;
command?: string;
shell_mode?: boolean;
}
/** The build configuration. */
export interface BuildConfig {
Expand Down
29 changes: 24 additions & 5 deletions ui/src/components/config/system-command.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stack, TextInput } from "@mantine/core";
import { Checkbox, Code, Stack, TextInput } from "@mantine/core";
import { Types } from "komodo_client";
import { MonacoEditor } from "@/components/monaco";

Expand All @@ -13,6 +13,9 @@ export default function SystemCommand({
disabled,
set,
}: SystemCommandProps) {
const placeholder = value?.shell_mode
? " # Add a command to run.\n "
: " # Add multiple commands on new lines. Supports comments and escaped newlines.\n ";
return (
<Stack>
<TextInput
Expand All @@ -23,11 +26,27 @@ export default function SystemCommand({
onChange={(e) => set({ ...(value || {}), path: e.target.value })}
disabled={disabled}
/>
<MonacoEditor
value={
value?.command ||
" # Add multiple commands on new lines. Supports comments.\n "
<Checkbox
label={
<>
Run in shell mode (
<Code fz="sm" p="0">
sh -c
</Code>
){" "}
</>
}
checked={value?.shell_mode ?? false}
onChange={(e) =>
set({
...(value || {}),
shell_mode: e.currentTarget.checked,
})
}
disabled={disabled}
/>
<MonacoEditor
value={value?.command || placeholder}
language="shell"
onValueChange={(command) => set({ ...(value || {}), command })}
readOnly={disabled}
Expand Down