Skip to content

Commit

Permalink
chore: set default timeout for exec Deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
vvagaytsev committed Apr 25, 2023
1 parent 0039e9d commit 0e32ab5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions core/src/plugins/exec/config.ts
Expand Up @@ -22,6 +22,7 @@ import {
} from "../../config/common"
import { ArtifactSpec } from "../../config/validation"
import { dedent } from "../../util/string"
import { DEFAULT_RUN_TIMEOUT_SEC } from "../../constants"

const execPathDoc = dedent`
Note that if a Build is referenced in the \`build\` field, the command will be run from the build directory for that Build action. If that Build has \`buildAtSource: true\` set, the command will be run from the source directory of the Build action. If no \`build\` reference is set, the command is run from the source directory of this action.
Expand Down Expand Up @@ -53,13 +54,15 @@ const execCommonSchema = createSchema({
`),
}),
})

// BUILD //

export interface ExecBuildActionSpec extends CommonKeys {
command?: string[] // This needs to be optional to support "dummy" builds
timeout?: number
env: StringMap
}

export type ExecBuildConfig = BuildActionConfig<"exec", ExecBuildActionSpec>
export type ExecBuild = BuildAction<ExecBuildConfig, ExecOutputs>

Expand Down Expand Up @@ -97,7 +100,7 @@ export interface ExecDeployActionSpec extends CommonKeys {
cleanupCommand?: string[]
deployCommand: string[]
statusCommand?: string[]
timeout?: number
timeout: number
statusTimeout: number
env: StringMap
}
Expand Down Expand Up @@ -159,8 +162,7 @@ export const execDeployActionSchema = createSchema({
${execPathDoc}
`
),
// TODO-0.13.0: Set a default in v0.13.0.
timeout: joi.number().description(dedent`
timeout: joi.number().integer().min(1).default(DEFAULT_RUN_TIMEOUT_SEC).description(dedent`
The maximum duration (in seconds) to wait for \`deployCommand\` to exit. Ignored if \`persistent: false\`.
`),
statusTimeout: joi.number().default(defaultStatusTimeout).description(dedent`
Expand Down Expand Up @@ -204,6 +206,7 @@ export const execRunActionSchema = createSchema({
// TEST //

export interface ExecTestActionSpec extends ExecRunActionSpec {}

export type ExecTestConfig = TestActionConfig<"exec", ExecTestActionSpec>
export type ExecTest = TestAction<ExecTestConfig, ExecOutputs>

Expand Down
8 changes: 4 additions & 4 deletions docs/reference/action-types/Deploy/exec.md
Expand Up @@ -202,7 +202,7 @@ spec:
cleanupCommand:

# The maximum duration (in seconds) to wait for `deployCommand` to exit. Ignored if `persistent: false`.
timeout:
timeout: 600

# The maximum duration (in seconds) to wait for a for the `statusCommand` to return a zero exit code. Ignored if no
# `statusCommand` is set.
Expand Down Expand Up @@ -515,9 +515,9 @@ Note that if a Build is referenced in the `build` field, the command will be run

The maximum duration (in seconds) to wait for `deployCommand` to exit. Ignored if `persistent: false`.

| Type | Required |
| -------- | -------- |
| `number` | No |
| Type | Default | Required |
| -------- | ------- | -------- |
| `number` | `600` | No |

### `spec.statusTimeout`

Expand Down

0 comments on commit 0e32ab5

Please sign in to comment.