Drone orgsecret add failing on windows

Hey Team,

I’ve noticed that I can’t push up an orgsecret.

  • We are using drone v1.2.1
  • We are using drone-cli v1.1.0
  • Also tested with drone-cli v1.1.1
  • We are on windows
  • I am configured as a drone admin user.

At any level of using the add command (even when providing an actual secret) it comes back with the following:

invalid character '<' looking for beginning of value

See the following:

The most common root cause of this error is when you use the http:// drone server address instead of the https:// address, which results in an auto-redirect. An http redirect returns the following html document, instead of the expected json object:

HTTP/1.1 301 Moved Permanently
Connection: close
Date: Wed, 12 Jun 2019 22:23:32 GMT
Content-Length: 52
Content-Type: text/html; charset=utf-8

<a href="https://drone.io/">Moved Permanently</a>.

The invalid < refers to the a tag where a json object is expected.

Another common root cause is proxy misconfiguration. In either case, I can confirm that organization secrets are working with the latest version of Drone and the CLI.

Okay, I lied - turns out I deployed drone:1.2.1

I downgraded server to 1.1.0 and it worked.
So maybe an incompatibility between cli 1.1.0 and server 1.2.1?

I tested Drone Server 1.2.1 with the latest build of the CLI from master and it is working as expected. I would expect it to work with CLI 1.1.0 but I didn’t have time to downgrade my version to test. The commit history didn’t indicate anything with org secrets changed since 1.1.0, nor have we received other reports of issues.

$ drone orgsecret add drone foo bar
$ drone orgsecret ls
foo 
Organization:       drone
Pull Request Read:  false
Pull Request Write: false

invalid character ‘<’ looking for beginning of value

You never mentioned if you checked the autoredirect from http to https or if there was a reverse proxy involved. I just want to rule out the most common root cause.