pheex
(Pheex)
1
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.
pheex
(Pheex)
2
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.
appleboy
(Bo Yi Wu)
3
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:
pheex
(Pheex)
4
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 !
appleboy
(Bo Yi Wu)
5