diff --git a/garden-service/package-lock.json b/garden-service/package-lock.json index decbcd4af8..ba6cc4bab5 100644 --- a/garden-service/package-lock.json +++ b/garden-service/package-lock.json @@ -349,9 +349,9 @@ } }, "@kubernetes/client-node": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@kubernetes/client-node/-/client-node-0.5.2.tgz", - "integrity": "sha512-toOoGG4oCvl1vOq7ZaMmEYs+Ic2ErjWSLYRutuZdB7BREcgXxLi1RwDIhqRoQg4W9vrVg8QQSpmKlIdyWEm+fQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@kubernetes/client-node/-/client-node-0.5.3.tgz", + "integrity": "sha512-41Ba8ldHAhvIUF+PvkhlCaLcgS4ocmKDxhoOwdun3w/L60JIoLLJE11CpHXkbNp7KvV7zY+nJHDrHvdpK7EMAA==", "requires": { "@types/base-64": "^0.1.2", "@types/bluebird": "^3.5.7", @@ -364,7 +364,7 @@ "bluebird": "^3.3.5", "byline": "^5.0.0", "js-yaml": "^3.5.2", - "jsonpath": "^0.2.11", + "jsonpath": "^1.0.0", "request": "^2.72.0", "shelljs": "^0.7.8 ", "underscore": "^1.8.3", @@ -372,9 +372,9 @@ }, "dependencies": { "@types/node": { - "version": "8.10.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.26.tgz", - "integrity": "sha512-opk6bLLErLSwyVVJeSH5Ek7ZWOBSsN0JrvXTNVGLXLAXKB9xlTYajrplR44xVyMrmbut94H6uJ9jqzM/12jxkA==" + "version": "8.10.36", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.36.tgz", + "integrity": "sha512-SL6KhfM7PTqiFmbCW3eVNwVBZ+88Mrzbuvn9olPsfv43mbiWaFY+nRcz/TGGku0/lc2FepdMbImdMY1JrQ+zbw==" } } }, @@ -890,7 +890,7 @@ }, "@types/websocket": { "version": "0.0.38", - "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-0.0.38.tgz", + "resolved": "http://registry.npmjs.org/@types/websocket/-/websocket-0.0.38.tgz", "integrity": "sha512-Z7dRTAiMoIjz9HBa/xb3k+2mx2uJx2sbnbkRRIvM+l/srNLfthHFBW/jD59thOcEa1/ZooKd30G0D+KGH9wU7Q==", "requires": { "@types/events": "*", @@ -1045,25 +1045,11 @@ "buffer-equal": "^1.0.0" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, "archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=" }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -1509,7 +1495,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, "requires": { "tweetnacl": "^0.14.3" } @@ -2068,9 +2053,9 @@ } }, "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "requires": { "delayed-stream": "~1.0.0" } @@ -2166,11 +2151,6 @@ "xdg-basedir": "^3.0.0" } }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, "conventional-changelog-angular": { "version": "1.6.6", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.6.6.tgz", @@ -2412,14 +2392,6 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, "dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -2445,11 +2417,6 @@ "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", "dev": true }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" - }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -2579,11 +2546,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, "deline": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/deline/-/deline-1.0.4.tgz", @@ -2600,11 +2562,6 @@ "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", "dev": true }, - "detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" - }, "detect-newline": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", @@ -2753,7 +2710,6 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -3013,11 +2969,6 @@ } } }, - "expand-template": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-1.1.1.tgz", - "integrity": "sha512-cebqLtV8KOZfw0UI8TEFWxtczxxC1jvyUvx6H4fyp1K1FN7A4Q+uggVUlOsI1K8AGU0rwOGqP8nCapdrw8CYQg==" - }, "expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", @@ -3292,12 +3243,12 @@ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "requires": { "asynckit": "^0.4.0", - "combined-stream": "1.0.6", + "combined-stream": "^1.0.6", "mime-types": "^2.1.12" } }, @@ -3934,54 +3885,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", @@ -4068,11 +3971,6 @@ } } }, - "github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -4766,11 +4664,6 @@ "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", "dev": true }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -5389,8 +5282,7 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, "jsesc": { "version": "2.5.1", @@ -5448,13 +5340,13 @@ "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=" }, "jsonpath": { - "version": "0.2.12", - "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-0.2.12.tgz", - "integrity": "sha1-W/nZEftGFsHjNwvs658NskrjTNI=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-1.0.0.tgz", + "integrity": "sha1-Rc2dTE0NaCXZC9fkD4PxGCsT3Qc=", "requires": { "esprima": "1.2.2", "jison": "0.4.13", - "static-eval": "0.2.3", + "static-eval": "2.0.0", "underscore": "1.7.0" }, "dependencies": { @@ -6123,16 +6015,16 @@ } }, "mime-db": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" }, "mime-types": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "requires": { - "mime-db": "~1.35.0" + "mime-db": "~1.37.0" } }, "mimic-fn": { @@ -6140,11 +6032,6 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -6317,7 +6204,8 @@ "nan": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "optional": true }, "nanomatch": { "version": "1.2.13", @@ -6485,14 +6373,6 @@ } } }, - "node-abi": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.4.4.tgz", - "integrity": "sha512-DQ9Mo2mf/XectC+s6+grPPRQ1Z9gI3ZbrGv6nyXRkjwT3HrE0xvtvrfnH7YHYBLgC/KLadg+h3XHnhZw1sv88A==", - "requires": { - "semver": "^5.4.1" - } - }, "node-emoji": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.8.1.tgz", @@ -6501,15 +6381,6 @@ "lodash.toarray": "^4.4.0" } }, - "node-pty-prebuilt": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/node-pty-prebuilt/-/node-pty-prebuilt-0.7.6.tgz", - "integrity": "sha512-aD/77N6WmohtWMhdHaBMunOihpZzDcp5Ig1cHsmtYNxl5NU8+3r9aGkfbKWUDYrPQaFgbJEAWfGeb3NFYd1+0g==", - "requires": { - "nan": "2.10.0", - "prebuild-install": "^5.0.0" - } - }, "node-version": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/node-version/-/node-version-1.2.0.tgz", @@ -6556,11 +6427,6 @@ } } }, - "noop-logger": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", - "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" - }, "nopt": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz", @@ -6612,17 +6478,6 @@ "path-key": "^2.0.0" } }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -9110,11 +8965,6 @@ "readable-stream": "^2.0.1" } }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, "os-locale": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", @@ -9411,66 +9261,6 @@ "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, - "prebuild-install": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.1.0.tgz", - "integrity": "sha512-jGdh2Ws5OUCvBm+aQ/je7hgOBfLIFcgnF9DZ1PIEvht0JKfMwn3Gy0MPHL16JcAUI6tu7LX0D3VxmvMm1XZwAw==", - "requires": { - "detect-libc": "^1.0.3", - "expand-template": "^1.0.2", - "github-from-package": "0.0.0", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", - "node-abi": "^2.2.0", - "noop-logger": "^0.1.1", - "npmlog": "^4.0.1", - "os-homedir": "^1.0.1", - "pump": "^2.0.1", - "rc": "^1.2.7", - "simple-get": "^2.7.0", - "tar-fs": "^1.13.0", - "tunnel-agent": "^0.6.0", - "which-pm-runs": "^1.0.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "tar-fs": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", - "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==", - "requires": { - "chownr": "^1.0.1", - "mkdirp": "^0.5.1", - "pump": "^1.0.0", - "tar-stream": "^1.1.2" - }, - "dependencies": { - "pump": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", - "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - } - } - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -9676,24 +9466,6 @@ } } }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - } - } - }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -10174,21 +9946,6 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, - "simple-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" - }, - "simple-get": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz", - "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==", - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -10842,9 +10599,9 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -10863,32 +10620,40 @@ "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" }, "static-eval": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-0.2.3.tgz", - "integrity": "sha1-Aj8XrJ/uQm6niMEuo5IG3Bdfiyo=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-2.0.0.tgz", + "integrity": "sha512-6flshd3F1Gwm+Ksxq463LtFd1liC77N/PX1FVVc3OzL3hAmo2fwHFbuArkcfi7s9rTNsLEhcRmXGFZhlgy40uw==", "requires": { - "escodegen": "~0.0.24" + "escodegen": "^1.8.1" }, "dependencies": { "escodegen": { - "version": "0.0.28", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-0.0.28.tgz", - "integrity": "sha1-Dk/xcV8yh3XWyrUaxEpAbNer/9M=", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", + "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", "requires": { - "esprima": "~1.0.2", - "estraverse": "~1.3.0", - "source-map": ">= 0.1.2" + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" } }, "esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" }, "estraverse": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.3.2.tgz", - "integrity": "sha1-N8K4k+8T1yPydth41g2FNRUqbEI=" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true } } }, @@ -10986,11 +10751,6 @@ "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", "dev": true }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -11443,8 +11203,7 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, "type-check": { "version": "0.3.2", @@ -11880,14 +11639,21 @@ } }, "websocket": { - "version": "1.0.26", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.26.tgz", - "integrity": "sha512-fjcrYDPIQxpTnqFQ9JjxUQcdvR89MFAOjPBlF+vjOt49w/XW4fJknUoMz/mDIn2eK1AdslVojcaOxOqyZZV8rw==", + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.28.tgz", + "integrity": "sha512-00y/20/80P7H4bCYkzuuvvfDvh+dgtXi5kzDf3UcZwN6boTYaKvsrtZ5lIYm1Gsg48siMErd9M4zjSYfYFHTrA==", "requires": { "debug": "^2.2.0", - "nan": "^2.3.3", - "typedarray-to-buffer": "^3.1.2", + "nan": "^2.11.0", + "typedarray-to-buffer": "^3.1.5", "yaeti": "^0.0.6" + }, + "dependencies": { + "nan": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", + "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==" + } } }, "which": { @@ -11903,19 +11669,6 @@ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, - "which-pm-runs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", - "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=" - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "requires": { - "string-width": "^1.0.2 || 2" - } - }, "win-release": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/win-release/-/win-release-1.1.1.tgz", diff --git a/garden-service/package.json b/garden-service/package.json index 6033cb87db..8659fa03ea 100644 --- a/garden-service/package.json +++ b/garden-service/package.json @@ -58,7 +58,6 @@ "log-symbols": "^2.2.0", "moment": "^2.22.2", "node-emoji": "^1.8.1", - "node-pty-prebuilt": "^0.7.6", "normalize-url": "^3.2.0", "p-queue": "^3.0.0", "path-is-inside": "^1.0.2", diff --git a/garden-service/src/commands/exec.ts b/garden-service/src/commands/exec.ts index 8271a53228..801be5e119 100644 --- a/garden-service/src/commands/exec.ts +++ b/garden-service/src/commands/exec.ts @@ -68,7 +68,7 @@ export class ExecCommand extends Command { }) const service = await garden.getService(serviceName) - const result = await garden.actions.execInService({ service, command }) + const result = await garden.actions.execInService({ service, command, interactive: true }) return { result } } diff --git a/garden-service/src/commands/run/module.ts b/garden-service/src/commands/run/module.ts index a08ebd03af..ddb761d501 100644 --- a/garden-service/src/commands/run/module.ts +++ b/garden-service/src/commands/run/module.ts @@ -102,7 +102,6 @@ export class RunModuleCommand extends Command { module, command, runtimeContext, - silent: false, interactive: opts.interactive, }) diff --git a/garden-service/src/commands/run/service.ts b/garden-service/src/commands/run/service.ts index e09eaf11b7..8612752a14 100644 --- a/garden-service/src/commands/run/service.ts +++ b/garden-service/src/commands/run/service.ts @@ -71,7 +71,7 @@ export class RunServiceCommand extends Command { printRuntimeContext(garden, runtimeContext) - const result = await garden.actions.runService({ service, runtimeContext, silent: false, interactive: true }) + const result = await garden.actions.runService({ service, runtimeContext, interactive: true }) return { result } } diff --git a/garden-service/src/plugins/google/common.ts b/garden-service/src/plugins/google/common.ts index df63ace505..76775eb791 100644 --- a/garden-service/src/plugins/google/common.ts +++ b/garden-service/src/plugins/google/common.ts @@ -84,7 +84,7 @@ export async function prepareEnvironment({ status, logEntry }: PrepareEnvironmen section: "google-cloud-functions", msg: `Initializing SDK...`, }) - await gcloud().tty(["init"], { silent: false }) + await gcloud().call(["init"], { timeout: 600, tty: true }) } return {} diff --git a/garden-service/src/plugins/google/gcloud.ts b/garden-service/src/plugins/google/gcloud.ts index 4aac80133c..345d6e75ee 100644 --- a/garden-service/src/plugins/google/gcloud.ts +++ b/garden-service/src/plugins/google/gcloud.ts @@ -6,9 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import * as spawn from "cross-spawn" -import { extend } from "lodash" -import { spawnPty } from "../../util/util" +import { spawn, SpawnOpts } from "../../util/util" export interface GCloudParams { data?: Buffer, @@ -37,67 +35,10 @@ export class GCloud { this.project = project } - async call( - args: string[], - { data, ignoreError = false, silent = true, timeout = DEFAULT_TIMEOUT, cwd }: GCloudParams = {}, - ): Promise { - - const out: GCloudOutput = { - code: 0, - output: "", - stdout: "", - stderr: "", - } - - const proc = spawn("gcloud", this.prepareArgs(args), { cwd }) - - proc.stdout.on("data", (s) => { - if (!silent) { - process.stdout.write(s) - } - out.output += s - out.stdout! += s - }) - - proc.stderr.on("data", (s) => { - if (!silent) { - process.stderr.write(s) - } - out.output += s - out.stderr! += s - }) - - if (data) { - proc.stdin.end(data) - } - - return new Promise((resolve, reject) => { - let _timeout - - const _reject = (msg: string) => { - const err = new Error(msg) - extend(err, out) - reject(err) - } - - if (timeout > 0) { - _timeout = setTimeout(() => { - proc.kill("SIGKILL") - _reject(`gcloud timed out after ${timeout} seconds.`) - }, timeout * 1000) - } - - proc.on("close", (code) => { - _timeout && clearTimeout(_timeout) - out.code = code - - if (code === 0 || ignoreError) { - resolve(out) - } else { - _reject("Process exited with code " + code) - } - }) - }) + async call(args: string[], opts: SpawnOpts = {}): Promise { + const { data, ignoreError = false, timeout = DEFAULT_TIMEOUT } = opts + const preparedArgs = this.prepareArgs(args) + return spawn("gcloud", preparedArgs, { ignoreError, data, timeout }) } async json(args: string[], opts: GCloudParams = {}): Promise { @@ -110,10 +51,6 @@ export class GCloud { return JSON.parse(result.output) } - async tty(args: string[], { silent = true, cwd }: { silent?: boolean, cwd?: string } = {}): Promise { - return spawnPty("gcloud", this.prepareArgs(args), { silent, cwd, tty: true }) - } - private prepareArgs(args: string[]) { const ops: string[] = [] diff --git a/garden-service/src/plugins/kubernetes/actions.ts b/garden-service/src/plugins/kubernetes/actions.ts index ed28a3cd81..b3e29e605e 100644 --- a/garden-service/src/plugins/kubernetes/actions.ts +++ b/garden-service/src/plugins/kubernetes/actions.ts @@ -90,7 +90,7 @@ export async function getServiceOutputs({ service }: GetServiceOutputsParams) { - const { ctx, service, command } = params + const { ctx, service, command, interactive } = params const api = new KubeApi(ctx.provider) const status = await getContainerServiceStatus(params) const namespace = await getAppNamespace(ctx, ctx.provider) @@ -123,12 +123,11 @@ export async function execInService(params: ExecInServiceParams } // exec in the pod via kubectl - const kubecmd = ["exec", "-it", pod.metadata.name, "--", ...command] - const res = await kubectl(api.context, namespace).tty(kubecmd, { + const kubecmd = ["exec", "-i", pod.metadata.name, "--", ...command] + const res = await kubectl(api.context, namespace).call(kubecmd, { ignoreError: true, - silent: false, timeout: 999999, - tty: true, + tty: interactive, }) return { code: res.code, output: res.output } @@ -170,7 +169,7 @@ export async function hotReload( } export async function runModule( - { ctx, module, command, interactive, runtimeContext, silent, timeout }: RunModuleParams, + { ctx, module, command, interactive, runtimeContext, timeout }: RunModuleParams, ): Promise { const context = ctx.provider.config.context const namespace = await getAppNamespace(ctx, ctx.provider) @@ -185,7 +184,6 @@ export async function runModule( `--image=${image}`, "--restart=Never", "--command", - "--tty", "--rm", "-i", "--quiet", @@ -203,9 +201,8 @@ export async function runModule( const startedAt = new Date() - const res = await kubectl(context, namespace).tty(kubecmd, { + const res = await kubectl(context, namespace).call(kubecmd, { ignoreError: true, - silent: !interactive || silent, // shouldn't be silent in interactive mode timeout, tty: interactive, }) @@ -222,7 +219,7 @@ export async function runModule( } export async function runService( - { ctx, service, interactive, runtimeContext, silent, timeout, logEntry, buildDependencies }: + { ctx, service, interactive, runtimeContext, timeout, logEntry, buildDependencies }: RunServiceParams, ) { return runModule({ @@ -231,7 +228,6 @@ export async function runService( command: service.spec.command || [], interactive, runtimeContext, - silent, timeout, logEntry, buildDependencies, @@ -239,7 +235,7 @@ export async function runService( } export async function testModule( - { ctx, interactive, module, runtimeContext, silent, testConfig, logEntry, buildDependencies }: + { ctx, interactive, module, runtimeContext, testConfig, logEntry, buildDependencies }: TestModuleParams, ): Promise { const testName = testConfig.name @@ -253,7 +249,6 @@ export async function testModule( command, interactive, runtimeContext, - silent, timeout, logEntry, buildDependencies, diff --git a/garden-service/src/plugins/kubernetes/kubectl.ts b/garden-service/src/plugins/kubernetes/kubectl.ts index ae322055be..76d47bc167 100644 --- a/garden-service/src/plugins/kubernetes/kubectl.ts +++ b/garden-service/src/plugins/kubernetes/kubectl.ts @@ -6,30 +6,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import chalk from "chalk" import { ChildProcess } from "child_process" -import * as spawn from "cross-spawn" -import { extend } from "lodash" -import { encodeYamlMulti, spawnPty } from "../../util/util" -import { RuntimeError } from "../../exceptions" -import { getLogger } from "../../logger/logger" -import { platform } from "os" -import hasAnsi = require("has-ansi") - -export interface KubectlParams { - data?: Buffer, - ignoreError?: boolean, - silent?: boolean, - timeout?: number, - tty?: boolean, -} - -export interface KubectlOutput { - code: number, - output: string, - stdout?: string, - stderr?: string, -} +import * as _spawn from "cross-spawn" +import { encodeYamlMulti, spawn, SpawnOpts } from "../../util/util" export interface ApplyOptions { dryRun?: boolean, @@ -52,79 +31,13 @@ export class Kubectl { this.configPath = configPath } - async call( - args: string[], - { data, ignoreError = false, silent = true, timeout = KUBECTL_DEFAULT_TIMEOUT }: KubectlParams = {}, - ): Promise { - // TODO: use the spawn helper from index.ts - const logger = getLogger() - const out: KubectlOutput = { - code: 0, - output: "", - stdout: "", - stderr: "", - } - - const preparedArgs = this.prepareArgs(args) - const proc = spawn(this.getExececutable(), preparedArgs) - - proc.stdout.on("data", (s) => { - if (!silent) { - const str = s.toString() - logger.info(hasAnsi(str) ? str : chalk.white(str)) - } - out.output += s - out.stdout! += s - }) - - proc.stderr.on("data", (s) => { - if (!silent) { - const str = s.toString() - logger.info(hasAnsi(str) ? str : chalk.white(str)) - } - out.output += s - out.stderr! += s - }) - - if (data) { - proc.stdin.end(data) - } - - return new Promise((resolve, reject) => { - let _timeout - - const _reject = (msg: string) => { - const dataStr = data ? data.toString() : null - const details = extend({ args, preparedArgs, msg, data: dataStr }, out) - - const err = new RuntimeError( - `Failed running 'kubectl ${preparedArgs.join(" ")}': ${out.output}`, - details, - ) - reject(err) - } - - if (timeout > 0) { - _timeout = setTimeout(() => { - proc.kill("SIGKILL") - _reject(`kubectl timed out after ${timeout} seconds.`) - }, timeout * 1000) - } - - proc.on("close", (code) => { - _timeout && clearTimeout(_timeout) - out.code = code - - if (code === 0 || ignoreError) { - resolve(out) - } else { - _reject("Process exited with code " + code) - } - }) - }) + async call(args: string[], opts: SpawnOpts = {}) { + const { data, ignoreError = false, timeout = KUBECTL_DEFAULT_TIMEOUT } = opts + const preparedArgs = this.prepareArgs(args, opts) + return spawn("kubectl", preparedArgs, { ignoreError, data, timeout }) } - async json(args: string[], opts: KubectlParams = {}): Promise { + async json(args: string[], opts: SpawnOpts = {}): Promise { if (!args.includes("--output=json")) { args.push("--output=json") } @@ -134,20 +47,11 @@ export class Kubectl { return JSON.parse(result.output) } - async tty(args: string[], opts: KubectlParams = {}): Promise { - return spawnPty(this.getExececutable(), this.prepareArgs(args), opts) - } - spawn(args: string[]): ChildProcess { - return spawn(this.getExececutable(), this.prepareArgs(args)) - } - - private getExececutable() { - // workaround for https://github.com/Microsoft/node-pty/issues/109 - return platform() === "win32" ? "kubectl.exe" : "kubectl" + return _spawn("kubectl", this.prepareArgs(args, {})) } - private prepareArgs(args: string[]) { + private prepareArgs(args: string[], { tty }: SpawnOpts) { const ops: string[] = [] if (this.namespace) { @@ -162,6 +66,10 @@ export class Kubectl { ops.push(`--kubeconfig=${this.configPath}`) } + if (tty) { + ops.push("--tty") + } + return ops.concat(args) } } diff --git a/garden-service/src/types/plugin/params.ts b/garden-service/src/types/plugin/params.ts index d5711c30e6..9b1f8c3053 100644 --- a/garden-service/src/types/plugin/params.ts +++ b/garden-service/src/types/plugin/params.ts @@ -157,7 +157,6 @@ export interface RunModuleParams extends PluginModule command: string[] interactive: boolean runtimeContext: RuntimeContext - silent: boolean timeout?: number } const runBaseParams = { @@ -242,12 +241,14 @@ export const getServiceOutputsParamsSchema = serviceActionParamsSchema export interface ExecInServiceParams extends PluginServiceActionParamsBase { command: string[] runtimeContext: RuntimeContext + interactive: boolean } export const execInServiceParamsSchema = serviceActionParamsSchema .keys({ command: joiArray(Joi.string()) .description("The command to run alongside the service."), runtimeContext: runtimeContextSchema, + interactive: Joi.boolean(), }) export interface GetServiceLogsParams extends PluginServiceActionParamsBase { @@ -271,7 +272,6 @@ export const getServiceLogsParamsSchema = serviceActionParamsSchema export interface RunServiceParams extends PluginServiceActionParamsBase { interactive: boolean runtimeContext: RuntimeContext - silent: boolean timeout?: number } export const runServiceParamsSchema = serviceActionParamsSchema diff --git a/garden-service/src/util/util.ts b/garden-service/src/util/util.ts index f098152e82..803a7dabb3 100644 --- a/garden-service/src/util/util.ts +++ b/garden-service/src/util/util.ts @@ -8,7 +8,6 @@ import Bluebird = require("bluebird") import { ResolvableProps } from "bluebird" -const pty = require("node-pty-prebuilt") import * as exitHook from "async-exit-hook" import * as klaw from "klaw" import * as yaml from "js-yaml" @@ -17,12 +16,10 @@ import * as _spawn from "cross-spawn" import { pathExists, readFile, writeFile } from "fs-extra" import { join, basename, win32, posix } from "path" import { find, pick, difference, fromPairs } from "lodash" -import { TimeoutError, ParameterError } from "../exceptions" -import { PassThrough } from "stream" +import { TimeoutError, ParameterError, RuntimeError, GardenError } from "../exceptions" import { isArray, isPlainObject, extend, mapValues, pickBy } from "lodash" import highlight from "cli-highlight" import chalk from "chalk" -import hasAnsi = require("has-ansi") import { safeDump } from "js-yaml" import { GARDEN_DIR_NAME } from "../constants" import { createHash } from "crypto" @@ -139,18 +136,13 @@ export async function sleep(msec) { return new Promise(resolve => setTimeout(resolve, msec)) } -export interface SpawnParams { +export interface SpawnOpts { timeout?: number cwd?: string data?: Buffer ignoreError?: boolean env?: { [key: string]: string | undefined } -} - -export interface SpawnPtyParams extends SpawnParams { - silent?: boolean tty?: boolean - bufferOutput?: boolean } export interface SpawnOutput { @@ -161,11 +153,11 @@ export interface SpawnOutput { proc: any } -export function spawn( - cmd: string, args: string[], - { timeout = 0, cwd, data, ignoreError = false, env }: SpawnParams = {}, -) { - const proc = _spawn(cmd, args, { cwd, env }) +export function spawn(cmd: string, args: string[], opts: SpawnOpts = {}) { + const { timeout = 0, cwd, data, ignoreError = false, env, tty } = opts + + const stdio = tty ? "inherit" : "pipe" + const proc = _spawn(cmd, args, { cwd, env, stdio }) const result: SpawnOutput = { code: 0, @@ -175,130 +167,57 @@ export function spawn( proc, } - proc.stdout.on("data", (s) => { - result.output += s - result.stdout! += s - }) - - proc.stderr.on("data", (s) => { - result.output += s - result.stderr! += s - }) - - if (data) { - proc.stdin.end(data) - } - - return new Promise((resolve, reject) => { - let _timeout + let _process = process - const _reject = (msg: string) => { - const err = new Error(msg) - extend(err, result) - reject(err) + if (tty) { + if (data) { + throw new ParameterError(`Cannot pipe to stdin when tty=true`, { cmd, args, opts }) } - if (timeout > 0) { - _timeout = setTimeout(() => { - proc.kill("SIGKILL") - _reject(`kubectl timed out after ${timeout} seconds.`) - }, timeout * 1000) - } + _process.stdin.setEncoding("utf8") - proc.on("close", (code) => { - _timeout && clearTimeout(_timeout) - result.code = code + // raw mode is not available if we're running without a TTY + _process.stdin.setRawMode && _process.stdin.setRawMode(true) - if (code === 0 || ignoreError) { - resolve(result) - } else { - _reject("Process exited with code " + code) - } + } else { + proc.stdout.on("data", (s) => { + result.output += s + result.stdout! += s }) - }) -} - -export function spawnPty( - cmd: string, args: string[], - { - silent = false, tty = false, timeout = 0, cwd, - bufferOutput = true, data, ignoreError = false, - }: SpawnPtyParams = {}, -): Bluebird { - let _process = process - - let proc: any = pty.spawn(cmd, args, { - cwd, - name: "xterm-color", - cols: _process.stdout.columns, - rows: _process.stdout.rows, - }) - - _process.stdin.setEncoding("utf8") - - // raw mode is not available if we're running without a TTY - tty && _process.stdin.setRawMode && _process.stdin.setRawMode(true) - - const result: SpawnOutput = { - code: 0, - output: "", - proc, - } - - proc.on("data", (output) => { - const str = output.toString() - if (bufferOutput) { - result.output += str - } + proc.stderr.on("data", (s) => { + result.output += s + result.stderr! += s + }) - if (!silent) { - process.stdout.write(hasAnsi(str) ? str : chalk.white(str)) + if (data) { + proc.stdin.end(data) } - }) - - if (data) { - const bufferStream = new PassThrough() - bufferStream.end(data + "\n\0") - bufferStream.pipe(proc) - proc.end() } - if (tty) { - process.stdin.pipe(proc) - } - - return new Bluebird((resolve, _reject) => { + return new Promise((resolve, reject) => { let _timeout - const reject = (err: any) => { - err.output = result.output - err.proc = result.proc - console.log(err.output) - _reject(err) + const _reject = (err: GardenError) => { + extend(err.detail, result) + reject(err) } if (timeout > 0) { _timeout = setTimeout(() => { proc.kill("SIGKILL") - const err = new TimeoutError(`${cmd} command timed out after ${timeout} seconds.`, { cmd, timeout }) - reject(err) + _reject(new TimeoutError(`${cmd} timed out after ${timeout} seconds.`, { cmd, args, opts })) }, timeout * 1000) } - proc.on("exit", (code) => { + proc.on("close", (code) => { _timeout && clearTimeout(_timeout) - - // make sure raw input is decoupled - tty && _process.stdin.setRawMode && _process.stdin.setRawMode(false) result.code = code if (code === 0 || ignoreError) { resolve(result) } else { - const err: any = new Error("Process exited with code " + code) - err.code = code - reject(err) + _reject(new RuntimeError(`${cmd} exited with code ${code}`, { cmd, args, opts })) } }) }) diff --git a/garden-service/test/helpers.ts b/garden-service/test/helpers.ts index 102b0ea0ba..1a6e08c7fe 100644 --- a/garden-service/test/helpers.ts +++ b/garden-service/test/helpers.ts @@ -139,7 +139,7 @@ export const testPlugin: PluginFactory = (): GardenPlugin => { runModule, async runService( - { ctx, service, interactive, runtimeContext, silent, timeout, buildDependencies }: RunServiceParams, + { ctx, service, interactive, runtimeContext, timeout, buildDependencies }: RunServiceParams, ) { return runModule({ ctx, @@ -147,7 +147,6 @@ export const testPlugin: PluginFactory = (): GardenPlugin => { command: [service.name], interactive, runtimeContext, - silent, timeout, buildDependencies, }) diff --git a/garden-service/test/src/actions.ts b/garden-service/test/src/actions.ts index 02c854939c..469f5e8348 100644 --- a/garden-service/test/src/actions.ts +++ b/garden-service/test/src/actions.ts @@ -176,7 +176,6 @@ describe("ActionHelper", () => { envVars: { FOO: "bar" }, dependencies: {}, }, - silent: false, }) expect(result).to.eql({ moduleName: module.name, @@ -272,7 +271,7 @@ describe("ActionHelper", () => { describe("execInService", () => { it("should correctly call the corresponding plugin handler", async () => { - const result = await actions.execInService({ service, command: ["foo"] }) + const result = await actions.execInService({ service, command: ["foo"], interactive: false }) expect(result).to.eql({ code: 0, output: "bla bla" }) }) }) @@ -294,7 +293,6 @@ describe("ActionHelper", () => { envVars: { FOO: "bar" }, dependencies: {}, }, - silent: false, }) expect(result).to.eql({ moduleName: service.module.name,