background
Why I need to run schedule task separately via drone command line to drone server?
Because currently drone server doesn’t support schedule job.
The problem.
I can get build job list to a particular repository (via API /api/repos/:owner/:name/builds
or drone cli), but seems only latest 50 jobs mixed with push and deployment events
. When the schedule task runs every hour, build number easily increased to hundreds of deploy jobs, which I can’t find out the first available build job (push event
) on master branch.
I set a schedule task to
(1) get latest build number from master branch. I need exclude all deployment event builds first. support this build number is 50, and it is a push event
.
(2) Schedule task runs for one week every hour, generate 168 deployment event build. So the latest build number is 218.
(3) there is no update in last week.
Then the schedule task can’t find out what’s the latest push event build number, because drone build list
command only list latest 50 builds, they are all deployment event build, not push event build. For deploy, drone cli need a build number to run with.
drone deploy --branch master <owner>/<name> 50 development-apply
So can we simplify the deploy command, if provide the option of --branch
, always build from the latest commit from that branch? So I needn’t provide the build number every time.
Even if you can provide a command to get a full list of build numbers, it is not effective, because the schedule job can easily go up to thousands and more.