Skip to content

Commit 47cc851

Browse files
authored
Merge pull request #2275 from FabianKramm/main
devspace enter fixes, wait_pod & resolve vars in imports section
2 parents 6277394 + f45b0c9 commit 47cc851

31 files changed

Lines changed: 335 additions & 11 deletions

File tree

cmd/enter.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type EnterCmd struct {
3030
Container string
3131
Pod string
3232
Pick bool
33+
TTY bool
3334
Wait bool
3435
Reconnect bool
3536
Screen bool
@@ -78,6 +79,7 @@ devspace enter bash --image-selector "${runtime.images.app.image}:${runtime.imag
7879
enterCmd.Flags().StringVar(&cmd.ImageSelector, "image-selector", "", "The image to search a pod for (e.g. nginx, nginx:latest, ${runtime.images.app}, nginx:${runtime.images.app.tag})")
7980
enterCmd.Flags().StringVar(&cmd.WorkingDirectory, "workdir", "", "The working directory where to open the terminal or execute the command")
8081

82+
enterCmd.Flags().BoolVar(&cmd.TTY, "tty", true, "If to use a tty to start the command")
8183
enterCmd.Flags().BoolVar(&cmd.Pick, "pick", true, "Select a pod / container if multiple are found")
8284
enterCmd.Flags().BoolVar(&cmd.Wait, "wait", false, "Wait for the pod(s) to start if they are not running")
8385
enterCmd.Flags().BoolVar(&cmd.Reconnect, "reconnect", false, "Will reconnect the terminal if an unexpected return code is encountered")
@@ -158,7 +160,7 @@ func (cmd *EnterCmd) Run(f factory.Factory, args []string) error {
158160

159161
// Start terminal
160162
stdout, stderr, stdin := defaultStdStreams(cmd.Stdout, cmd.Stderr, cmd.Stdin)
161-
exitCode, err := terminal.StartTerminalFromCMD(ctx, targetselector.NewTargetSelector(selectorOptions), command, cmd.Wait, cmd.Reconnect, cmd.Screen, cmd.ScreenSession, stdout, stderr, stdin)
163+
exitCode, err := terminal.StartTerminalFromCMD(ctx, targetselector.NewTargetSelector(selectorOptions), command, cmd.Wait, cmd.Reconnect, cmd.TTY, cmd.Screen, cmd.ScreenSession, stdout, stderr, stdin)
162164
if err != nil {
163165
return err
164166
} else if exitCode != 0 {

devspace-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,10 @@
18131813
"disableScreen": {
18141814
"type": "boolean",
18151815
"description": "DisableScreen will disable screen which is used by DevSpace by default to preserve\nsessions if connections interrupt or the session is lost."
1816+
},
1817+
"disableTTY": {
1818+
"type": "boolean",
1819+
"description": "DisableTTY will disable a tty shell for terminal command execution"
18161820
}
18171821
},
18181822
"type": "object",

docs/hack/functions/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,14 @@ var Functions = []Function{
363363
Return: reflect.String.String(),
364364
Group: groupOther,
365365
},
366+
{
367+
Name: "wait_pod",
368+
Description: "Waits for a pod to become running",
369+
Args: `[command]`,
370+
Handler: commands.WaitPod,
371+
Flags: commands.WaitPodOptions{},
372+
Group: groupOther,
373+
},
366374
{
367375
Name: "exec_container",
368376
Description: `Executes the command provided as argument inside a container`,

docs/pages/configuration/_partials/functions/group_other.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import PartialGetflag from "./get_flag.mdx"
99
import PartialCat from "./cat.mdx"
1010
import PartialGetconfigvalue from "./get_config_value.mdx"
1111
import PartialExeccontainer from "./exec_container.mdx"
12+
import PartialWaitpod from "./wait_pod.mdx"
1213
import PartialSelectpod from "./select_pod.mdx"
1314

1415
<PartialSelectpod />
16+
<PartialWaitpod />
1517
<PartialExeccontainer />
1618
<PartialGetconfigvalue />
1719
<PartialCat />

docs/pages/configuration/_partials/functions/group_other_pipeline.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
import PartialGetconfigvalue from "./get_config_value.mdx"
66
import PartialExeccontainer from "./exec_container.mdx"
7+
import PartialWaitpod from "./wait_pod.mdx"
78
import PartialSelectpod from "./select_pod.mdx"
89

910
<PartialSelectpod />
11+
<PartialWaitpod />
1012
<PartialExeccontainer />
1113
<PartialGetconfigvalue />
1214

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
import PartialImageselector from "./wait_pod/image-selector.mdx"
3+
import PartialLabelselector from "./wait_pod/label-selector.mdx"
4+
import PartialContainer from "./wait_pod/container.mdx"
5+
import PartialNamespace from "./wait_pod/namespace.mdx"
6+
import PartialDisablewait from "./wait_pod/disable-wait.mdx"
7+
import PartialTimeout from "./wait_pod/timeout.mdx"
8+
9+
<details className="config-field -function" data-expandable="true">
10+
<summary>
11+
12+
### `wait_pod` <span className="config-field-type">[command]</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="true">pipeline only</span> {#wait_pod}
13+
14+
Waits for a pod to become running
15+
16+
</summary>
17+
18+
<PartialImageselector />
19+
<PartialLabelselector />
20+
<PartialContainer />
21+
<PartialNamespace />
22+
<PartialDisablewait />
23+
<PartialTimeout />
24+
25+
26+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--container` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#wait_pod-container}
6+
7+
The container to use
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--disable-wait` <span className="config-field-type">bool</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#wait_pod-disable-wait}
6+
7+
If true, will not wait for the container to become ready
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--image-selector` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#wait_pod-image-selector}
6+
7+
The image selector to use to select the container
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--label-selector` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#wait_pod-label-selector}
6+
7+
The label selector to use to select the container
8+
9+
</summary>
10+
11+
12+
13+
</details>

0 commit comments

Comments
 (0)