Skip to content

Commit 72ea7f4

Browse files
Update codefresh sdk and worflow get (#450)
1 parent fb0d88d commit 72ea7f4

File tree

7 files changed

+162
-74
lines changed

7 files changed

+162
-74
lines changed

lib/interface/cli/commands/workflow/approve.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const approveBuildCmd = new Command({
2222
},
2323
handler: async (argv) => {
2424
const { buildId } = argv;
25-
await sdk.workflows.get({ id: buildId });
25+
await sdk.workflows.getBuild({ buildId, noAccount: false });
2626
await sdk.workflows.approve({ buildId });
2727
console.log(`Workflow ${buildId} has been approved.`);
2828
},

lib/interface/cli/commands/workflow/deny.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const denyBuildCmd = new Command({
2222
},
2323
handler: async (argv) => {
2424
const { buildId } = argv;
25-
await sdk.workflows.get({ id: buildId });
25+
await sdk.workflows.getBuild({ buildId, noAccount: false });
2626
await sdk.workflows.deny({ buildId });
2727
console.log(`Workflow ${buildId} has been denied.`);
2828
},

lib/interface/cli/commands/workflow/get.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const command = new Command({
107107
let workflows = [];
108108
// TODO:need to decide for one way for error handeling
109109
if (!_.isEmpty(workflowIds)) {
110-
workflows = await Promise.map(workflowIds, id => sdk.workflows.get({ id }));
110+
workflows = await Promise.map(workflowIds, id => sdk.workflows.getBuild({ buildId: id, noAccount: false }));
111111
Output.print(_.map(workflows, Workflow.fromResponse));
112112
} else {
113113
if (!_.isEmpty(pipelineNames)) {

lib/interface/cli/commands/workflow/terminate.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const terminate = new Command({
2121
},
2222
handler: async (argv) => {
2323
const workflowId = argv.id;
24-
const buildResponse = await sdk.workflows.get({ id: workflowId });
24+
const buildResponse = await sdk.workflows.getBuild({ buildId: workflowId, noAccount: false });
2525
const workflow = Workflow.fromResponse(buildResponse);
2626
await sdk.progress.terminate({ id: workflow.info.progress });
2727
console.log(`Build: ${workflowId} terminated`);

lib/interface/cli/helpers/logs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function _fallbackLogs(workflowId, interval, retriesLeft) {
2727

2828
try {
2929
console.log('Checking build status...');
30-
const workflow = await sdk.workflows.get({ id: workflowId });
30+
const workflow = await sdk.workflows.getBuild({ buildId: workflowId, noAccount: false });
3131
const currentStatus = workflow.status;
3232
if (END_STATUSES.includes(currentStatus)) {
3333
console.log(`Build finished with status: '${_.upperCase(currentStatus)}'`);
@@ -67,7 +67,7 @@ const followLogs = async (workflowId) => {
6767
}
6868
await _fallbackLogs(workflowId, config.logs.fallback.interval, config.logs.fallback.maxAttempts);
6969
}
70-
const json = await sdk.workflows.get({ id: workflowId });
70+
const json = await sdk.workflows.getBuild({ buildId: workflowId, noAccount: false });
7171
const workflowInstance = Workflow.fromResponse(json);
7272
switch (workflowInstance.getStatus()) {
7373
case 'success':

openapi.json

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,24 +2082,39 @@
20822082
"x-sdk-interface": "tokens.list"
20832083
}
20842084
},
2085-
"/builds/{id}": {
2085+
"/builds/{buildId}": {
20862086
"get": {
20872087
"parameters": [
20882088
{
2089-
"$ref": "#/components/parameters/id"
2089+
"name": "buildId",
2090+
"in": "path",
2091+
"schema": {
2092+
"type": "string"
2093+
},
2094+
"description": "buildId",
2095+
"required": true
2096+
},
2097+
{
2098+
"name": "noAccount",
2099+
"in": "query",
2100+
"schema": {
2101+
"type": "string"
2102+
},
2103+
"description": "noAccount",
2104+
"required": true
20902105
}
20912106
],
20922107
"responses": {
20932108
"200": {
2094-
"description": "ok"
2109+
"$ref": "#/components/responses/Json"
20952110
}
20962111
},
20972112
"tags": [
20982113
"builds"
20992114
],
2100-
"operationId": "workflows-get",
2115+
"operationId": "workflows-get-build",
21012116
"summary": "Get",
2102-
"x-sdk-interface": "workflows.get"
2117+
"x-sdk-interface": "workflows.getBuild"
21032118
}
21042119
},
21052120
"/workflow": {

0 commit comments

Comments
 (0)