Skip to content

Commit 6334c12

Browse files
Feature/olegz/saas 4712 added suporting manifest for create project (#379)
* SAAS-4712 #time 2h 10m Made some small refactoring - moved checking existing project to the helper. * SAAS-4712 #time 0h 50m Added manifest file supporting for creating command * SAAS-4712 #time 0h 50m Added manifest file supporting for creating command * rebuild Co-authored-by: Denis Melnik <58072595+denis-codefresh@users.noreply.github.com>
1 parent 2c3657f commit 6334c12

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
const _ = require('lodash');
12
const CFError = require('cf-errors');
23
const Command = require('../../Command');
34
const { crudFilenameOption } = require('../../helpers/general');
45
const yargs = require('yargs');
5-
const { validatePipelineSpec } = require('../../helpers/validation');
6+
const { validatePipelineSpec, checkOrProjectExists } = require('../../helpers/validation');
67
const { sdk } = require('../../../../logic');
78

89
const get = new Command({
@@ -31,7 +32,7 @@ const get = new Command({
3132

3233
const name = data.metadata.name;
3334
if (!name) {
34-
throw new CFError("Name is missing");
35+
throw new CFError('Name is missing');
3536
}
3637

3738
switch (entity) {
@@ -52,6 +53,11 @@ const get = new Command({
5253
await sdk.steps.create(data);
5354
console.log(`Step-type '${name}' created`);
5455
break;
56+
case 'project':
57+
await checkOrProjectExists(name);
58+
await sdk.projects.create({ projectName: name, ..._.pick(data.metadata, ['tags', 'variables']) });
59+
console.log(`Project: ${name} created`);
60+
break;
5561
default:
5662
throw new CFError(`Entity: ${entity} not supported`);
5763
}

lib/logic/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ const sdk = require('./sdk');
33
module.exports = {
44
sdk,
55
};
6-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.39.1",
3+
"version": "0.39.2",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)