codefresh 0.78.3 → 0.79.0
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/.dockerignore +1 -0
- package/Dockerfile +3 -4
- package/check-version.js +1 -1
- package/codefresh-release.yml +265 -61
- package/codefresh.yml +64 -20
- package/e2e/README.md +10 -0
- package/e2e/data/crud.pip.yaml +23 -0
- package/e2e/data/test-run.pip.yaml +23 -0
- package/e2e/e2e.spec.sh +25 -0
- package/e2e/helpers.sh +10 -0
- package/e2e/scenarios/agents.sh +1 -0
- package/e2e/scenarios/annotations.sh +2 -0
- package/e2e/scenarios/boards.sh +3 -0
- package/e2e/scenarios/builds.sh +1 -0
- package/e2e/scenarios/clusters.sh +1 -0
- package/e2e/scenarios/compositions.sh +1 -0
- package/e2e/scenarios/contexts.sh +1 -0
- package/e2e/scenarios/environments.sh +1 -0
- package/e2e/scenarios/helm-repo.sh +1 -0
- package/e2e/scenarios/images.sh +1 -0
- package/e2e/scenarios/pipeline-run.sh +26 -0
- package/e2e/scenarios/pipelines.sh +31 -0
- package/e2e/scenarios/projects.sh +17 -0
- package/e2e/scenarios/registry.sh +1 -0
- package/e2e/scenarios/repository.sh +2 -0
- package/e2e/scenarios/runtime-environment.sh +1 -0
- package/e2e/scenarios/step-types.sh +1 -0
- package/e2e/scenarios/system-runtime-environments.sh +1 -0
- package/e2e/scenarios/teams.sh +1 -0
- package/e2e/scenarios/tokens.sh +1 -0
- package/e2e/scenarios/triggers.sh +3 -0
- package/lib/interface/cli/commands/workflow/logs.cmd.js +6 -1
- package/lib/interface/cli/completion/completion.spec.js +18 -15
- package/lib/interface/cli/helpers/helpers.sdk.spec.js +0 -9
- package/lib/interface/cli/helpers/logs.js +2 -12
- package/lib/logic/cli-config/Manager.js +4 -5
- package/lib/logic/cli-config/Model.js +4 -5
- package/lib/logic/cli-config/manager.spec.js +10 -13
- package/lib/logic/entities/Agent.js +1 -3
- package/lib/logic/entities/CodefreshRepo.js +1 -1
- package/lib/logic/entities/Entity.js +1 -0
- package/lib/logic/entities/Environment.js +1 -0
- package/lib/logic/entities/GitRepo.js +1 -1
- package/lib/logic/entities/HelmRepo.js +1 -2
- package/lib/logic/entities/Pipeline.js +1 -1
- package/lib/logic/entities/RuntimeEnvironments.js +1 -1
- package/lib/logic/entities/StepType.js +2 -2
- package/lib/logic/entities/StepTypeVersion.js +0 -1
- package/lib/logic/entities/Team.js +2 -2
- package/lib/logic/entities/Token.js +2 -2
- package/lib/logic/entities/Workflow.js +1 -1
- package/lib/logic/index.js +0 -2
- package/package.json +35 -23
- package/yarn.lock +1522 -907
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get environments
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get helm-repo
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get images
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
project=test-run
|
|
2
|
+
pipeline="$project/test-run"
|
|
3
|
+
pipeline_file="$SCRIPT_DIR/data/test-run.pip.yaml"
|
|
4
|
+
|
|
5
|
+
existing_pipeline=`exists pipeline $pipeline`
|
|
6
|
+
existing_project=`exists project $project`
|
|
7
|
+
|
|
8
|
+
if [ -z "$existing_project" ]; then
|
|
9
|
+
echo "Project does not exist: $project"
|
|
10
|
+
echo "Creating project: $project"
|
|
11
|
+
codefresh create project $project
|
|
12
|
+
else
|
|
13
|
+
echo "Project already exists: $project"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ -z "$existing_pipeline" ]; then
|
|
17
|
+
echo "Pipeline does not exist: $pipeline"
|
|
18
|
+
echo "Creating pipeline: $pipeline"
|
|
19
|
+
codefresh create -f $pipeline_file
|
|
20
|
+
else
|
|
21
|
+
echo "Pipeline already exists: $pipeline"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
codefresh run $pipeline
|
|
25
|
+
codefresh delete pipeline $pipeline
|
|
26
|
+
codefresh delete project $project
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
project='pipeline-crud'
|
|
2
|
+
pipeline="$project/crud"
|
|
3
|
+
pipeline_file="$SCRIPT_DIR/data/crud.pip.yaml"
|
|
4
|
+
|
|
5
|
+
existing_project=`exists project $project`
|
|
6
|
+
existing_pipeline=`exists pipeline $pipeline`
|
|
7
|
+
|
|
8
|
+
if [ -z "$existing_project" ]; then
|
|
9
|
+
echo "Project does not exist: $project"
|
|
10
|
+
echo "Creating project: $project"
|
|
11
|
+
codefresh create project $project
|
|
12
|
+
else
|
|
13
|
+
echo "Project already exists: $project"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ -z "$existing_pipeline" ]; then
|
|
17
|
+
echo "Pipeline does not exist: $pipeline"
|
|
18
|
+
echo "Creating pipeline: $pipeline"
|
|
19
|
+
codefresh create -f $pipeline_file
|
|
20
|
+
else
|
|
21
|
+
echo "Pipeline already exists: $pipeline"
|
|
22
|
+
codefresh delete pipeline $pipeline
|
|
23
|
+
codefresh create -f $pipeline_file
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
codefresh get pipelines
|
|
27
|
+
codefresh get pipeline $pipeline
|
|
28
|
+
|
|
29
|
+
codefresh delete pipeline $pipeline
|
|
30
|
+
codefresh delete project $project
|
|
31
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
project='project-crud'
|
|
2
|
+
|
|
3
|
+
existing_project=`exists project $project`
|
|
4
|
+
|
|
5
|
+
if [ -z "$existing_project" ]; then
|
|
6
|
+
echo "Project does not exist: $project"
|
|
7
|
+
echo "Creating project: $project"
|
|
8
|
+
codefresh create project $project
|
|
9
|
+
else
|
|
10
|
+
echo "Project already exists: $project"
|
|
11
|
+
codefresh delete project $project
|
|
12
|
+
codefresh create project $project
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
codefresh get projects
|
|
16
|
+
codefresh get project $project
|
|
17
|
+
codefresh delete project $project
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get registry
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get runtime-environments
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get step-types
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get system-runtime-environments
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get teams
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codefresh get tokens
|
|
@@ -20,6 +20,10 @@ const run = new Command({
|
|
|
20
20
|
describe: 'Continue showing build logs until it will finish',
|
|
21
21
|
type: 'boolean',
|
|
22
22
|
})
|
|
23
|
+
.option('no-timestamps', {
|
|
24
|
+
describe: 'Don\'t show timestamps',
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
})
|
|
23
27
|
.example('codefresh logs ID', 'Get logs of build ID')
|
|
24
28
|
.example('codefresh logs -f ID', 'Get all previous logs of build ID and attach to future logs');
|
|
25
29
|
|
|
@@ -28,8 +32,9 @@ const run = new Command({
|
|
|
28
32
|
handler: async (argv) => {
|
|
29
33
|
const workflowId = argv.id;
|
|
30
34
|
const follow = argv.f;
|
|
35
|
+
const removeTimestamps = argv.noTimestamps
|
|
31
36
|
|
|
32
|
-
await sdk.logs.showWorkflowLogs(workflowId, follow);
|
|
37
|
+
await sdk.logs.showWorkflowLogs(workflowId, follow, removeTimestamps);
|
|
33
38
|
// TODO fix this. its a workaround since something related to firebase in not properly closed
|
|
34
39
|
process.exit(0);
|
|
35
40
|
},
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
const initCompletion = require('./index');
|
|
2
2
|
const { handleOptions: mockHandleOptions, fileDir: mockFileDir } = require('./helpers');
|
|
3
|
-
const mockPath = require('path');
|
|
4
3
|
|
|
5
|
-
const
|
|
4
|
+
const mockCompletions = initCompletion();
|
|
5
|
+
|
|
6
|
+
function mockCwd() {
|
|
7
|
+
return process.cwd();
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
function getCompletion(args) {
|
|
8
|
-
return new Promise(resolve =>
|
|
11
|
+
return new Promise(resolve => mockCompletions.getCompletion(args, resolve));
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
jest.mock('./tree', () => ({
|
|
@@ -67,11 +70,11 @@ jest.mock('./context/create.completion', () => { // eslint-disable-line
|
|
|
67
70
|
|
|
68
71
|
jest.mock('fs', () => {
|
|
69
72
|
const existsSync = (p) => {
|
|
70
|
-
if (p.startsWith(`${
|
|
71
|
-
p = p.replace(`${
|
|
73
|
+
if (p.startsWith(`${mockCwd()}/`)) {
|
|
74
|
+
p = p.replace(`${mockCwd()}/`, '');
|
|
72
75
|
}
|
|
73
|
-
if (p.startsWith(
|
|
74
|
-
p = p.replace(
|
|
76
|
+
if (p.startsWith(mockCwd())) {
|
|
77
|
+
p = p.replace(mockCwd(), '');
|
|
75
78
|
}
|
|
76
79
|
switch (p) {
|
|
77
80
|
case '':
|
|
@@ -89,11 +92,11 @@ jest.mock('fs', () => {
|
|
|
89
92
|
const lstatSync = (p) => {
|
|
90
93
|
let isFile = false;
|
|
91
94
|
let isDir = true;
|
|
92
|
-
if (p.startsWith(`${
|
|
93
|
-
p = p.replace(`${
|
|
95
|
+
if (p.startsWith(`${mockCwd()}/`)) {
|
|
96
|
+
p = p.replace(`${mockCwd()}/`, '');
|
|
94
97
|
}
|
|
95
|
-
if (p.startsWith(
|
|
96
|
-
p = p.replace(
|
|
98
|
+
if (p.startsWith(mockCwd())) {
|
|
99
|
+
p = p.replace(mockCwd(), '');
|
|
97
100
|
}
|
|
98
101
|
switch (p) {
|
|
99
102
|
case 'some.yaml':
|
|
@@ -116,11 +119,11 @@ jest.mock('fs', () => {
|
|
|
116
119
|
};
|
|
117
120
|
|
|
118
121
|
const readdirSync = (p) => {
|
|
119
|
-
if (p.startsWith(`${
|
|
120
|
-
p = p.replace(`${
|
|
122
|
+
if (p.startsWith(`${mockCwd()}/`)) {
|
|
123
|
+
p = p.replace(`${mockCwd()}/`, '');
|
|
121
124
|
}
|
|
122
|
-
if (p.startsWith(
|
|
123
|
-
p = p.replace(
|
|
125
|
+
if (p.startsWith(mockCwd())) {
|
|
126
|
+
p = p.replace(mockCwd(), '');
|
|
124
127
|
}
|
|
125
128
|
switch (p) {
|
|
126
129
|
case '':
|
|
@@ -67,15 +67,6 @@ describe('helpers using sdk', () => {
|
|
|
67
67
|
expect(sdk.logs.showWorkflowLogs).toBeCalled();
|
|
68
68
|
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
|
|
69
69
|
});
|
|
70
|
-
it('should not show logs if check version throw an exception', async () => {
|
|
71
|
-
const workflowId = 'id';
|
|
72
|
-
jest.spyOn(sdk.logs, 'showWorkflowLogs').mockImplementation();
|
|
73
|
-
versionChecker.checkVersion.mockImplementationOnce(() => {
|
|
74
|
-
throw new Error();
|
|
75
|
-
});
|
|
76
|
-
await followLogs(workflowId);
|
|
77
|
-
expect(sdk.logs.showWorkflowLogs).not.toBeCalled();
|
|
78
|
-
});
|
|
79
70
|
});
|
|
80
71
|
|
|
81
72
|
describe('auth', () => {
|
|
@@ -6,9 +6,8 @@ const CFError = require('cf-errors');
|
|
|
6
6
|
const { sdk } = require('../../../logic');
|
|
7
7
|
const Workflow = require('../../../logic/entities/Workflow');
|
|
8
8
|
const Output = require('../../../output/Output');
|
|
9
|
-
const { checkVersion } = require('
|
|
10
|
-
|
|
11
|
-
const nodeVersionToValidate = '<=10.x >=8.x';
|
|
9
|
+
const { checkVersion } = require('../../../../check-version');
|
|
10
|
+
const { engines } = require('../../../../package.json');
|
|
12
11
|
|
|
13
12
|
const END_STATUSES = ['error', 'success', 'terminated'];
|
|
14
13
|
|
|
@@ -56,15 +55,6 @@ async function _fallbackLogs(workflowId, interval, retriesLeft) {
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
const followLogs = async (workflowId) => {
|
|
59
|
-
try {
|
|
60
|
-
checkVersion(nodeVersionToValidate);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
const url = _.get(sdk, 'config.context.url', 'https://g.codefresh.io');
|
|
63
|
-
const buildLink = `${url}/build/${workflowId}`;
|
|
64
|
-
// eslint-disable-next-line max-len
|
|
65
|
-
console.log(`Your node version (${process.version}) is not compatible with supported node version (${nodeVersionToValidate}) for this command, click the link to see it in codefresh UI : ${buildLink}`);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
58
|
try {
|
|
69
59
|
await sdk.logs.showWorkflowLogs(workflowId, true);
|
|
70
60
|
} catch (e) {
|
|
@@ -82,7 +82,6 @@ class CliConfigManager {
|
|
|
82
82
|
}, {});
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
86
85
|
static set(propertyName, value) {
|
|
87
86
|
const properties = Model.findProperties(propertyName);
|
|
88
87
|
_validate(properties, propertyName);
|
|
@@ -135,9 +134,9 @@ class CliConfigManager {
|
|
|
135
134
|
static meta(propertyName) {
|
|
136
135
|
const meta = Model.meta();
|
|
137
136
|
return _.keys(meta)
|
|
138
|
-
.filter(key => !propertyName || !propertyName.length || key.includes(propertyName))
|
|
137
|
+
.filter((key) => !propertyName || !propertyName.length || key.includes(propertyName))
|
|
139
138
|
.sort()
|
|
140
|
-
.map(key =>
|
|
139
|
+
.map((key) => ({ key, ..._.get(meta, key) }));
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
static _preloadConfig() {
|
|
@@ -168,12 +167,12 @@ class CliConfigManager {
|
|
|
168
167
|
try {
|
|
169
168
|
Model.validate(CURRENT_CONFIG);
|
|
170
169
|
} catch (e) {
|
|
171
|
-
const errorPaths = e.errors.map(er => er.dataPath.replace('.', ''));
|
|
170
|
+
const errorPaths = e.errors.map((er) => er.dataPath.replace('.', ''));
|
|
172
171
|
|
|
173
172
|
console.warn('---------------');
|
|
174
173
|
console.warn('!!! Some properties are invalid -- replacing with defaults:');
|
|
175
174
|
|
|
176
|
-
errorPaths.forEach(ep => {
|
|
175
|
+
errorPaths.forEach((ep) => {
|
|
177
176
|
console.warn(ep);
|
|
178
177
|
_.set(CURRENT_CONFIG, ep, undefined);
|
|
179
178
|
});
|
|
@@ -11,12 +11,12 @@ let DEFAULTS;
|
|
|
11
11
|
let PROPERTIES;
|
|
12
12
|
let PROPERTIES_META;
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* Every schema object need to have default set to {} in order to init its properties with default value
|
|
17
16
|
* */
|
|
18
17
|
function _fillSchemaObjectsWithDefault(schema) {
|
|
19
18
|
if (schema.type === 'object') {
|
|
19
|
+
// eslint-disable-next-line no-param-reassign
|
|
20
20
|
schema.default = schema.default || {};
|
|
21
21
|
if (schema.properties) {
|
|
22
22
|
_.values(schema.properties).forEach((value) => {
|
|
@@ -38,13 +38,13 @@ function _compileSchema() {
|
|
|
38
38
|
|
|
39
39
|
function _extractMeta(props) {
|
|
40
40
|
return props.reduce((obj, prop) => {
|
|
41
|
+
// eslint-disable-next-line no-param-reassign
|
|
41
42
|
obj[prop] = prop.split('.')
|
|
42
43
|
.reduce((prev, pathPart) => prev.properties[pathPart], cliConfigSchema);
|
|
43
44
|
return obj;
|
|
44
45
|
}, {});
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
48
|
class Model {
|
|
49
49
|
static default() {
|
|
50
50
|
return _.cloneDeep(DEFAULTS);
|
|
@@ -55,13 +55,13 @@ class Model {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
static findProperties(name) {
|
|
58
|
-
return PROPERTIES.filter(prop => prop.includes(name));
|
|
58
|
+
return PROPERTIES.filter((prop) => prop.includes(name));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
62
61
|
static meta() {
|
|
63
62
|
return _.cloneDeep(PROPERTIES_META);
|
|
64
63
|
}
|
|
64
|
+
|
|
65
65
|
/**
|
|
66
66
|
* also fills with default values and coerces types
|
|
67
67
|
* */
|
|
@@ -79,4 +79,3 @@ PROPERTIES = _.keys(flatten(DEFAULTS));
|
|
|
79
79
|
PROPERTIES_META = _extractMeta(PROPERTIES);
|
|
80
80
|
|
|
81
81
|
module.exports = Model;
|
|
82
|
-
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
const Manager = require('./Manager');
|
|
5
6
|
const Model = require('./Model');
|
|
6
7
|
|
|
7
8
|
const { CODEFRESH_PATH: mockCodefreshPath } = require('../../interface/cli/defaults');
|
|
9
|
+
|
|
8
10
|
const mockDirPath = path.resolve(mockCodefreshPath, 'cli-config');
|
|
9
11
|
const mockFilePath = path.resolve(mockDirPath, 'config.yaml');
|
|
10
12
|
|
|
11
|
-
|
|
12
13
|
jest.mock('fs', () => { // eslint-disable-line
|
|
13
14
|
const readFileSync = () => this.configFile;
|
|
14
|
-
const existsSync = (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}[path];
|
|
20
|
-
};
|
|
15
|
+
const existsSync = (targetPath) => ({
|
|
16
|
+
[mockCodefreshPath]: true,
|
|
17
|
+
[mockDirPath]: true,
|
|
18
|
+
[mockFilePath]: this.exists,
|
|
19
|
+
}[targetPath]);
|
|
21
20
|
const openSync = () => null;
|
|
22
21
|
const writeSync = (file, config) => {
|
|
23
22
|
this.configFile = config;
|
|
@@ -47,8 +46,8 @@ jest.mock('fs', () => { // eslint-disable-line
|
|
|
47
46
|
});
|
|
48
47
|
|
|
49
48
|
jest.mock('js-yaml', () => {
|
|
50
|
-
const safeLoad = d => d;
|
|
51
|
-
const safeDump = d => d;
|
|
49
|
+
const safeLoad = (d) => d;
|
|
50
|
+
const safeDump = (d) => d;
|
|
52
51
|
return {
|
|
53
52
|
safeLoad,
|
|
54
53
|
safeDump,
|
|
@@ -67,7 +66,7 @@ jest.mock('./schema', () => { // eslint-disable-line
|
|
|
67
66
|
pretty: {
|
|
68
67
|
type: 'boolean',
|
|
69
68
|
default: false,
|
|
70
|
-
description: 'Defines whether to show data in table view in pretty mode or not'
|
|
69
|
+
description: 'Defines whether to show data in table view in pretty mode or not',
|
|
71
70
|
},
|
|
72
71
|
test: {
|
|
73
72
|
type: 'object',
|
|
@@ -92,8 +91,6 @@ jest.mock('./schema', () => { // eslint-disable-line
|
|
|
92
91
|
};
|
|
93
92
|
});
|
|
94
93
|
|
|
95
|
-
const fs = require('fs');
|
|
96
|
-
|
|
97
94
|
describe('CliConfigManager', () => {
|
|
98
95
|
describe('config loading', () => {
|
|
99
96
|
// this test case must be first due to node module cache
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
|
-
const Entity = require('./Entity');
|
|
3
2
|
const chalk = require('chalk');
|
|
3
|
+
const Entity = require('./Entity');
|
|
4
4
|
|
|
5
5
|
class Agent extends Entity {
|
|
6
6
|
constructor(data) {
|
|
@@ -42,11 +42,9 @@ class Agent extends Entity {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
static fromResponse(response) {
|
|
47
46
|
return new Agent(_.pick(response, 'id', 'name', 'runtimes', 'status', 'lastReported'));
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
module.exports = Agent;
|
|
52
|
-
|
|
@@ -10,7 +10,7 @@ class CodefreshRepo extends Entity {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
static fromResponse(response) {
|
|
13
|
-
const data =
|
|
13
|
+
const data = { ...response };
|
|
14
14
|
data.name_id = response.serviceName;
|
|
15
15
|
data.git_context = response.provider;
|
|
16
16
|
data.owner = response.owner.login;
|
|
@@ -11,6 +11,7 @@ class Entity {
|
|
|
11
11
|
toDefault() {
|
|
12
12
|
return this.extractValues(this.defaultColumns);
|
|
13
13
|
}
|
|
14
|
+
|
|
14
15
|
// wide Columns means all the fields we want to show when using get with -o wide option (return more information then the defualt)
|
|
15
16
|
toWide() {
|
|
16
17
|
return this.extractValues(this.wideColumns);
|
|
@@ -10,7 +10,7 @@ class GitRepo extends Entity {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
static fromResponse(response) {
|
|
13
|
-
const data =
|
|
13
|
+
const data = { ...response };
|
|
14
14
|
data.git_context = response.provider;
|
|
15
15
|
data.owner = response.owner.login;
|
|
16
16
|
data.repo_shortcut = `${data.owner}/${data.name}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const Entity = require('./Entity');
|
|
2
1
|
const _ = require('lodash');
|
|
2
|
+
const Entity = require('./Entity');
|
|
3
3
|
|
|
4
4
|
class StepType extends Entity {
|
|
5
5
|
constructor(data) {
|
|
@@ -8,7 +8,7 @@ class StepType extends Entity {
|
|
|
8
8
|
this.info = data;
|
|
9
9
|
this.name = this.info.metadata.name;
|
|
10
10
|
this.visibility = this.info.metadata.isPublic ? 'public' : 'private';
|
|
11
|
-
this.official = this.info.metadata.official ?
|
|
11
|
+
this.official = this.info.metadata.official ? 'true' : 'false';
|
|
12
12
|
this.version = this.info.metadata.version;
|
|
13
13
|
this.category = this.info.metadata.categories;
|
|
14
14
|
this.stage = this.info.metadata.stage;
|
|
@@ -11,13 +11,13 @@ class Team extends Entity {
|
|
|
11
11
|
|
|
12
12
|
toDefault() {
|
|
13
13
|
const data = super.toDefault();
|
|
14
|
-
data.users = data.users.map(user => user.userName);
|
|
14
|
+
data.users = data.users.map((user) => user.userName);
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
toWide() {
|
|
19
19
|
const data = super.toWide();
|
|
20
|
-
data.users = data.users.map(user => user.userName);
|
|
20
|
+
data.users = data.users.map((user) => user.userName);
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const Entity = require('./Entity');
|
|
2
1
|
const _ = require('lodash');
|
|
2
|
+
const Entity = require('./Entity');
|
|
3
3
|
|
|
4
4
|
class Token extends Entity {
|
|
5
5
|
constructor(data) {
|
|
@@ -11,7 +11,7 @@ class Token extends Entity {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
static fromResponse(response) {
|
|
14
|
-
const data =
|
|
14
|
+
const data = { ...response };
|
|
15
15
|
data.id = data._id;
|
|
16
16
|
data.token_prefix = response.tokenPrefix;
|
|
17
17
|
data.scopes = _.isArray(response.scopes) ? response.scopes : ['any'];
|