HTTP 405 on `drone template add`

Trying to add in a template to our server so I can add a security pipeline in across all our repos. Whenever I go to add my template to the server, which the template runs as a .drone.yml file on its own, I get an error “client error 405:” and nothing else. Running the following: “drone template add --namespace [namespace] --name security_pipeline_v0.0.1-test.yaml --data @security_pipeline.yaml” I am authenticated and the account listed with “drone info” and then “drone user info [username]” lists that I’m an admin.

Any thoughts on where I can troubleshoot this further? Tried a few different template files and even swapped to a different users token.

@ShaneMalachow
I’m unable to replicate the issue you are seeing… what about using the drone UI to see if you can add the template? You’ll find it under the settings menu in your repo.
{owner}/{repo}/settings/templates

Going to any repo, I don’t seem to have a /settings/templates path. What version was that added in?

405 is a “method not allowed” error message. @ShaneMalachow did you look at your server logs with debug logs enabled to triage further?

There are two common root causes for a 405 method not allowed

  • You are using an older version of Drone server that does not support templates.
  • You configure the CLI to use the http address instead of https address. This often results in an auto-redirect from https to http which will convert a POST to a GET.

Keep in mind that the above are two common root causes. There could be other root causes but without more details (logs, version number, etc) it is difficult to advise further.

Looks like it was a version mismatch. Not sure of the exacts, since the logs just showed the POST request making it in without any errors. Basic issue seems to be I was on CLI version 1.3.0 and server 2.4.0 and needed to up my CLI to 1.4.0. Sorry for the the trivial issue!