Can't cancel builds with pending state

A pipeline step had privileged: true but wasn’t configured as trusted so the build got rejected but stills shows as pending, the UI only shows Restart and not Cancel option, even tho I’ve tried to run drone build stop [build-number] I only got 404 error.

If I do drone build queue the pending build stays there.

Are you running 0.8 latest (the final release). If not or you are not sure, please upgrade and attempt to repeat. If yes, please provide exact steps to reproduce.

Quick update – I could not repeat this behavior. I get an error message in the user interface indicating the yaml validation failed. I am also prevented from restarting a build with an error status.

Note that there were a number of bug fixes prior to the last 0.8 tag, so please ensure you have the latest.

I’m able to reproduce it with a private repo, tried on a new server with public repo and didn’t reproduce it.

Steps to reproduce it
1.- Private repo
2.- Trigger a build with privileged: true & the repo setting as trusted.
3.- Remove the trusted setting for the repo.
4.- Restart the previous build and the new build will stuck.

I’ve made it public again if you want to take a look.

On the original repo I just made it trusted again it was a mistake but now I have a few builds with pending state that I can’t remove or cancel.

ah ok, yes, changing from trusted to untrusted and then re-starting the build caused a problem. The system assumes that a build that previously executed without error can be safely restarted without performing certain bounds checks. Changing the trusted flag to false would cause a linting error on restart. So it looks like you found an edge case where that assumption does not hold true, resulting in an uncaught exception in the code.

Uncaught exceptions, because they are not expected, can put a build in an inconsistent state and therefore prevent it from being cancelled. You can go into the database and run the following command to resolve:

update builds set build_status = 'error'
where build_status='pending'

Thanks! I’ve cleaned the pending builds.