Trigger a build per branch from a REST API

Hi all,

I am testing drone in order to replace Jenkins into our company. I really enjoyed the concepts but I could not figure out a way to tigger a build for a specific branch. Ideally I would like to build on a specific branch using the Rest API.

Any ideas?

Regards

1 Like

there is an API call for this, see https://github.com/drone/drone/issues/2679

@ashwilliams1, good catch. I tried and had no success…

as stated at the end of the post, the parameters are ignored and it seems things did not evolve since:

for key, value := range r.URL.Query() {
if key == “access_token” ||
key == “commit” ||
key == “branch” {
continue
}
if len(value) == 0 {
continue
}
hook.Params[key] = value[0]
}

as stated at the end of the post, the parameters are ignored and it seems things did not evolve since:

The comment that states custom parameters are ignored was from May 13. Support for custom parameters was subsequently added on May 20.

Note that the comment is referring to custom parameters which is why we explicitly ignore reserved keywords (token, commit, branch) which we read and use in other parts of the code.

I have tested this feature and can confirm it works, although it may not work for some providers due to limitations with their API (I am specifically thinking of Gogs).

Late reply but thanks for the update.

if I do post to this:

http://<MY_HOST>/api/repos/ORG/REPO/builds?branch=feature/F-1

I do get this:

{
“message”: “Not Found”
}

But I use Gitea…

Thanks again