diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-05-20 20:10:19 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-05-20 20:10:19 -0700 |
commit | 2988edddd03b0a9a4c21b2312637617e028eeeff (patch) | |
tree | dbc29e6b061e2a1a6a1dbf9f6ea186371bcdd6c2 /home/bin | |
parent | ab499b5be52146bedfd1278789120d0b58116004 (diff) | |
download | dotfiles-2988edddd03b0a9a4c21b2312637617e028eeeff.tar.gz dotfiles-2988edddd03b0a9a4c21b2312637617e028eeeff.tar.bz2 dotfiles-2988edddd03b0a9a4c21b2312637617e028eeeff.zip |
Add convenience script to update drone-ci secrets
Diffstat (limited to 'home/bin')
-rwxr-xr-x | home/bin/drone-encsecrets | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/home/bin/drone-encsecrets b/home/bin/drone-encsecrets new file mode 100755 index 0000000..b341094 --- /dev/null +++ b/home/bin/drone-encsecrets @@ -0,0 +1,27 @@ +#!/bin/bash + +# Update drone-ci secrets + +# Get the repository of the current git project. +# The repository name is the username/project tuple of the origin remote. +REPO=${REPO:-$(git remote show origin -n | grep "Fetch URL:" | sed -e 's,.*:\(.*\),\1,' -e 's/\.git$//')} + +SECRETS_FILE="$HOME/.drone/secrets/$REPO/secrets.yml" + +echo "Generating secret for repository: $REPO" +echo "Using secrets from: $SECRETS_FILE" + +if [ ! -f "$SECRETS_FILE" ]; then + echo "Secrets file $SECRETS_FILE does not exist. Aborting.">&2 + exit 1 +fi + +drone \ + --server https://drone.jodersky.ch \ + --token $(pass infra/drone-token) \ + secure \ + --repo "$REPO" \ + -in "$SECRETS_FILE" \ + -out .drone.sec \ + --yaml .drone.yml \ + --checksum |