I was really happy to see the
Drone Secret's page describe how to put secrets in a .drone.yml file. Checking passwords into repositories is a big no-no.
Still, there were some clarity in the docs I would have liked. Here's step by step.
1.
Install drone
Yep. This is the mac client. I did the manual way
curl http://downloads.drone.io/drone-cli/drone_darwin_amd64.tar.gz | tar zx
sudo cp drone /usr/local/bin
2. Set environment variables
You have Drone up, set the following in your .bash_profile or .login
export DRONE_SERVER=http://10.93.234.142
export DRONE_TOKEN=asdf23r213rrrawerqwerqwer....
The DRONE_TOKEN you can get by logging into drone and clicking on your profile. The settings area has that.
3. Create the secrets.yml file as shown in the docs.
4. Convert and check in!
drone secure --repo CiscoPipeline/kong-frontend --in secrets.yml --out .drone.sec
git add .drone.sec
git commit -am "added drone secrets"
git push
5. Secrets can be accessed in the .drone.yml file with the $${VARIABLE}
The example below shows the QUAY_PASSWD variable.
publish:
docker:
registry: quay.cisco.com
username: vbeninco
password: "$${QUAY_PASSWD}"
email: vbeninco@cisco.com
repo: ciscopipeline/kong-frontend
tag:
- "$${BUILD_NUMBER}"
- latest