Cron doesn't trigger for a branch name with a slash in the name

We’ve been using Drone (1.x) Cron successfully for some time with a simple branch name such as version or main. However, when we try to add a Cron with a branch name such as release/version/1.0.0, we note that the Cron is never triggered (or if it is, nothing shows in the Drone UI/Logs).

Our pipeline is defined using Starlark in a file; converting this to .drone.yaml using the drone starlark command also gives no output for such branch names, for example:

drone starlark --build.event cron --build.branch version --build.commit my-commit --stdout

outputs the expected set of pipeline definitions to STDOUT, while

drone starlark --build.event cron --build.branch release/version/1.0.0 --build.commit my-commit --stdout

outputs an empty YAML document:

Hello @Chris_S
Thank you for reaching out to Harness Support. This does seem like an odd occurrence, could you please share with us the Drone Server logs from the Pod when the cron command is executed manually?

Looking Forward to hearing from you.

Thanks & Regards,
Harness Support

Unfortunately I don’t have access to the Drone Server logs as it’s a managed service used by multiple tennants - I’ll ask whether there’s anything the managed service provider can extract for us to paste here in future

The only logs we’ve been able to find via our managed service support team is:

{"branch":"master","cron":571,"error":"","level":"warning","msg":"cron: cannot find commit","repo":"our/repo","time":"2021-12-01T09:24:23Z"}

Confusingly this log indicates a branch of master whereas we’d explicitly specified a branch of release/version/4.0.0 in our Drone cron job to run at 09:00 yesterday.

Resetting our cron job to our normal version branch allowed it to run successfully this morning. So definitely something going wrong on the Drone side it seems.


We’re running the latest version (2.8.0) of Drone and I’m seeing the same problem.
When you the target branch of a cron job has a “/” (slash) it won’t trigger.

I did some debugging though, it has something to do with the url encoding of the slash in the branch name.
If I for example create a cron job, with the target branch release%2Fversion instead of release/version the cron job does start running (I see the correct steps and name for the pipeline in the build). But now the clone step now fails due to it searching for a ref which doesn’t exist (fatal: couldn't find remote ref refs/heads/release%2Fversion).

It’s not the UI having the problem though, because when I create the cron job using the API, I have the same problem.

When trying to trigger the cron job (again with the correct branch name, including the slash) using the API, drone returns the following empty message: {"message":""}

All the testing I did was not with starlark btw, just normal yaml config files.