Skip to content

Commit 210fa85

Browse files
Bug/olegz/saas 5362 fix pipeline name filter in get build command (#402)
* SAAS-5362 #time 0m 0h Fixed `pipelineName` filter in get builds command * SAAS-5362 #time 0m 0h Fixed `pipelineName` filter in get builds command
1 parent bec8949 commit 210fa85

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ const command = new Command({
9494
} = argv;
9595
const pipelineNames = !_.isArray(argv['pipeline-name']) ? [(argv['pipeline-name'])] : argv['pipeline-name'];
9696
const pipelineIds = !_.isArray(argv['pipeline-id']) ? [(argv['pipeline-id'])] : argv['pipeline-id'];
97+
const requestOptions = {
98+
limit,
99+
page,
100+
status,
101+
trigger,
102+
branchName,
103+
revision,
104+
pipelineTriggerId,
105+
};
97106

98107
let workflows = [];
99108
// TODO:need to decide for one way for error handeling
@@ -109,20 +118,15 @@ const command = new Command({
109118
_.forEach(pipelines.docs, (currPipeline) => {
110119
pipelineIds.push(currPipeline.metadata.id);
111120
});
121+
requestOptions.pipeline = pipelineIds;
112122
} else if (_.isEmpty(pipelineIds)) {
113123
throw new CFError('Cannot find any builds with these pipelines names');
114124
}
125+
} else if (!_.isEmpty(pipelineIds)) {
126+
requestOptions.pipeline = pipelineIds;
115127
}
116-
const result = await sdk.workflows.list({
117-
limit,
118-
page,
119-
status,
120-
trigger,
121-
branchName,
122-
revision,
123-
pipelineTriggerId,
124-
pipeline: _.isEmpty(pipelineIds) ? undefined : pipelineIds,
125-
});
128+
129+
const result = await sdk.workflows.list(requestOptions);
126130
Output.print(_.map(_.get(result, 'workflows.docs'), Workflow.fromResponse));
127131
}
128132
},

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

0 commit comments

Comments
 (0)