Confusing behaviour of drone build last


I was working on updating a release script which relies on getting the latest build number from Drone to use in a git tag. Looking through the CLI documentation, drone build last seemed to be exactly what I wanted, except that it defaults to the last build of the master branch.

To me this seems unintuitive - if I run drone build last I would expect it by default to give me info about the last build, no matter what triggered it, what branch it was building etc. Furthermore, I cannot seem to get drone build last to ignore this default setting of using the master branch, and operate in a way similar to drone build ls where there is no filtering done by default.

For the repo I’ve been working on, the latest Drone build is #14, triggered by a tag, but the latest Drone build of the (default) master branch is #13. I cannot get drone build last to return info about build #14, which was triggered by a tag.

Things I’ve tried:

  • drone build last --branch=’’ <repo_name> # i.e. passing an empty string as the branch - still returns the latest build for master
  • drone build last --branch /refs/tags/1.0.15 # this is the branch name given by drone build ls, but just gives “client error 500: sql: no rows in result set”

Do you have any suggestions on what I’m doing wrong? Or would it be possible to change the options of drone build last to be more like drone build ls?