Cannot use CLI without access_token


I’m using docker to setup a drone instance pointing to gitea (which works well, I can manually login to drone using the gitea user accounts).

I have a chicken and egg problem: I want to use the drone cli to programatically setup drone (on initialisation). I want to add/register user/repos at startup, however I can’t connect to the server without a user access token (which requires a user).

What can I do?

  • is there a convention I can use to determine a user’s access token? (e.g. is it derived from gitea?)
  • is there a global access token I can use? (i.e. not specific to a user)
  • is there a (docker) environment parameter I can use, to set a global access token?
  • if the user existed in the database, can the access token be retrieved/set from the database? (e.g. could I overwrite this field in the DB?)


    image: drone/drone:0.8.5
    restart: always
      - "8000:8000"
      - "9000:9000"
      - build_data:/var/lib/drone/
    restart: always
      DRONE_OPEN: "true"
      DRONE_ORGS: somecompany
      DRONE_HOST: http://build:8000
      DRONE_GITEA: "true"
      DRONE_GITEA_URL: http://web:3000
      DRONE_SECRET: abcd1234
      DRONE_DATABASE_DATASOURCE: drone:drone@tcp(build_db:3306)/drone?parseTime=true

When you login in the UI with a gitea user credentials the user is automatcly created and you can use the access_token for that user.
You cand find your access token in the token section of the menu.

Thanks for the reply. I wanted to automate the setup of the Drone server (not require the user to manually login).

Is there anyway to automatically/programatically do this instead?

Mmm… I understand your problem now, I can’t find a solution for what you are trying to do. I think that you must always login in the ui first to get the token.

With the current version of Drone it’s not possible to entirely automated it beside some hacking directly on the database. But there are plans to introduce some initial machine/admin user, with that it would be possible to entirely automate that process. If I remember correctly it’s planned for 0.9 or maybe 0.10.