Skip to content

Commit 7c9a716

Browse files
Saas 2823 (#337)
* pip repo analyzer * rename title
1 parent 9f107d9 commit 7c9a716

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const _ = require('lodash');
2+
const Command = require('../../Command');
3+
const Logic = require('./analyzer.logic');
4+
5+
const command = new Command({
6+
root: true,
7+
command: 'analyze <repoOwner> <repoName> [context]',
8+
description: 'Analyze your repo',
9+
webDocs: {
10+
category: 'Analyzer',
11+
title: 'Analyze'
12+
},
13+
builder: yargs => yargs
14+
.positional('repoOwner', {
15+
describe: 'Repository owner',
16+
required: true,
17+
})
18+
.positional('repoName', {
19+
describe: 'Repository name',
20+
required: true,
21+
})
22+
.positional('context', {
23+
describe: 'Your git context that you can get from integrations -> git , if empty - using personal context',
24+
required: false
25+
})
26+
.example('codefresh analyze petlove bee github', 'Analyze repo'),
27+
handler: async (argv) => {
28+
const { repoOwner, repoName, context } = argv;
29+
const yaml = await Logic.analyze({repoOwner, repoName, context});
30+
console.log(yaml);
31+
},
32+
});
33+
34+
module.exports = command;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* eslint-disable no-use-before-define,object-curly-newline,arrow-body-style */
2+
3+
const { sdk } = require('../../../../logic');
4+
5+
class AnalyzerLogic {
6+
7+
static async analyze({ repoOwner, repoName, context }) {
8+
9+
const repo = {
10+
repoOwner,
11+
repoName,
12+
git: context,
13+
};
14+
15+
return sdk.pipelines.analyze({
16+
repo,
17+
type: 'git',
18+
source: 'api'
19+
});
20+
}
21+
22+
}
23+
24+
module.exports = AnalyzerLogic;

openapi.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,27 @@
15061506
"x-sdk-interface": "onPrem.runtimeEnvs.plan.get"
15071507
}
15081508
},
1509+
1510+
"/pipelines/analyze": {
1511+
"post": {
1512+
"responses": {
1513+
"200": {
1514+
"$ref": "#/components/responses/json"
1515+
}
1516+
},
1517+
"tags": [
1518+
"pipelines"
1519+
],
1520+
"operationId": "pipelines-analyze",
1521+
"parameters": [],
1522+
"requestBody": {
1523+
"$ref": "#/components/requestBodies/pipelines_analyze"
1524+
},
1525+
"summary": "Analyze pipeline",
1526+
"x-sdk-interface": "pipelines.analyze"
1527+
}
1528+
},
1529+
15091530
"/annotations": {
15101531
"delete": {
15111532
"responses": {
@@ -6865,6 +6886,27 @@
68656886
},
68666887
"required": true
68676888
},
6889+
"pipelines_analyze": {
6890+
"content": {
6891+
"application/json": {
6892+
"schema": {
6893+
"properties": {
6894+
"repo": {
6895+
"type": "object"
6896+
},
6897+
"type": {
6898+
"type": "string"
6899+
},
6900+
"source": {
6901+
"type": "string"
6902+
}
6903+
},
6904+
"type": "object"
6905+
}
6906+
}
6907+
},
6908+
"required": true
6909+
},
68686910
"abac": {
68696911
"content": {
68706912
"application/json": {

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.20.2",
3+
"version": "0.20.3",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)