From ed6420903a55abbae5209a586cf141e41c2596fd Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Tue, 7 Apr 2020 14:16:02 +0200 Subject: [PATCH] fix(terraform): more sensible timeouts + remove timeout on plugin cmds --- docs/guides/in-cluster-building.md | 2 +- docs/misc/faq.md | 2 +- .../src/plugins/terraform/commands.ts | 18 ++++++++++++++++-- garden-service/src/util/ext-tools.ts | 7 ++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/guides/in-cluster-building.md b/docs/guides/in-cluster-building.md index f0d2e10731..3ab23f680a 100644 --- a/docs/guides/in-cluster-building.md +++ b/docs/guides/in-cluster-building.md @@ -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=` 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: diff --git a/docs/misc/faq.md b/docs/misc/faq.md index 2805b2f64e..87127d2440 100644 --- a/docs/misc/faq.md +++ b/docs/misc/faq.md @@ -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. diff --git a/garden-service/src/plugins/terraform/commands.ts b/garden-service/src/plugins/terraform/commands.ts index ddc350d8c4..b3d43c901b 100644 --- a/garden-service/src/plugins/terraform/commands.ts +++ b/garden-service/src/plugins/terraform/commands.ts @@ -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: {} } }, @@ -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: {} } }, diff --git a/garden-service/src/util/ext-tools.ts b/garden-service/src/util/ext-tools.ts index 12d5eb8d86..0f2c4d3a44 100644 --- a/garden-service/src/util/ext-tools.ts +++ b/garden-service/src/util/ext-tools.ts @@ -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. @@ -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) { @@ -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 } }