I’ve been implementing the webapi for UCB to get some automated daily builds for our team, and I just have a couple questions about the API:
For “Create new build”:
What are the uses of “delay” and “commit” in the request parameters?
For many other requests, there is the “include” parameter for a querystring with the hint text: “Extra fields to include in the response” What extra fields are these referencing? I found in “List all build targets” that “settings” or “credentials” were options – are those the only two options available.
I also found a few bugs:
It seems there may be something wrong with swagger-codegen, or the API specification, as it failed everytime I tried to use it. Since the UCB API is simple enough, I just rolled something with my own tools.
Not sure if this is a bug or not, but ‘scmBranch’ is not included in “Get Build Status”, but is included elsewhere when builds are populated in a list.
Looking forward to using these scripts, I plan to create a cronjob on our server to run daily builds in the morning (builds every commit aren’t necessary for our team), and I’m trying to get an integration with our slackbot so people could theoretically request a build midday if important changes went in that required a new build.
I’d like to add one more comment on this – Create Build currently returns 202 Accepted as a response status. This was causing an error on the library I’m using to create my tools, so I dug in to figure out what was going on.
It makes sense what you’re trying to do by using 202, saying that the build isn’t completed yet, but will be at some point in the future. However when you use this response code, you should be providing another resource that the client could poll or otherwise estimate when the request would be completed. My client was looking for something in the content-location header so it could poll it until it got a 200 or 303 response.
Seems like it would make sense for this API to simply return status 200 once the create build request is received, with the appropriate response described in the docs.
Same comment goes for “Create polling jobs”.
(disclaimer: I could be misreading the HTTP spec here though, feel free to slap me down if I’m wrong about this one.)
Looking like our documentation needs some clarification, but I’ll provide answers here as well.
Create new build:
delay (optional) - time (in milliseconds) before starting the build
commit (optional) - build from a specific commit rather than HEAD
include parameter - this is typically just extra information used by our website
Bugs:
swagger-codegen / API spec: I thought this was working. I will look into it
scmBranch should show up in the build status now (was recently addeded)
202 for create build - will look into it. In general we haven’t been super strict on following the spec, but we really should be paying more attention to that. Thanks for pointing that out.