Split verification of buildKite
Background
Section titled BackgroundThe BuildKite setting in config page, the original api obtains verify and get info two parts, now it should be split.
AS-IS Design
Section titled AS-IS Design- Api Design
paths: api/v1/pipelines/{pipelineType}
method: post
request: {
PipelineParam:{
token:"your_token",
startTime: "xxx",
endTime:"xxx",
}
}
responses:{
"pipelineList":
[{
"id": "xxx",
"name": "xxx",
"orgId": "xxx",
"orgName": "xxx",
"repository": "xxx",
"steps": [
"xxx",
]
}]
}
- Sequence Diagram
Solutions
Section titled Solutions1. Verify the BuildKite token
Section titled 1. Verify the BuildKite tokenThe new api need to be called when the Verify button is clicked. If return 200, the verification is successful.Otherwise 401 exception will be thrown.
- Api Design
paths: api/v1/pipelines/{pipelineType}/verify
method: post
request: {
token: "your_token"
}
responses:
Status Code: 204
- Exception Handler
status | message | hintInfo |
400 | Token cannot be empty. | |
401 | Failed to get BuildKite info_status: 401 UNAUTHORIZED, reason: xxx | Token is incorrect |
403 | Failed to call BuildKite, because of insufficient permission! | Permission deny |
500 | Internal Server Error |
- Sequence Diagram
2. getBuildKiteInfo
Section titled 2. getBuildKiteInfoThe api should be called when entering the Metrics page. Only after two parts of data(The api and previous getPipelineSteps api) are obtained can the loading disappear.
- Api Design
paths: api/v1/pipelines/{pipelineType}/info
method: post
request: {
token:"your_token",
}
responses:{
"pipelineList":
[{
"id": "xxx",
"name": "xxx",
"orgId": "xxx",
"orgName": "xxx",
"repository": "xxx",
"steps": [
"xxx",
]
}]
}
When pipelineList is empty, responses 204
- Exception Handler
status | message | hintInfo |
400 | Token cannot be empty. | |
401 | Failed to get BuildKite info_status: 401 UNAUTHORIZED, reason: xxx | Token is incorrect |
403 | Failed to call BuildKite, because of insufficient permission! | Permission deny |
500 | Internal Server Error |
- Sequence Diagram