Skip to content

Commit

Permalink
moved proxy start to after gcloud configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
shubha-rajan committed May 6, 2020
1 parent 8adccbd commit 27b4e66
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ elif [[ $SQL_CLIENT == 'mysql' ]]; then
export CONNECTION_NAME=$(cat $KOKORO_GFILE_DIR/secrets-mysql-connection-name.txt)
fi

# Download and run the proxy if testing a Cloud SQL sample
if [[ -z "${SQL_CLIENT}" ]]; then
wget --quiet https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy
if [[ $SQL_CLIENT == 'sqlserver' ]]; then
./cloud_sql_proxy -instances="${CONNECTION_NAME}"=tcp:1433 &>> cloud_sql_proxy.log &
else
sudo mkdir /cloudsql; sudo chmod 777 /cloudsql
./cloud_sql_proxy -dir=/cloudsql -instances="${CONNECTION_NAME}" &>> cloud_sql_proxy.log &
fi
echo -e "\nCloud SQL proxy started."
fi

# Configure Sendgrid variables
export SENDGRID_SENDER="test@google.com"
Expand Down Expand Up @@ -103,6 +91,20 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json
gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
gcloud config set project $GCLOUD_PROJECT

# Download and run the proxy if testing a Cloud SQL sample
set -x
if [[ $SQL_CLIENT ]]; then
wget --quiet https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy
if [[ $SQL_CLIENT == 'sqlserver' ]]; then
./cloud_sql_proxy -instances="${CONNECTION_NAME}"=tcp:1433 &>> cloud_sql_proxy.log &
else
mkdir /cloudsql; chmod 777 /cloudsql
./cloud_sql_proxy -dir=/cloudsql -instances="${CONNECTION_NAME}" &>> cloud_sql_proxy.log &
fi
fi
set +x

# If tests are running against master, configure Build Cop
# to open issues on failures:
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"release"* ]]; then
Expand Down

0 comments on commit 27b4e66

Please sign in to comment.