Skip to content

Commit e5e164c

Browse files
committed
Move pipeline name under metadata
1 parent e9f5b48 commit e5e164c

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

examples/pipeline2.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
apiVersion: v1
22
kind: pipeline
3-
name: new-pipeline
43
metadata:
4+
name: new-pipeline
55
labels:
66
repo: ArikMaor/ping-server
7+
appPort: 3000
78
spec:
89
triggers:
910
- type: scm

lib/interface/cli/commands/pipeline2/create.cmd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ const command = new Command({
3131
throw new CFError('Pipeline definitions file must be provided');
3232
}
3333

34-
if (!filename.name && !name) {
34+
if (!_.get(filename, 'metadata.name') && !name) {
3535
throw new CFError('Name must be provided');
3636
}
3737

3838
const data = argv.filename;
3939
if (name) {
40-
data.name = name;
40+
_.set(data, 'metadata.name', name);
4141
}
4242

4343
await pipeline2.createPipeline(data);
44-
console.log(`Pipeline '${data.name}' created`);
44+
console.log(`Pipeline '${data.metadata.name}' created`);
4545
},
4646
});
4747

lib/interface/cli/commands/pipeline2/replace.cmd.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ const command = new Command({
3131
throw new CFError('Pipeline definitions file must be provided');
3232
}
3333

34-
if (!filename.name && !name) {
34+
if (!_.get(filename, 'metadata.name') && !name) {
3535
throw new CFError('Name must be provided');
3636
}
3737

3838
const data = argv.filename;
3939
if (name) {
40-
data.name = name;
40+
_.set(data, 'metadata.name', name);
4141
};
4242

43-
await pipeline2.replaceByName(data.name, data);
44-
console.log(`Pipeline '${data.name}' updated`);
43+
await pipeline2.replaceByName(data.metadata.name, data);
44+
console.log(`Pipeline '${data.metadata.name}' updated`);
4545
},
4646
});
4747

lib/logic/api/pipeline2.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const Pipeline = require('../entities/Pipeline2');
55

66
const _extractFieldsForPipelineEntity = pipeline => ({
77
id: pipeline.id,
8-
name: pipeline.name,
98
metadata: pipeline.metadata,
109
spec: pipeline.spec,
1110
});

lib/logic/entities/Entity.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const yaml = require('js-yaml');
2-
2+
const _ = require('lodash');
33
class Entity {
44
// get all the information about the entity
55
getInfo() {
@@ -30,7 +30,7 @@ class Entity {
3030
extractValues(columns) {
3131
const values = {};
3232
columns.forEach((key) => {
33-
values[key] = this.info[key];
33+
values[key.replace(/^.*\./, '')] = _.get(this.info, key);
3434
});
3535
return values;
3636
}

lib/logic/entities/Pipeline2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Pipeline2 extends Entity {
55
super();
66
this.entityType = 'pipeline2';
77
this.info = data;
8-
this.defaultColumns = ['id', 'name'];
8+
this.defaultColumns = ['id', 'metadata.name'];
99
this.wideColumns = this.defaultColumns.concat([]);
1010
}
1111
}

0 commit comments

Comments
 (0)