Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

create an Approval REST API #65

Open
jstrachan opened this issue Nov 4, 2016 · 2 comments
Open

create an Approval REST API #65

jstrachan opened this issue Nov 4, 2016 · 2 comments

Comments

@jstrachan
Copy link
Contributor

we want to have a canonical service in Jenkinsfiles to do approvals and allow different environments to use different approval systems.

e.g. we want our Jenkinsfiles to do something like:

// lets wait for approval or timeout/fail if not
approve(namespace = "cheese", project = "beer", environment = "production", action = "promote")
 
// now promote to production
}

So we should create an Approval Service REST API and consumer contract. Then we can create a few implementations:

  • reuse the current chatops chat bot option
  • a noop (no approval)
  • plugin a Drools / jBPM solution: https://issues.jboss.org/browse/DROOLS-1355
  • a simple issue tracker implementation, e.g. using gitlab to raise an issue for approval and wait for the issue to be marked as fixed
@jstrachan
Copy link
Contributor Author

I guess we could even use a ThirdPartyResource for the Approval so apps could watch its status; though I worry about it being too easy for some bad app to update the TPR :) So a simple REST API to poll is maybe simpler ;)

@jstrachan
Copy link
Contributor Author

jstrachan commented Nov 9, 2016

maybe the REST API should just be you POST some YAML/JSON key/value to the service URL and get back a Location header of the URL to GET to find the status of the approval (process instance ID / issue or whatever).

POST https://approver
Content-Type: text/yaml; charset=utf-8

namespace: "cheese"
project: "beer"
environment: "production"
action: "promote"

then the Location is returned to where to poll for the status:

HTTP/1.1 201 Created
Content-Length: 40
Content-Type: text/plain; charset=utf-8
Location: https://approver/approvals/1234

Then the client can GET the status at any time:

GET https://approver/approvals/1234

and the results could be something like

status: Pending
durationMillis: 23456
createdTime: ...

Where status is one of Pending, Approved, Rejected

At least that simple API would give us a head start until we need something more complex?

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

No branches or pull requests

1 participant