Comparing version 3.3.5 to 3.4.0
{ | ||
"name": "devlab", | ||
"version": "3.3.5", | ||
"version": "3.4.0", | ||
"description": "Node utility for running containerized tasks", | ||
@@ -54,2 +54,3 @@ "keywords": [ | ||
"nodemon": "^1.11.0", | ||
"proxyquire": "^1.7.11", | ||
"sinon": "^1.17.0", | ||
@@ -67,2 +68,3 @@ "sinon-chai": "^2.8.0", | ||
"ora": "^0.3.0", | ||
"os-tmpdir": "^1.0.2", | ||
"shortid": "^2.2.6" | ||
@@ -83,5 +85,6 @@ }, | ||
"sinon", | ||
"cwd" | ||
"cwd", | ||
"proxyquire" | ||
] | ||
} | ||
} |
@@ -28,2 +28,4 @@ [![CircleCI branch](https://img.shields.io/circleci/project/TechnologyAdvice/DevLab/master.svg?maxAge=2592000)]() | ||
**Important Note**: In order to run the tasks, Devlab creates a temp file (`devlab.sh`). The tool will do its best to determine the best location (usually `/tmp`), but this can be explicitly set by specifying the environment variable `DEVLAB_TMP`. | ||
## Usage | ||
@@ -30,0 +32,0 @@ |
@@ -99,9 +99,10 @@ 'use strict' | ||
* @param {string} name Container name | ||
* @param {string} tmpdir Path to temp execution file | ||
* @param {boolean} primary If this is primary, i.e. not a service container | ||
* @returns {object|array} Arguments for docker command | ||
*/ | ||
get: (cfg, name, primary = false) => { | ||
get: (cfg, name, tmpdir, primary = false) => { | ||
if (!cfg.from) throw new Error('Missing \'from\' property in config or argument') | ||
const cwd = process.cwd() | ||
let args = primary ? [ 'run', '--rm', '-it', '-v', `${cwd}:${cwd}`, '-w', cwd, '--privileged' ] : [ 'run', '-d', '--privileged' ] | ||
let args = primary ? [ 'run', '--rm', '-it', '-v', `${cwd}:${cwd}`, '-v', `${tmpdir}:${tmpdir}`, '-w', cwd, '--privileged' ] : [ 'run', '-d', '--privileged' ] | ||
args = args.concat(_.flatten([ | ||
@@ -112,3 +113,3 @@ command.getArgs(cfg), | ||
cfg.from, | ||
primary ? [ 'sh', 'devlab.sh' ] : [] | ||
primary ? [ 'sh', `${tmpdir}/devlab.sh` ] : [] | ||
])) | ||
@@ -115,0 +116,0 @@ return primary ? { args, cmd: command.getExec(cfg) } : args |
@@ -5,3 +5,3 @@ 'use strict' | ||
const Promise = require('bluebird') | ||
const fs = require('fs') | ||
const fs = Promise.promisifyAll(require('fs')) | ||
const args = require('./args') | ||
@@ -15,3 +15,3 @@ const config = require('./config') | ||
Promise.promisifyAll(fs) | ||
const tmpdir = require('./tempdir')() | ||
@@ -32,3 +32,3 @@ global.instanceId = require('shortid').generate() | ||
const cfg = services.filterEnabled(_.merge(config.load(args.parse().configPath), args.parse())) | ||
return { services: services.get(cfg), primary: command.get(cfg, 'primary', true) } | ||
return { services: services.get(cfg), primary: command.get(cfg, 'primary', tmpdir, true) } | ||
}, | ||
@@ -85,15 +85,14 @@ /** | ||
// Write the primary command to tmp script | ||
return fs.writeFileAsync(`${process.cwd()}/devlab.sh`, cfg.primary.cmd) | ||
return fs.writeFileAsync(`${tmpdir}/devlab.sh`, cfg.primary.cmd) | ||
.then(() => utils.checkOrphans()) | ||
.then(() => instance.startServices(cfg)) | ||
.then(instance.runCommand) | ||
.then(() => fs.unlinkAsync(`${process.cwd()}/devlab.sh`)) | ||
.then(services.stop) | ||
}).catch((e) => { | ||
services.stop() | ||
output.error(e.message || 'Process failed') | ||
throw new Error('Process failed') | ||
}) | ||
.catch((e) => { | ||
services.stop() | ||
output.error(e.message || 'Process failed') | ||
throw new Error('Process failed') | ||
}) | ||
} | ||
module.exports = instance |
@@ -51,3 +51,3 @@ 'use strict' | ||
persist: value.persist || false, | ||
args: command.get(value, name) | ||
args: command.get(value, name, null) | ||
})]), cfg.services), | ||
@@ -54,0 +54,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31436
13
600
207
9
12
10
+ Addedos-tmpdir@^1.0.2
+ Addedos-tmpdir@1.0.2(transitive)