Skip to content

Commit 10976c1

Browse files
committed
DOC: Simplify the gbq integration testing procedure for contributors
1 parent 7f5a45c commit 10976c1

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

ci/travis_encrypt_gbq.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/bin/bash
22

33
GBQ_JSON_FILE=$1
4-
GBQ_PROJECT_ID=$2
54

6-
if [[ $# -ne 2 ]]; then
5+
if [[ $# -ne 1 ]]; then
76
echo -e "Too few arguments.\nUsage: ./travis_encrypt_gbq.sh "\
8-
"<gbq-json-credentials-file> <gbq-project-id>"
7+
"<gbq-json-credentials-file>"
98
exit 1
109
fi
1110

@@ -23,9 +22,9 @@ echo "Encrypting $GBQ_JSON_FILE..."
2322
read -d "\n" TRAVIS_KEY TRAVIS_IV <<<$(travis encrypt-file $GBQ_JSON_FILE \
2423
travis_gbq.json.enc -f | grep -o "\w*_iv\|\w*_key");
2524

26-
echo "Adding your secure key and project id to travis_gbq_config.txt ..."
27-
echo -e "TRAVIS_IV_ENV=$TRAVIS_IV\nTRAVIS_KEY_ENV=$TRAVIS_KEY\n"\
28-
"GBQ_PROJECT_ID='$GBQ_PROJECT_ID'" > travis_gbq_config.txt
25+
echo "Adding your secure key to travis_gbq_config.txt ..."
26+
echo -e "TRAVIS_IV_ENV=$TRAVIS_IV\nTRAVIS_KEY_ENV=$TRAVIS_KEY"\
27+
> travis_gbq_config.txt
2928

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

ci/travis_gbq_config.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
TRAVIS_IV_ENV=encrypted_1d9d7b1f171b_iv
22
TRAVIS_KEY_ENV=encrypted_1d9d7b1f171b_key
3-
GBQ_PROJECT_ID='pandas-travis'

ci/travis_process_gbq_encryption.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
source ci/travis_gbq_config.txt
44

5-
if [[ -n ${!TRAVIS_IV_ENV} ]]; then
5+
if [[ -n ${SERVICE_ACCOUNT_KEY} ]]; then
6+
echo "${SERVICE_ACCOUNT_KEY}" > ci/travis_gbq.json;
7+
elif [[ -n ${!TRAVIS_IV_ENV} ]]; then
68
openssl aes-256-cbc -K ${!TRAVIS_KEY_ENV} -iv ${!TRAVIS_IV_ENV} \
79
-in ci/travis_gbq.json.enc -out ci/travis_gbq.json -d;
8-
export GBQ_PROJECT_ID=$GBQ_PROJECT_ID;
10+
export GBQ_PROJECT_ID='pandas-travis';
911
echo 'Successfully decrypted gbq credentials'
1012
fi
1113

doc/source/contributing.rst

+16-14
Original file line numberDiff line numberDiff line change
@@ -643,20 +643,22 @@ on Travis-CI and are only accessible from the pandas-dev/pandas repository. The
643643
credentials won't be available on forks of pandas. Here are the steps to run
644644
gbq integration tests on a forked repository:
645645

646-
#. First, complete all the steps in the `Encrypting Files Prerequisites
647-
<https://docs.travis-ci.com/user/encrypting-files/>`__ section.
648-
#. Sign into `Travis <https://travis-ci.org/>`__ using your GitHub account.
649-
#. Enable your forked repository of pandas for testing in `Travis
650-
<https://travis-ci.org/profile/>`__.
651-
#. Run the following command from terminal where the current working directory
652-
is the ``ci`` folder::
653-
654-
./travis_encrypt_gbq.sh <gbq-json-credentials-file> <gbq-project-id>
655-
656-
#. Create a new branch from the branch used in your pull request. Commit the
657-
encrypted file called ``travis_gbq.json.enc`` as well as the file
658-
``travis_gbq_config.txt``, in an otherwise empty commit. DO NOT commit the
659-
``*.json`` file which contains your unencrypted private key.
646+
#. Go to `Travis CI <https://travis-ci.org/>`__ and sign in with your GitHub
647+
account.
648+
#. Click on the ``+`` icon next to the ``My Repositories`` list and enable
649+
Travis builds for your fork.
650+
#. Click on the gear icon to edit your travis build, and add two environment
651+
variables:
652+
653+
- ``GBQ_PROJECT_ID`` with the value being the ID of your BigQuery project.
654+
655+
- ``SERVICE_ACCOUNT_KEY`` with the value being the contents of the JSON key
656+
that you downloaded for your service account. Use single quotes around
657+
your JSON key to ensure that it is treated as a string.
658+
659+
For both environment variables, keep the "Display value in build log" option
660+
DISABLED. These variables contain sensitive data and you do not want their
661+
contents being exposed in build logs.
660662
#. Your branch should be tested automatically once it is pushed. You can check
661663
the status by visiting your Travis branches page which exists at the
662664
following location: https://travis-ci.org/your-user-name/pandas/branches .

0 commit comments

Comments
 (0)