codefresh 0.82.7 → 0.82.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/content/pipelines/Run Pipeline.md +30 -8
- package/lib/interface/cli/commands/pipeline/pipeline.sdk.spec.js +76 -6
- package/lib/interface/cli/commands/pipeline/run.base.js +7 -5
- package/lib/interface/cli/commands/pipeline/run.cmd.js +9 -2
- package/lib/interface/cli/commands/pipeline/var.json +12 -0
- package/lib/interface/cli/commands/pipeline/var.yml +5 -0
- package/lib/interface/cli/commands/project/apply.cmd.js +3 -10
- package/lib/interface/cli/commands/project/create.cmd.js +3 -12
- package/lib/interface/cli/completion/tree.json +1 -1
- package/lib/interface/cli/helpers/general.js +50 -9
- package/package.json +2 -2
|
@@ -15,22 +15,44 @@ The pipeline will be triggered multiple times according to the array length.
|
|
|
15
15
|
|
|
16
16
|
#### Variable yaml file with 2 sets of variables
|
|
17
17
|
```yaml
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
18
|
+
- VARIABLE_A: value_a_for_the_first_build
|
|
19
|
+
VARIABLE_B: value_b_for_the_first_build
|
|
20
|
+
- VARIABLE_A: value_a_for_the_first_build
|
|
21
|
+
VARIABLE_B: value_b_for_the_first_build
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
#### Variable json file with 2 sets of variables
|
|
25
25
|
```json
|
|
26
26
|
[
|
|
27
27
|
{
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"VARIABLE_A": "value_a_for_the_first_build",
|
|
29
|
+
"VARIABLE_B": "value_b_for_the_first_build"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"VARIABLE_A": "value_a_for_the_first_build",
|
|
33
|
+
"VARIABLE_B": "value_b_for_the_first_build"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
```
|
|
37
|
+
### Use encrypted variables in Codefresh build runs; supported from CLI version: 0.82.8
|
|
38
|
+
#### Variable yaml file with single variable set with encrypted variables
|
|
39
|
+
```yaml
|
|
40
|
+
- key:
|
|
41
|
+
val: value
|
|
42
|
+
encrypted: true
|
|
43
|
+
key2: key1
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Variable json file single variable set with encrypted variables
|
|
48
|
+
```json
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
"key": {
|
|
52
|
+
"val": "value",
|
|
53
|
+
"encrypted": true
|
|
54
|
+
},
|
|
55
|
+
"key2": "key1"
|
|
34
56
|
}
|
|
35
57
|
]
|
|
36
58
|
```
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const yaml = require('js-yaml');
|
|
2
|
+
const request = require('requestretry');
|
|
3
|
+
const fs = require('fs');
|
|
1
4
|
const DEFAULTS = require('../../defaults');
|
|
2
5
|
const getCmd = require('./get.cmd').toCommand();
|
|
3
6
|
const deleteCmd = require('./delete.cmd').toCommand();
|
|
@@ -10,18 +13,16 @@ jest.mock('../../helpers/validation'); // eslint-disable-line
|
|
|
10
13
|
jest.mock('../../../../../check-version');
|
|
11
14
|
jest.mock('../../completion/helpers', () => { // eslint-disable-line
|
|
12
15
|
return {
|
|
13
|
-
authContextWrapper: func => func,
|
|
16
|
+
authContextWrapper: (func) => func,
|
|
14
17
|
};
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
jest.mock('../../../../logic/entities/Pipeline', () => { // eslint-disable-line
|
|
18
21
|
return {
|
|
19
|
-
fromResponse: res => res,
|
|
22
|
+
fromResponse: (res) => res,
|
|
20
23
|
};
|
|
21
24
|
});
|
|
22
25
|
|
|
23
|
-
const request = require('requestretry');
|
|
24
|
-
|
|
25
26
|
const DEFAULT_RESPONSE = request.__defaultResponse();
|
|
26
27
|
|
|
27
28
|
describe('pipeline', () => {
|
|
@@ -57,11 +58,11 @@ describe('pipeline', () => {
|
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
it('should return default limit', async () => {
|
|
60
|
-
expect(_getLimit(undefined,false)).toEqual(DEFAULTS.GET_LIMIT_RESULTS);
|
|
61
|
+
expect(_getLimit(undefined, false)).toEqual(DEFAULTS.GET_LIMIT_RESULTS);
|
|
61
62
|
});
|
|
62
63
|
|
|
63
64
|
it('should return `unlimited` value', async () => {
|
|
64
|
-
expect(_getLimit(undefined,true)).toEqual(DEFAULTS.GET_ALL_PIPELINES_LIMIT);
|
|
65
|
+
expect(_getLimit(undefined, true)).toEqual(DEFAULTS.GET_ALL_PIPELINES_LIMIT);
|
|
65
66
|
});
|
|
66
67
|
});
|
|
67
68
|
|
|
@@ -84,6 +85,75 @@ describe('pipeline', () => {
|
|
|
84
85
|
});
|
|
85
86
|
});
|
|
86
87
|
|
|
88
|
+
describe('run', () => {
|
|
89
|
+
it('should handle running pipeline with encrypted variables', async () => {
|
|
90
|
+
const argv = { name: 'some name',
|
|
91
|
+
detach: true,
|
|
92
|
+
annotation: [],
|
|
93
|
+
variable:
|
|
94
|
+
[{
|
|
95
|
+
key: 'secret',
|
|
96
|
+
value: 'secret',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: 'VAR1',
|
|
100
|
+
value: 'VAL1',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
encrypted: ['secret'],
|
|
104
|
+
};
|
|
105
|
+
const pip = new CfPipeline(argv);
|
|
106
|
+
await pip.run();
|
|
107
|
+
expect(pip.executionRequests[0].options.variables).toEqual([
|
|
108
|
+
{
|
|
109
|
+
key: 'secret',
|
|
110
|
+
value: 'secret',
|
|
111
|
+
encrypted: true,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: 'VAR1',
|
|
115
|
+
value: 'VAL1',
|
|
116
|
+
},
|
|
117
|
+
]);
|
|
118
|
+
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should handle running pipeline with encrypted variables passing inside json file', async () => {
|
|
122
|
+
const rawFile = fs.readFileSync('lib/interface/cli/commands/pipeline/var.json', 'utf8');
|
|
123
|
+
|
|
124
|
+
const argv = { name: 'some name',
|
|
125
|
+
detach: true,
|
|
126
|
+
annotation: [],
|
|
127
|
+
'var-file': JSON.parse(rawFile),
|
|
128
|
+
};
|
|
129
|
+
const pip = new CfPipeline(argv);
|
|
130
|
+
await pip.run();
|
|
131
|
+
expect(pip.executionRequests[0].options.variables).toEqual(
|
|
132
|
+
[{ key: 'help6', value: '85858' },
|
|
133
|
+
{ key: 'should_be_encrepted', value: '0000' },
|
|
134
|
+
{ encrypted: true, key: 'help7', value: 'test' }],
|
|
135
|
+
);
|
|
136
|
+
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('should handle running pipeline with encrypted variables passing inside yaml file', async () => {
|
|
140
|
+
const rawFile = fs.readFileSync('lib/interface/cli/commands/pipeline/var.yml', 'utf8');
|
|
141
|
+
|
|
142
|
+
const argv = { name: 'some name',
|
|
143
|
+
detach: true,
|
|
144
|
+
annotation: [],
|
|
145
|
+
'var-file': yaml.safeLoad(rawFile),
|
|
146
|
+
};
|
|
147
|
+
const pip = new CfPipeline(argv);
|
|
148
|
+
await pip.run();
|
|
149
|
+
expect(pip.executionRequests[0].options.variables).toEqual(
|
|
150
|
+
[{ key: 'VAR1', value: 'VAL1' },
|
|
151
|
+
{ encrypted: true, key: 'VAR2', value: 'VAL2' }],
|
|
152
|
+
);
|
|
153
|
+
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
87
157
|
describe('runImpl', () => {
|
|
88
158
|
it('should handle running pipeline', async () => {
|
|
89
159
|
const argv = { name: 'some name', detach: true };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
2
|
const Promise = require('bluebird');
|
|
3
|
-
const
|
|
3
|
+
const CFError = require('cf-errors');
|
|
4
|
+
const { prepareKeyValueFromCLIEnvOption,
|
|
5
|
+
markEncryptedFlagOnRequestedVariables,
|
|
6
|
+
prepareKeyValueObjectsFromEnvFileOption } = require('../../helpers/general');
|
|
4
7
|
const { validatePipelineYaml } = require('../../helpers/validation');
|
|
5
8
|
const { printResult } = require('../root/validate.cmd');
|
|
6
|
-
const CFError = require('cf-errors');
|
|
7
9
|
const { sdk } = require('../../../../logic');
|
|
8
10
|
|
|
9
11
|
class RunBaseCommand {
|
|
@@ -59,18 +61,18 @@ class RunBaseCommand {
|
|
|
59
61
|
if (variablesFromFile) {
|
|
60
62
|
_.forEach(variablesFromFile, (variables) => {
|
|
61
63
|
const request = _.cloneDeep(executionRequestTemplate);
|
|
62
|
-
request.options.variables = variables;
|
|
64
|
+
request.options.variables = prepareKeyValueObjectsFromEnvFileOption(variables);
|
|
63
65
|
this.executionRequests.push(request);
|
|
64
66
|
});
|
|
65
67
|
} else {
|
|
66
|
-
const variables =
|
|
68
|
+
const variables = markEncryptedFlagOnRequestedVariables(this.argv.variable, this.argv.encrypted);
|
|
67
69
|
const request = _.cloneDeep(executionRequestTemplate);
|
|
68
70
|
request.options.variables = variables;
|
|
69
71
|
request.options.contexts = contexts;
|
|
70
72
|
this.executionRequests.push(request);
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
const results = await Promise.all(this.executionRequests.map(request => this.runImpl(request)));
|
|
75
|
+
const results = await Promise.all(this.executionRequests.map((request) => this.runImpl(request)));
|
|
74
76
|
const findMaxReducer = (accumulator, currentValue) => (currentValue > accumulator ? currentValue : accumulator);
|
|
75
77
|
const exitCode = results.reduce(findMaxReducer);
|
|
76
78
|
await this.postRunRequest();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const debug = require('debug')('codefresh:cli:run:pipeline');
|
|
2
1
|
const Command = require('../../Command');
|
|
3
|
-
const { crudFilenameOption } = require('../../helpers/general');
|
|
2
|
+
const { crudFilenameOption, prepareKeyValueObjectsFromCLIEnvOption } = require('../../helpers/general');
|
|
4
3
|
const RunLocalCommand = require('./run.local');
|
|
5
4
|
const RunExternalCommand = require('./run.cf');
|
|
6
5
|
|
|
@@ -85,6 +84,13 @@ const run = new Command({
|
|
|
85
84
|
describe: 'Set build variables',
|
|
86
85
|
default: [],
|
|
87
86
|
alias: 'v',
|
|
87
|
+
coerce: prepareKeyValueObjectsFromCLIEnvOption,
|
|
88
|
+
})
|
|
89
|
+
.option('encrypted', {
|
|
90
|
+
array: true,
|
|
91
|
+
alias: 'e',
|
|
92
|
+
describe: 'Variable names to encrypt',
|
|
93
|
+
default: [],
|
|
88
94
|
})
|
|
89
95
|
.option('detach', {
|
|
90
96
|
alias: 'd',
|
|
@@ -126,6 +132,7 @@ const run = new Command({
|
|
|
126
132
|
.example('codefresh run PIPELINE_ID | PIPELINE_NAME -b=master', 'Defining the source control context using a branch')
|
|
127
133
|
.example('codefresh run PIPELINE_ID | PIPELINE_NAME -s=52b992e783d2f84dd0123c70ac8623b4f0f938d1', 'Defining the source control context using a commit')
|
|
128
134
|
.example('codefresh run PIPELINE_ID | PIPELINE_NAME -b=master -v key1=value1 -v key2=value2', 'Setting variables through the command')
|
|
135
|
+
.example('codefresh run PIPELINE_ID | PIPELINE_NAME -b=master -v key1=value1 -v key2=value2 -e key1', 'Setting variables through the command with encrypted option')
|
|
129
136
|
.example('codefresh run PIPELINE_ID | PIPELINE_NAME -b=master --var-file ./var_file.yml', 'Settings variables through a yml file')
|
|
130
137
|
.example('codefresh run PIPELINE_ID | PIPELINE_NAME -b=master --context context', 'Inject contexts to the pipeline execution')
|
|
131
138
|
.example('codefresh run PIPELINE_ID | PIPELINE_NAME --skip step1 step2 step3', 'Skip specific steps');
|
|
@@ -4,7 +4,7 @@ const _ = require('lodash');
|
|
|
4
4
|
const { sdk } = require('../../../../logic');
|
|
5
5
|
|
|
6
6
|
const applyRoot = require('../root/apply.cmd');
|
|
7
|
-
const { prepareKeyValueObjectsFromCLIEnvOption, ignoreHttpError } = require('../../helpers/general');
|
|
7
|
+
const { prepareKeyValueObjectsFromCLIEnvOption, ignoreHttpError, markEncryptedFlagOnRequestedVariables } = require('../../helpers/general');
|
|
8
8
|
|
|
9
9
|
const command = new Command({
|
|
10
10
|
command: 'project [id|name]',
|
|
@@ -61,14 +61,7 @@ const command = new Command({
|
|
|
61
61
|
encrypted,
|
|
62
62
|
} = argv;
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
_.forEach(encrypted, (varName) => {
|
|
66
|
-
const variable = variableMap[varName];
|
|
67
|
-
if (!variable) {
|
|
68
|
-
throw new CFError(`Variable is not provided: "${varName}"`);
|
|
69
|
-
}
|
|
70
|
-
variable.encrypted = true;
|
|
71
|
-
});
|
|
64
|
+
const requestedProjectVariables = markEncryptedFlagOnRequestedVariables(variables, encrypted);
|
|
72
65
|
|
|
73
66
|
let project = await sdk.projects.get({ id }).catch(ignoreHttpError);
|
|
74
67
|
project = project || await sdk.projects.getByName({ name }).catch(ignoreHttpError);
|
|
@@ -81,7 +74,7 @@ const command = new Command({
|
|
|
81
74
|
const updatePayload = _.pickBy({
|
|
82
75
|
projectName,
|
|
83
76
|
tags: tags || existingTags,
|
|
84
|
-
variables:
|
|
77
|
+
variables: requestedProjectVariables || existingVariables,
|
|
85
78
|
}, _.identity);
|
|
86
79
|
|
|
87
80
|
await sdk.projects.patch({ id: project.id }, updatePayload);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const Command = require('../../Command');
|
|
2
|
-
const CFError = require('cf-errors');
|
|
3
|
-
const _ = require('lodash');
|
|
4
2
|
const { sdk } = require('../../../../logic');
|
|
5
3
|
const createRoot = require('../root/create.cmd');
|
|
6
4
|
const { checkOrProjectExists } = require('../../helpers/validation');
|
|
7
|
-
const { prepareKeyValueObjectsFromCLIEnvOption } = require('../../helpers/general');
|
|
5
|
+
const { prepareKeyValueObjectsFromCLIEnvOption, markEncryptedFlagOnRequestedVariables } = require('../../helpers/general');
|
|
8
6
|
|
|
9
7
|
const command = new Command({
|
|
10
8
|
command: 'project <name>',
|
|
@@ -52,17 +50,10 @@ const command = new Command({
|
|
|
52
50
|
encrypted,
|
|
53
51
|
} = argv;
|
|
54
52
|
|
|
55
|
-
const
|
|
56
|
-
_.forEach(encrypted, (varName) => {
|
|
57
|
-
const variable = variableMap[varName];
|
|
58
|
-
if (!variable) {
|
|
59
|
-
throw new CFError(`Variable is not provided: "${varName}"`);
|
|
60
|
-
}
|
|
61
|
-
variable.encrypted = true;
|
|
62
|
-
});
|
|
53
|
+
const requestedProjectVariables = markEncryptedFlagOnRequestedVariables(variables, encrypted);
|
|
63
54
|
|
|
64
55
|
await checkOrProjectExists(projectName);
|
|
65
|
-
await sdk.projects.create({ projectName, tags, variables });
|
|
56
|
+
await sdk.projects.create({ projectName, tags, variables: requestedProjectVariables });
|
|
66
57
|
console.log(`Project: "${projectName}" created`);
|
|
67
58
|
},
|
|
68
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"codefresh":{"analyze":{},"completion":{},"completions":{"alias":"completion"},"tag":{},"untag":{},"offline-logs":{"ensure-index":{},"offload-to-collection":{},"offload-to-file":{}},"run":{"__optionHandlers":["../commands/pipeline/run.completion.js"]},"add":{"repository":{},"repo":{"alias":"repository"}},"annotate":{"image":{},"img":{"alias":"image"}},"patch":{"__optionHandlers":["../commands/root/apply.completion.js"],"agent":{"__optionHandlers":["../commands/root/apply.completion.js"]},"board":{"__optionHandlers":["../commands/root/apply.completion.js"]},"project":{"__optionHandlers":["../commands/root/apply.completion.js"]},"section":{"__optionHandlers":["../commands/root/apply.completion.js"]},"runtime-environments":{"__optionHandlers":["../commands/root/apply.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"system-runtime-environments":{"__optionHandlers":["../commands/root/apply.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"},"teams":{"__optionHandlers":["../commands/root/apply.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"tokens":{"__optionHandlers":["../commands/root/apply.completion.js"]},"token":{"alias":"tokens"},"helm-repo":{"__optionHandlers":["../commands/root/apply.completion.js"]},"context":{"__optionHandlers":["../commands/root/apply.completion.js"]},"ctx":{"alias":"context"}},"auth":{"create-context":{},"current-context":{},"get-contexts":{},"use-context":{}},"components":{"download":{},"update":{}},"create":{"__optionHandlers":["../commands/root/create.completion.js"],"agent":{"__optionHandlers":["../commands/root/create.completion.js"]},"clusters":{"__optionHandlers":["../commands/root/create.completion.js"]},"cluster":{"alias":"clusters"},"annotation":{"__optionHandlers":["../commands/root/create.completion.js"]},"board":{"__optionHandlers":["../commands/root/create.completion.js"]},"composition":{"__optionHandlers":["../commands/composition/create.completion.js","../commands/root/create.completion.js"]},"com":{"alias":"composition"},"project":{"__optionHandlers":["../commands/root/create.completion.js"]},"section":{"__optionHandlers":["../commands/root/create.completion.js"]},"runtime-environments":{"__optionHandlers":["../commands/root/create.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"teams":{"__optionHandlers":["../commands/root/create.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"token":{"__optionHandlers":["../commands/root/create.completion.js"]},"helm-repo":{"__optionHandlers":["../commands/root/create.completion.js"]},"registry":{"__optionHandlers":["../commands/root/create.completion.js"],"standard":{"__optionHandlers":["../commands/root/create.completion.js"]}},"trigger":{"__optionHandlers":["../commands/root/create.completion.js"]},"t":{"alias":"trigger"},"trigger-event":{"__optionHandlers":["../commands/root/create.completion.js"]},"te":{"alias":"trigger-event"},"workflow-data-item":{"__optionHandlers":["../commands/root/create.completion.js"]},"wdi":{"alias":"workflow-data-item"},"context":{"__optionHandlers":["../commands/root/create.completion.js"],"config":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret-yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"git":{"__optionHandlers":["../commands/root/create.completion.js"],"bitbucket":{"__optionHandlers":["../commands/root/create.completion.js"]},"github":{"__optionHandlers":["../commands/root/create.completion.js"]},"gitlab":{"__optionHandlers":["../commands/root/create.completion.js"]},"stash":{"__optionHandlers":["../commands/root/create.completion.js"]}},"helm-repository":{"__optionHandlers":["../commands/root/create.completion.js"],"http":{"__optionHandlers":["../commands/root/create.completion.js"]},"s3":{"__optionHandlers":["../commands/root/create.completion.js"]}},"secret-store":{"__optionHandlers":["../commands/root/create.completion.js"],"hashicorp-vault":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes-runtime":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes":{"__optionHandlers":["../commands/root/create.completion.js"]}}},"ctx":{"alias":"context","config":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret-yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"git":{"__optionHandlers":["../commands/root/create.completion.js"],"bitbucket":{"__optionHandlers":["../commands/root/create.completion.js"]},"github":{"__optionHandlers":["../commands/root/create.completion.js"]},"gitlab":{"__optionHandlers":["../commands/root/create.completion.js"]},"stash":{"__optionHandlers":["../commands/root/create.completion.js"]}},"helm-repository":{"__optionHandlers":["../commands/root/create.completion.js"],"http":{"__optionHandlers":["../commands/root/create.completion.js"]},"s3":{"__optionHandlers":["../commands/root/create.completion.js"]}},"secret-store":{"__optionHandlers":["../commands/root/create.completion.js"],"hashicorp-vault":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes-runtime":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes":{"__optionHandlers":["../commands/root/create.completion.js"]}}}},"delete":{"__optionHandlers":["../commands/root/delete.completion.js"],"agent":{"__optionHandlers":["../commands/root/delete.completion.js"]},"annotation":{"__optionHandlers":["../commands/root/delete.completion.js"]},"board":{"__optionHandlers":["../commands/root/delete.completion.js"]},"cluster":{"__optionHandlers":["../commands/root/delete.completion.js"]},"clusters":{"alias":"cluster"},"composition":{"__optionHandlers":["../commands/root/delete.completion.js"]},"com":{"alias":"composition"},"environment":{"__optionHandlers":["../commands/root/delete.completion.js"]},"env":{"alias":"environment"},"pipeline":{"__optionHandlers":["../commands/root/delete.completion.js"]},"pip":{"alias":"pipeline"},"project":{"__optionHandlers":["../commands/root/delete.completion.js"]},"repository":{"__optionHandlers":["../commands/root/delete.completion.js"]},"repo":{"alias":"repository"},"section":{"__optionHandlers":["../commands/root/delete.completion.js"]},"step-type":{"__optionHandlers":["../commands/root/delete.completion.js"]},"runtime-environments":{"__optionHandlers":["../commands/root/delete.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"system-runtime-environments":{"__optionHandlers":["../commands/root/delete.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"},"teams":{"__optionHandlers":["../commands/root/delete.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"tokens":{"__optionHandlers":["../commands/root/delete.completion.js"]},"token":{"alias":"tokens"},"helm-repo":{"__optionHandlers":["../commands/root/delete.completion.js"]},"registry":{"__optionHandlers":["../commands/root/delete.completion.js"]},"trigger":{"__optionHandlers":["../commands/root/delete.completion.js"]},"t":{"alias":"trigger"},"trigger-event":{"__optionHandlers":["../commands/root/delete.completion.js"]},"te":{"alias":"trigger-event"},"context":{"__optionHandlers":["../commands/root/delete.completion.js"]},"ctx":{"alias":"context"}},"diff":{"__optionHandlers":["../commands/root/diff.completion.js"],"runtime-environments":{"__optionHandlers":["../commands/root/diff.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"system-runtime-environments":{"__optionHandlers":["../commands/root/diff.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"}},"download":{"audit":{}},"generate":{"image-pull-secret":{}},"get":{"__optionHandlers":["../commands/root/get.completion.js"],"agents":{"__optionHandlers":["../commands/root/get.completion.js"]},"agent":{"alias":"agents"},"annotation":{"__optionHandlers":["../commands/root/get.completion.js"]},"boards":{"__optionHandlers":["../commands/root/get.completion.js"]},"board":{"alias":"boards"},"clusters":{"__optionHandlers":["../commands/root/get.completion.js"]},"cluster":{"alias":"clusters"},"compositions":{"__optionHandlers":["../commands/root/get.completion.js"]},"com":{"alias":"compositions"},"composition":{"alias":"compositions"},"environments":{"__optionHandlers":["../commands/root/get.completion.js"]},"env":{"alias":"environments"},"environment":{"alias":"environments"},"images":{"__optionHandlers":["../commands/root/get.completion.js"]},"img":{"alias":"images"},"image":{"alias":"images"},"pipelines":{"__positionalHandler":"../commands/pipeline/get.completion.js","__optionHandlers":["../commands/root/get.completion.js"]},"pip":{"alias":"pipelines"},"pipeline":{"alias":"pipelines"},"projects":{"__optionHandlers":["../commands/root/get.completion.js"]},"project":{"alias":"projects"},"repository":{"__optionHandlers":["../commands/root/get.completion.js"]},"repo":{"alias":"repository"},"sections":{"__optionHandlers":["../commands/root/get.completion.js"]},"section":{"alias":"sections"},"step-types":{"__positionalHandler":"../commands/step/get.completion.js","__optionHandlers":["../commands/root/get.completion.js"]},"step-type":{"alias":"step-types"},"runtime-environments":{"__optionHandlers":["../commands/root/get.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"system-runtime-environments":{"__optionHandlers":["../commands/root/get.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"},"teams":{"__optionHandlers":["../commands/root/get.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"tokens":{"__optionHandlers":["../commands/root/get.completion.js"]},"token":{"alias":"tokens"},"helm-repo":{"__optionHandlers":["../commands/root/get.completion.js"]},"registry":{"__optionHandlers":["../commands/root/get.completion.js"]},"triggers":{"__optionHandlers":["../commands/root/get.completion.js"]},"trigger":{"alias":"triggers"},"t":{"alias":"triggers"},"trigger-events":{"__optionHandlers":["../commands/root/get.completion.js"]},"trigger-event":{"alias":"trigger-events"},"te":{"alias":"trigger-events"},"trigger-types":{"__optionHandlers":["../commands/root/get.completion.js"]},"trigger-type":{"alias":"trigger-types"},"tt":{"alias":"trigger-types"},"builds":{"__optionHandlers":["../commands/root/get.completion.js"]},"build":{"alias":"builds"},"workflow-data-item":{"__optionHandlers":["../commands/root/get.completion.js"]},"wdi":{"alias":"workflow-data-item"},"contexts":{"__optionHandlers":["../commands/root/get.completion.js"]},"ctx":{"alias":"contexts"},"context":{"alias":"contexts"}},"install":{"runtime":{},"agent":{},"app-proxy":{},"monitor":{},"gitops":{}},"replace":{"__optionHandlers":["../commands/root/replace.completion.js"],"composition":{"__optionHandlers":["../commands/composition/replace.completion.js","../commands/root/replace.completion.js"]},"com":{"alias":"composition"}},"runner":{"delete":{},"execute-test-pipeline":{},"info":{},"init":{},"upgrade":{}},"synchronize":{"teams":{},"team":{"alias":"teams"},"tm":{"alias":"teams"}},"uninstall":{"agent":{},"app-proxy":{},"runtime":{},"monitor":{},"gitops":{}},"upgrade":{"app-proxy":{},"gitops":{}},"validate":{"__positionalHandler":"../commands/root/validate.completion.js"},"version":{},"attach":{},"cli-config":{"get":{},"help":{},"profile":{},"set":{}},"set-helm-config":{},"install-chart":{},"helm-promotion":{},"delete-release":{},"rollback-release":{},"test-release":{},"approve":{},"deny":{},"logs":{},"restart":{},"terminate":{},"wait":{}}}
|
|
1
|
+
{"codefresh":{"analyze":{},"completion":{},"completions":{"alias":"completion"},"tag":{},"untag":{},"offline-logs":{"ensure-index":{},"offload-to-collection":{},"offload-to-file":{}},"run":{"__optionHandlers":["../commands/pipeline/run.completion.js"]},"add":{"repository":{},"repo":{"alias":"repository"}},"annotate":{"image":{},"img":{"alias":"image"}},"patch":{"__optionHandlers":["../commands/root/apply.completion.js"],"agent":{"__optionHandlers":["../commands/root/apply.completion.js"]},"board":{"__optionHandlers":["../commands/root/apply.completion.js"]},"project":{"__optionHandlers":["../commands/root/apply.completion.js"]},"runtime-environments":{"__optionHandlers":["../commands/root/apply.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"section":{"__optionHandlers":["../commands/root/apply.completion.js"]},"system-runtime-environments":{"__optionHandlers":["../commands/root/apply.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"},"teams":{"__optionHandlers":["../commands/root/apply.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"tokens":{"__optionHandlers":["../commands/root/apply.completion.js"]},"token":{"alias":"tokens"},"helm-repo":{"__optionHandlers":["../commands/root/apply.completion.js"]},"context":{"__optionHandlers":["../commands/root/apply.completion.js"]},"ctx":{"alias":"context"}},"auth":{"create-context":{},"current-context":{},"get-contexts":{},"use-context":{}},"components":{"download":{},"update":{}},"create":{"__optionHandlers":["../commands/root/create.completion.js"],"agent":{"__optionHandlers":["../commands/root/create.completion.js"]},"clusters":{"__optionHandlers":["../commands/root/create.completion.js"]},"cluster":{"alias":"clusters"},"annotation":{"__optionHandlers":["../commands/root/create.completion.js"]},"board":{"__optionHandlers":["../commands/root/create.completion.js"]},"composition":{"__optionHandlers":["../commands/composition/create.completion.js","../commands/root/create.completion.js"]},"com":{"alias":"composition"},"project":{"__optionHandlers":["../commands/root/create.completion.js"]},"runtime-environments":{"__optionHandlers":["../commands/root/create.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"section":{"__optionHandlers":["../commands/root/create.completion.js"]},"teams":{"__optionHandlers":["../commands/root/create.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"token":{"__optionHandlers":["../commands/root/create.completion.js"]},"helm-repo":{"__optionHandlers":["../commands/root/create.completion.js"]},"registry":{"__optionHandlers":["../commands/root/create.completion.js"],"standard":{"__optionHandlers":["../commands/root/create.completion.js"]}},"trigger":{"__optionHandlers":["../commands/root/create.completion.js"]},"t":{"alias":"trigger"},"trigger-event":{"__optionHandlers":["../commands/root/create.completion.js"]},"te":{"alias":"trigger-event"},"workflow-data-item":{"__optionHandlers":["../commands/root/create.completion.js"]},"wdi":{"alias":"workflow-data-item"},"context":{"__optionHandlers":["../commands/root/create.completion.js"],"config":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret-yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"git":{"__optionHandlers":["../commands/root/create.completion.js"],"bitbucket":{"__optionHandlers":["../commands/root/create.completion.js"]},"github":{"__optionHandlers":["../commands/root/create.completion.js"]},"gitlab":{"__optionHandlers":["../commands/root/create.completion.js"]},"stash":{"__optionHandlers":["../commands/root/create.completion.js"]}},"helm-repository":{"__optionHandlers":["../commands/root/create.completion.js"],"http":{"__optionHandlers":["../commands/root/create.completion.js"]},"s3":{"__optionHandlers":["../commands/root/create.completion.js"]}},"secret-store":{"__optionHandlers":["../commands/root/create.completion.js"],"hashicorp-vault":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes-runtime":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes":{"__optionHandlers":["../commands/root/create.completion.js"]}}},"ctx":{"alias":"context","config":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret":{"__optionHandlers":["../commands/root/create.completion.js"]},"secret-yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"yaml":{"__optionHandlers":["../commands/root/create.completion.js"]},"git":{"__optionHandlers":["../commands/root/create.completion.js"],"bitbucket":{"__optionHandlers":["../commands/root/create.completion.js"]},"github":{"__optionHandlers":["../commands/root/create.completion.js"]},"gitlab":{"__optionHandlers":["../commands/root/create.completion.js"]},"stash":{"__optionHandlers":["../commands/root/create.completion.js"]}},"helm-repository":{"__optionHandlers":["../commands/root/create.completion.js"],"http":{"__optionHandlers":["../commands/root/create.completion.js"]},"s3":{"__optionHandlers":["../commands/root/create.completion.js"]}},"secret-store":{"__optionHandlers":["../commands/root/create.completion.js"],"hashicorp-vault":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes-runtime":{"__optionHandlers":["../commands/root/create.completion.js"]},"kubernetes":{"__optionHandlers":["../commands/root/create.completion.js"]}}}},"delete":{"__optionHandlers":["../commands/root/delete.completion.js"],"agent":{"__optionHandlers":["../commands/root/delete.completion.js"]},"annotation":{"__optionHandlers":["../commands/root/delete.completion.js"]},"board":{"__optionHandlers":["../commands/root/delete.completion.js"]},"cluster":{"__optionHandlers":["../commands/root/delete.completion.js"]},"clusters":{"alias":"cluster"},"composition":{"__optionHandlers":["../commands/root/delete.completion.js"]},"com":{"alias":"composition"},"environment":{"__optionHandlers":["../commands/root/delete.completion.js"]},"env":{"alias":"environment"},"pipeline":{"__optionHandlers":["../commands/root/delete.completion.js"]},"pip":{"alias":"pipeline"},"project":{"__optionHandlers":["../commands/root/delete.completion.js"]},"repository":{"__optionHandlers":["../commands/root/delete.completion.js"]},"repo":{"alias":"repository"},"runtime-environments":{"__optionHandlers":["../commands/root/delete.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"section":{"__optionHandlers":["../commands/root/delete.completion.js"]},"step-type":{"__optionHandlers":["../commands/root/delete.completion.js"]},"system-runtime-environments":{"__optionHandlers":["../commands/root/delete.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"},"teams":{"__optionHandlers":["../commands/root/delete.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"tokens":{"__optionHandlers":["../commands/root/delete.completion.js"]},"token":{"alias":"tokens"},"helm-repo":{"__optionHandlers":["../commands/root/delete.completion.js"]},"registry":{"__optionHandlers":["../commands/root/delete.completion.js"]},"trigger":{"__optionHandlers":["../commands/root/delete.completion.js"]},"t":{"alias":"trigger"},"trigger-event":{"__optionHandlers":["../commands/root/delete.completion.js"]},"te":{"alias":"trigger-event"},"context":{"__optionHandlers":["../commands/root/delete.completion.js"]},"ctx":{"alias":"context"}},"diff":{"__optionHandlers":["../commands/root/diff.completion.js"],"runtime-environments":{"__optionHandlers":["../commands/root/diff.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"system-runtime-environments":{"__optionHandlers":["../commands/root/diff.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"}},"download":{"audit":{}},"generate":{"image-pull-secret":{}},"get":{"__optionHandlers":["../commands/root/get.completion.js"],"agents":{"__optionHandlers":["../commands/root/get.completion.js"]},"agent":{"alias":"agents"},"annotation":{"__optionHandlers":["../commands/root/get.completion.js"]},"boards":{"__optionHandlers":["../commands/root/get.completion.js"]},"board":{"alias":"boards"},"clusters":{"__optionHandlers":["../commands/root/get.completion.js"]},"cluster":{"alias":"clusters"},"compositions":{"__optionHandlers":["../commands/root/get.completion.js"]},"com":{"alias":"compositions"},"composition":{"alias":"compositions"},"environments":{"__optionHandlers":["../commands/root/get.completion.js"]},"env":{"alias":"environments"},"environment":{"alias":"environments"},"images":{"__optionHandlers":["../commands/root/get.completion.js"]},"img":{"alias":"images"},"image":{"alias":"images"},"pipelines":{"__positionalHandler":"../commands/pipeline/get.completion.js","__optionHandlers":["../commands/root/get.completion.js"]},"pip":{"alias":"pipelines"},"pipeline":{"alias":"pipelines"},"projects":{"__optionHandlers":["../commands/root/get.completion.js"]},"project":{"alias":"projects"},"repository":{"__optionHandlers":["../commands/root/get.completion.js"]},"repo":{"alias":"repository"},"runtime-environments":{"__optionHandlers":["../commands/root/get.completion.js"]},"re":{"alias":"runtime-environments"},"runtime-environment":{"alias":"runtime-environments"},"sections":{"__optionHandlers":["../commands/root/get.completion.js"]},"section":{"alias":"sections"},"step-types":{"__positionalHandler":"../commands/step/get.completion.js","__optionHandlers":["../commands/root/get.completion.js"]},"step-type":{"alias":"step-types"},"system-runtime-environments":{"__optionHandlers":["../commands/root/get.completion.js"]},"sys-re":{"alias":"system-runtime-environments"},"system-runtime-environment":{"alias":"system-runtime-environments"},"teams":{"__optionHandlers":["../commands/root/get.completion.js"]},"team":{"alias":"teams"},"tm":{"alias":"teams"},"tokens":{"__optionHandlers":["../commands/root/get.completion.js"]},"token":{"alias":"tokens"},"helm-repo":{"__optionHandlers":["../commands/root/get.completion.js"]},"registry":{"__optionHandlers":["../commands/root/get.completion.js"]},"triggers":{"__optionHandlers":["../commands/root/get.completion.js"]},"trigger":{"alias":"triggers"},"t":{"alias":"triggers"},"trigger-events":{"__optionHandlers":["../commands/root/get.completion.js"]},"trigger-event":{"alias":"trigger-events"},"te":{"alias":"trigger-events"},"trigger-types":{"__optionHandlers":["../commands/root/get.completion.js"]},"trigger-type":{"alias":"trigger-types"},"tt":{"alias":"trigger-types"},"builds":{"__optionHandlers":["../commands/root/get.completion.js"]},"build":{"alias":"builds"},"workflow-data-item":{"__optionHandlers":["../commands/root/get.completion.js"]},"wdi":{"alias":"workflow-data-item"},"contexts":{"__optionHandlers":["../commands/root/get.completion.js"]},"ctx":{"alias":"contexts"},"context":{"alias":"contexts"}},"install":{"runtime":{},"agent":{},"app-proxy":{},"monitor":{},"gitops":{}},"replace":{"__optionHandlers":["../commands/root/replace.completion.js"],"composition":{"__optionHandlers":["../commands/composition/replace.completion.js","../commands/root/replace.completion.js"]},"com":{"alias":"composition"}},"runner":{"delete":{},"execute-test-pipeline":{},"info":{},"init":{},"upgrade":{}},"synchronize":{"teams":{},"team":{"alias":"teams"},"tm":{"alias":"teams"}},"uninstall":{"agent":{},"app-proxy":{},"runtime":{},"monitor":{},"gitops":{}},"upgrade":{"app-proxy":{},"gitops":{}},"validate":{"__positionalHandler":"../commands/root/validate.completion.js"},"version":{},"attach":{},"cli-config":{"get":{},"help":{},"profile":{},"set":{}},"set-helm-config":{},"install-chart":{},"helm-promotion":{},"delete-release":{},"rollback-release":{},"test-release":{},"approve":{},"deny":{},"logs":{},"restart":{},"terminate":{},"wait":{}}}
|
|
@@ -2,9 +2,9 @@ const Promise = require('bluebird');
|
|
|
2
2
|
const _ = require('lodash');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const yaml = require('js-yaml');
|
|
5
|
-
const defaults = require('../defaults');
|
|
6
5
|
const CFError = require('cf-errors');
|
|
7
6
|
const path = require('path');
|
|
7
|
+
const defaults = require('../defaults');
|
|
8
8
|
const Output = require('../../../output/Output');
|
|
9
9
|
const { sdk } = require('../../../logic');
|
|
10
10
|
|
|
@@ -106,6 +106,39 @@ const prepareKeyValueObjectsFromCLIEnvOption = (environmentVariables) => {
|
|
|
106
106
|
return variables;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* will return an array of objects { key, value, encrypted } from parsing an array of objects: key=value ,key: {value: "value", encrypted: true }
|
|
111
|
+
* @param environmentVariables
|
|
112
|
+
* @returns Array of { key, value, encrypted }
|
|
113
|
+
*/
|
|
114
|
+
const prepareKeyValueObjectsFromEnvFileOption = (environmentVariables) => _.map(environmentVariables, (value, key) => {
|
|
115
|
+
if (_.isObject(value)) {
|
|
116
|
+
const { value: val, encrypted } = value;
|
|
117
|
+
return { key, value: val, encrypted };
|
|
118
|
+
}
|
|
119
|
+
return { key, value };
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The function takes in a list of requested variables and an array of encrypted variable names,
|
|
124
|
+
* and sets the encrypted flag to true on each corresponding variable object in the list.
|
|
125
|
+
* @param environmentVariables
|
|
126
|
+
* @param encrypted
|
|
127
|
+
* @returns Array of { key, value, encrypted }
|
|
128
|
+
*/
|
|
129
|
+
const markEncryptedFlagOnRequestedVariables = (requestedVariables, encrypted) => {
|
|
130
|
+
const variables = _.cloneDeep(requestedVariables);
|
|
131
|
+
const variableMap = _.reduce(variables, (acc, v) => _.assign(acc, { [v.key]: v }), {});
|
|
132
|
+
_.forEach(encrypted, (varName) => {
|
|
133
|
+
const variable = variableMap[varName];
|
|
134
|
+
if (!variable) {
|
|
135
|
+
throw new CFError(`Variable is not provided: "${varName}"`);
|
|
136
|
+
}
|
|
137
|
+
variable.encrypted = true;
|
|
138
|
+
});
|
|
139
|
+
return variables;
|
|
140
|
+
};
|
|
141
|
+
|
|
109
142
|
const crudFilenameOption = (yargs, options = {}) => {
|
|
110
143
|
const filenameOption = {
|
|
111
144
|
alias: options.alias || 'f',
|
|
@@ -122,13 +155,19 @@ const crudFilenameOption = (yargs, options = {}) => {
|
|
|
122
155
|
.coerce(options.name || 'filename', (arg) => {
|
|
123
156
|
try {
|
|
124
157
|
const rawFile = fs.readFileSync(path.resolve(process.cwd(), arg), 'utf8');
|
|
158
|
+
let content;
|
|
125
159
|
if (arg.endsWith('.json')) {
|
|
126
|
-
|
|
160
|
+
content = options.raw ? rawFile : JSON.parse(rawFile);
|
|
161
|
+
} else if (arg.endsWith('.yml') || arg.endsWith('yaml')) {
|
|
162
|
+
content = options.raw ? rawFile : yaml.safeLoad(rawFile);
|
|
163
|
+
} else {
|
|
164
|
+
throw new CFError('File extension is not recognized');
|
|
127
165
|
}
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
166
|
+
if (_.isObject(content)) {
|
|
167
|
+
return content;
|
|
130
168
|
}
|
|
131
|
-
throw new CFError('
|
|
169
|
+
throw new CFError('Not a valid file.\n'
|
|
170
|
+
+ 'For more information how to pass a valid file, go to https://codefresh-io.github.io/cli/pipelines/run-pipeline/');
|
|
132
171
|
} catch (err) {
|
|
133
172
|
const error = new CFError({
|
|
134
173
|
message: 'Failed to read file',
|
|
@@ -161,15 +200,15 @@ const selectColumnsOption = (yargs, options = {}) => {
|
|
|
161
200
|
};
|
|
162
201
|
|
|
163
202
|
function pathExists(p) {
|
|
164
|
-
return new Promise(resolve => fs.access(p, resolve))
|
|
165
|
-
.then(err => !err);
|
|
203
|
+
return new Promise((resolve) => fs.access(p, resolve))
|
|
204
|
+
.then((err) => !err);
|
|
166
205
|
}
|
|
167
206
|
|
|
168
207
|
const readFile = Promise.promisify(fs.readFile);
|
|
169
208
|
|
|
170
209
|
function watchFile(filename, listener) {
|
|
171
210
|
fs.watchFile(filename, { interval: 500 }, listener);
|
|
172
|
-
const unwatcher = f => () => fs.unwatchFile(f);
|
|
211
|
+
const unwatcher = (f) => () => fs.unwatchFile(f);
|
|
173
212
|
['exit', 'SIGINT', 'SIGUSR1', 'SIGUSR2', 'uncaughtException', 'SIGTERM'].forEach((eventType) => {
|
|
174
213
|
process.on(eventType, unwatcher(filename));
|
|
175
214
|
});
|
|
@@ -177,7 +216,7 @@ function watchFile(filename, listener) {
|
|
|
177
216
|
|
|
178
217
|
function ignoreHttpError(e) {
|
|
179
218
|
if (!e.statusCode) {
|
|
180
|
-
throw e
|
|
219
|
+
throw e;
|
|
181
220
|
}
|
|
182
221
|
return undefined;
|
|
183
222
|
}
|
|
@@ -232,4 +271,6 @@ module.exports = {
|
|
|
232
271
|
detectProxy,
|
|
233
272
|
keyValueArrayToObject,
|
|
234
273
|
addProxyVariables,
|
|
274
|
+
markEncryptedFlagOnRequestedVariables,
|
|
275
|
+
prepareKeyValueObjectsFromEnvFileOption,
|
|
235
276
|
};
|
package/package.json
CHANGED