Skip to content

Commit

Permalink
fix(terraform): more sensible timeouts + remove timeout on plugin cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Apr 8, 2020
1 parent d96ab9d commit ed64209
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/guides/in-cluster-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ In this mode, builds are executed as follows:

After enabling this mode (we currently still default to the `local-docker` mode), you will need to run `garden plugins kubernetes cluster-init --env=<env-name>` for each applicable environment, in order to install the required cluster-wide services. Those services include the Docker daemon itself, as well as an image registry, a sync service for receiving build contexts, two persistent volumes, an NFS volume provisioner for one of those volumes, and a couple of small utility services.

Optionally, you can also enable [BuildKit]((https://github.com/moby/buildkit)). In most cases, this should work well and be more performant, but remains optional for now. If you have `cluster-docker` set as your `buildMode` you can enable BuildKit for an environment as follows:
Optionally, you can also enable [BuildKit](https://github.com/moby/buildkit). In most cases, this should work well and be more performant, but remains optional for now. If you have `cluster-docker` set as your `buildMode` you can enable BuildKit for an environment as follows:

```yaml
clusterDocker:
Expand Down
2 changes: 1 addition & 1 deletion docs/misc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ We're exploring how we can release it incrementally. Please let us know if this

### What system components does Garden install?

The components installed when using the remote building functionality are discussed in the [In-cluster building docs](https://docs.garden.io/using-garden/in-cluster-building).
The components installed when using the remote building functionality are discussed in the [In-cluster building docs](https://docs.garden.io/guides/in-cluster-building).

Garden also optionally installs Nginx. The `local-kubernetes` provider defaults to installing Nginx, but the (remote) `kubernetes` provider does not install it by default.

Expand Down
18 changes: 16 additions & 2 deletions garden-service/src/plugins/terraform/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ function makeRootCommand(commandName: string) {
await tfValidate(log, provider, root, provider.config.variables)

args = [commandName, ...(await prepareVariables(root, provider.config.variables)), ...args]
await terraform(provider.config.version).spawnAndWait({ log, args, cwd: root, rawMode: false, tty: true })
await terraform(provider.config.version).spawnAndWait({
log,
args,
cwd: root,
rawMode: false,
tty: true,
timeout: 999999,
})

return { result: {} }
},
Expand All @@ -73,7 +80,14 @@ function makeModuleCommand(commandName: string) {
await tfValidate(log, provider, root, provider.config.variables)

args = [commandName, ...(await prepareVariables(root, module.spec.variables)), ...args.slice(1)]
await terraform(module.spec.version).spawnAndWait({ log, args, cwd: root, rawMode: false, tty: true })
await terraform(module.spec.version).spawnAndWait({
log,
args,
cwd: root,
rawMode: false,
tty: true,
timeout: 999999,
})

return { result: {} }
},
Expand Down
7 changes: 4 additions & 3 deletions garden-service/src/util/ext-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import got from "got/dist/source"
const AsyncLock = require("async-lock")

const toolsPath = join(GARDEN_GLOBAL_PATH, "tools")
const defaultCommandTimeoutSecs = 60 * 10

export interface LibraryExtractSpec {
// Archive format. Note: the "tar" format also implicitly supports gzip and bz2 compression.
Expand Down Expand Up @@ -244,12 +245,12 @@ export class BinaryCmd extends Library {
spec: LibraryPlatformSpec

private chmodDone: boolean
private defaultTimeout: number
private defaultTimeoutSecs: number

constructor(spec: BinarySpec) {
super(spec)
this.chmodDone = false
this.defaultTimeout = 60
this.defaultTimeoutSecs = spec.defaultTimeout || defaultCommandTimeoutSecs
}

async getPath(log: LogEntry) {
Expand Down Expand Up @@ -341,6 +342,6 @@ export class BinaryCmd extends Library {
}

private getTimeout(timeout?: number) {
return timeout === undefined ? this.defaultTimeout : timeout
return timeout === undefined ? this.defaultTimeoutSecs : timeout
}
}

0 comments on commit ed64209

Please sign in to comment.