Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP adds apiV2 workflow put - execution support #85

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

rwese
Copy link
Contributor

@rwese rwese commented Dec 16, 2019

No description provided.

Copy link
Member

@mmitteregger-bearingpoint mmitteregger-bearingpoint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that the PR is marked as WIP.
I still did an early review so that you can address the requested changes before the final review.:smile:

* ),
* @OA\Response(
* response=200,
* description="CI saved successfully",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the description.
Async workflow executions should return 202 Accepted instead.

* ),
* @OA\Response(
* response=400,
* description="Workflow failed",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

400 Bad Request shouldn't be used for failed workflows.
The client SHOULD NOT repeat the request without modifications.
This is not the case here.

The client did nothing wrong. This is an error that should be resolved on the server side, so 500 Internal Server Error is more appropriate here.

The status code should still be used and documented for request validations like incorrect startAt format.

$result = $workflowService->startWorkflow($workflowRow[Db_Workflow::ID], $userId, $params, false, $forceAsync, $startAt);
unset($result['log']);

//TODO Return also the instance id

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Friendly reminder for the TODO comment :)

} catch (Exception $e) {
$this->logger->logf('Workflow failed: %s', Zend_Log::CRIT, $workflowName);
$this->logger->log($e, Zend_Log::CRIT);
$this->outputError('Executing workflow failed', null, 400);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated for the documentation above this should rather be status code 500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants