[solved] Drone 0.5 use multi secret for one plugin?

Hi,

I want to use declare many time plugin appleboy/drone-ssh in my drone.yml in order to deploy on my differents env (dev, staging, prod)
ex :

deploy-dev:
image: appleboy/drone-ssh
port: 22
script:

deploy-prod:
image: appleboy/drone-ssh
port: 22
script:

I use secret for host, login, and password
ex: drone secret add --image=appleboy/drone-ssh --skip-verify=true myorg/myrepo PLUGIN_USERNAME myusername

But since secret apply on all the repo, how can i define differents secret for my differents env ?

With 0.4 drone, it thing it’s working because notation is quite different.

Ok, so i managed this case like this:

deploy-dev:
image: appleboy/drone-ssh
port: 22
script:
- myscript
environment:
- PLUGIN_HOST=${DEV_HOST}
- PLUGIN_USERNAME=${DEV_LOGIN}
- PLUGIN_PASSWORD=${DEV_PASSWORD}

deploy-prod:
image: appleboy/drone-ssh
port: 22
script:
- myscript
environment:
- PLUGIN_HOST=${PROD_HOST}
- PLUGIN_USERNAME=${PROD_LOGIN}
- PLUGIN_PASSWORD=${PROD_PASSWORD}

and declare MYHOST_* secrets instead of PLUGIN_* secrets.

Hi @pheex, you can add multiple secrets on yaml config. Please remove --image from secret command.

# for deploy-dev
drone secret add --skip-verify=true myorg/myrepo DEV_HOST a.com
drone secret add --skip-verify=true myorg/myrepo DEV_USER b

# for deploy-prod
drone secret add --skip-verify=true myorg/myrepo PROD_HOST b.com
drone secret add --skip-verify=true myorg/myrepo PROD_USER b

Then update yaml config

deploy-dev:
  image: appleboy/drone-ssh
  port: 22
  host: ${DEV_HOST}
  username: ${DEV_USER}
  script:

deploy-prod:
  image: appleboy/drone-ssh
  port: 22
  host: ${PROD_HOST}
  username: ${PROD_USER}
  script:

thx
I’ve just read this https://github.com/drone/drone/issues/1888

I 'm thinking that the good approach with drone 0.5 is http://readme.drone.io/0.5/secrets-with-plugins/
and 0.4 approach will be deprecated in future, but it’s the opposite !

new document is here. http://readme.drone.io/usage/secret-guide/