File: travis_encrypt_gbq.sh

package info (click to toggle)
pandas 1.1.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 47,284 kB
  • sloc: python: 292,793; ansic: 8,591; sh: 608; makefile: 94
file content (34 lines) | stat: -rwxr-xr-x 925 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

GBQ_JSON_FILE=$1

if [[ $# -ne 1 ]]; then
    echo -e "Too few arguments.\nUsage: ./travis_encrypt_gbq.sh "\
    "<gbq-json-credentials-file>"
    exit 1
fi

if [[ $GBQ_JSON_FILE != *.json ]]; then
    echo "ERROR: Expected *.json file"
    exit 1
fi

if [[ ! -f $GBQ_JSON_FILE ]]; then
    echo "ERROR: File $GBQ_JSON_FILE does not exist"
    exit 1
fi

echo "Encrypting $GBQ_JSON_FILE..."
read -d "\n" TRAVIS_KEY TRAVIS_IV <<<$(travis encrypt-file -r pandas-dev/pandas $GBQ_JSON_FILE \
travis_gbq.json.enc -f | grep -o "\w*_iv\|\w*_key");

echo "Adding your secure key to travis_gbq_config.txt ..."
echo -e "TRAVIS_IV_ENV=$TRAVIS_IV\nTRAVIS_KEY_ENV=$TRAVIS_KEY"\
> travis_gbq_config.txt

echo "Done. Removing file $GBQ_JSON_FILE"
rm $GBQ_JSON_FILE

echo -e "Created encrypted credentials file travis_gbq.json.enc.\n"\
     "NOTE: Do NOT commit the *.json file containing your unencrypted" \
     "private key"