Skip to content

Commit

Permalink
fix(helm): add missing command directive to task spec
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed Jul 10, 2019
1 parent 9f7cc8a commit 065b284
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
46 changes: 43 additions & 3 deletions docs/reference/module-types/helm.md
Expand Up @@ -338,17 +338,27 @@ The task definitions for this module.

[tasks](#tasks) > name

The name of the test.
The name of the task.

| Type | Required |
| -------- | -------- |
| `string` | Yes |

### `tasks[].description`

[tasks](#tasks) > description

A description of the task.

| Type | Required |
| -------- | -------- |
| `string` | No |

### `tasks[].dependencies[]`

[tasks](#tasks) > dependencies

The names of any services that must be running, and the names of any tasks that must be executed, before the test is run.
The names of any tasks that must be executed, and the names of any services that must be running, before this task is executed.

| Type | Required | Default |
| --------------- | -------- | ------- |
Expand All @@ -358,7 +368,7 @@ The names of any services that must be running, and the names of any tasks that

[tasks](#tasks) > timeout

Maximum duration (in seconds) of the test run.
Maximum duration (in seconds) of the task's execution.

| Type | Required | Default |
| -------- | -------- | ------- |
Expand Down Expand Up @@ -447,6 +457,25 @@ tasks:
- my-server.js
```

### `tasks[].command[]`

[tasks](#tasks) > command

The command/entrypoint used to run the task inside the container.

| Type | Required |
| --------------- | -------- |
| `array[string]` | No |

Example:

```yaml
tasks:
- command:
- /bin/sh
- '-c'
```

### `tasks[].args[]`

[tasks](#tasks) > args
Expand All @@ -457,6 +486,15 @@ The arguments to pass to the pod used for execution.
| --------------- | -------- |
| `array[string]` | No |

Example:

```yaml
tasks:
- args:
- rake
- 'db:migrate'
```

### `tasks[].env`

[tasks](#tasks) > env
Expand Down Expand Up @@ -680,6 +718,7 @@ serviceResource:
skipDeploy: false
tasks:
- name:
description:
dependencies: []
timeout: null
resource:
Expand All @@ -688,6 +727,7 @@ tasks:
containerName:
containerModule:
hotReloadArgs:
command:
args:
env: {}
tests:
Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/plugins/container/config.ts
Expand Up @@ -91,7 +91,7 @@ export interface ContainerServiceSpec extends CommonServiceSpec {
volumes: ServiceVolumeSpec[],
}

const commandExample = ["/bin/sh", "-c"]
export const commandExample = ["/bin/sh", "-c"]

const hotReloadSyncSchema = joi.object()
.keys({
Expand Down
12 changes: 8 additions & 4 deletions garden-service/src/plugins/kubernetes/helm/config.ts
Expand Up @@ -23,9 +23,9 @@ import { ConfigurationError } from "../../../exceptions"
import { deline } from "../../../util/string"
import { HotReloadableKind, hotReloadableKinds } from "../hot-reload"
import { BaseTestSpec, baseTestSpecSchema } from "../../../config/test"
import { BaseTaskSpec } from "../../../config/task"
import { BaseTaskSpec, baseTaskSpecSchema } from "../../../config/task"
import { Service } from "../../../types/service"
import { ContainerModule, ContainerEnvVars, containerEnvVarsSchema } from "../../container/config"
import { ContainerModule, ContainerEnvVars, containerEnvVarsSchema, commandExample } from "../../container/config"
import { baseBuildSpecSchema } from "../../../config/module"
import { ConfigureModuleParams, ConfigureModuleResult } from "../../../types/plugin/module/configure"

Expand Down Expand Up @@ -99,16 +99,20 @@ const resourceSchema = joi.object()
.example([["nodemon", "my-server.js"], {}]),
})

export const execTaskSchema = baseTestSpecSchema
export const execTaskSchema = baseTaskSpecSchema
.keys({
resource: resourceSchema
.description(
deline`The Deployment, DaemonSet or StatefulSet that Garden should use to execute this task.
If not specified, the \`serviceResource\` configured on the module will be used. If neither is specified,
an error will be thrown.`,
),
command: joi.array().items(joi.string())
.description("The command/entrypoint used to run the task inside the container.")
.example([commandExample, {}]),
args: joi.array().items(joi.string())
.description("The arguments to pass to the pod used for execution."),
.description("The arguments to pass to the pod used for execution.")
.example([["rake", "db:migrate"], {}]),
env: containerEnvVarsSchema,
})

Expand Down

0 comments on commit 065b284

Please sign in to comment.