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

Implement an API to trigger custom tasks #447

Merged
merged 1 commit into from Jul 2, 2015
Merged

Conversation

byroot
Copy link
Contributor

@byroot byroot commented Jul 2, 2015

Part of: #363

Requested by @dwradcliffe

Endpoint POST /api/stacks/:organization/:repository/:environment/task/:task_name

e.g: POST /api/shopify/shipit/production/task/restart.

@gmalette @davidcornu @dwradcliffe for review please.

@byroot byroot mentioned this pull request Jul 2, 2015
4 tasks
assert_json 'status', 'pending'
end

test "#trigger when the task doesn't exist" do
Copy link
Contributor

Choose a reason for hiding this comment

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

#trigger returns a 404 when the task doesn't exist


def trigger
render_resource stack.trigger_task(params[:task_name], current_user), status: :accepted
end
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to update the require_permission call for TasksController as trigger is more then a :read on :stack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:s very good point /o\

@davidcornu
Copy link
Contributor

Aside from the permissions issue LGTM

@byroot
Copy link
Contributor Author

byroot commented Jul 2, 2015

I've restricted it to deploy:stack. Since custom tasks can possibly do anything, I think deploying, rolling back and running a custom task should be the same permission.

@gmalette
Copy link
Contributor

gmalette commented Jul 2, 2015

👍

byroot added a commit that referenced this pull request Jul 2, 2015
Implement an API to trigger custom tasks
@byroot byroot merged commit d343ee9 into master Jul 2, 2015
@byroot byroot deleted the trigger-task-api branch July 2, 2015 19:50
@davidcornu
Copy link
Contributor

I've restricted it to deploy:stack. Since custom tasks can possibly do anything, I think deploying, rolling back and running a custom task should be the same permission.

👍

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.

None yet

3 participants