Skip to content

Commit 5ff2542

Browse files
authored
Use built-in gcloud command. (google#143)
Remove the gcloud installation part during a build is running
1 parent 8a8580a commit 5ff2542

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

Diff for: circle.yml

+10-25
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,42 @@
11
machine:
22
environment:
3-
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
4-
CLOUDSDK_PYTHON_SITEPACKAGES: 1
5-
CLOUDSDK_INSTALL_DIR: /tmp
63
MAX_RETRY: 4
74
java:
85
version: oraclejdk8
96

107
dependencies:
118
pre:
129
- echo y | android update sdk --no-ui --all --filter "android-25,build-tools-25.0.0,tools,platform-tools,extra-android-m2repository"
13-
# For some reasons, there is an issue with the pre-installed gcloud that
14-
# PyOpenSSL is not available when trying to activate the service account.
15-
# Re-installing the gcloud worked as a workaround.
16-
# See https://discuss.circleci.com/t/deployment-to-appengine-fails-pyopenssl-not-available/2154
17-
18-
# Suppress the gcloud installation if the PR is from a forked repository
19-
# Because environment variables configured from the Circle CI UI are not
20-
# visible for the PRs from forked repositories.
21-
- >
22-
if [ -n "$GCLOUD_SERVICE_KEY" ]; then sudo apt-get remove python-virtualenv python-openssl python3-openssl ;
23-
sudo apt-get update;
24-
sudo apt-get install python-openssl python3-openssl ;
25-
sudo rm -rf /opt/google-cloud-sdk/ ;
26-
curl https://sdk.cloud.google.com | bash ;
27-
source ~/.bashrc ;
28-
fi
2910
cache_directories:
3011
- ~/.android
3112
override:
3213
- ./gradlew dependencies
3314
post:
3415
- >
3516
if [ -n "$GCLOUD_SERVICE_KEY" ]; then echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ${HOME}/client-secret.json ;
36-
/tmp/google-cloud-sdk/bin/gcloud config set project ${GCLOUD_PROJECT} ;
37-
/tmp/google-cloud-sdk/bin/gcloud --quiet components update ;
38-
/tmp/google-cloud-sdk/bin/gcloud --quiet components install beta ;
39-
/tmp/google-cloud-sdk/bin/gcloud auth activate-service-account ${GCLOUD_SERVICE_ACCOUNT} --key-file ${HOME}/client-secret.json ;
17+
gcloud config set project ${GCLOUD_PROJECT} ;
18+
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update ;
19+
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components install beta ;
20+
gcloud auth activate-service-account ${GCLOUD_SERVICE_ACCOUNT} --key-file ${HOME}/client-secret.json ;
4021
fi
4122
4223
test:
4324
override:
4425
- ./gradlew build assembleAndroidTest
4526
- >
27+
# Suppress running the instrumentation tests if the PR is from a forked repository
28+
# because environment variables configured from the Circle CI UI are not
29+
# visible for the PRs from forked repositories that are required to run the tests
30+
# on the Firebase Test Lab.
4631
if [ -n "$GCLOUD_SERVICE_KEY" ]; then set +e ;
4732
counter=0 ;
4833
result=1 ;
4934
while [ $result != 0 -a $counter -lt $MAX_RETRY ]; do
50-
/tmp/google-cloud-sdk/bin/gcloud beta test android run --type instrumentation --app app/build/outputs/apk/app-debug.apk --test flexbox/build/outputs/apk/flexbox-debug-androidTest.apk --device-ids hammerhead,flounder,condor_umts --os-version-ids 19,21,23 --locales en --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s ;
35+
gcloud beta test android run --type instrumentation --app app/build/outputs/apk/app-debug.apk --test flexbox/build/outputs/apk/flexbox-debug-androidTest.apk --device-ids hammerhead,flounder,condor_umts --os-version-ids 19,21,23 --locales en --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s ;
5136
result=$? ;
5237
let counter=counter+1 ;
5338
done
5439
exit $result ;
5540
fi
5641
post:
57-
- if [ -n "$GCLOUD_SERVICE_KEY" ]; then /tmp/google-cloud-sdk/bin/gsutil -m cp -r -U `/tmp/google-cloud-sdk/bin/gsutil ls gs://${GCLOUD_TEST_BUCKET_LIBRARY} | tail -1` $CIRCLE_ARTIFACTS/ | true ; fi
42+
- if [ -n "$GCLOUD_SERVICE_KEY" ]; then gsutil -m cp -r -U `gsutil ls gs://${GCLOUD_TEST_BUCKET_LIBRARY} | tail -1` $CIRCLE_ARTIFACTS/ | true ; fi

0 commit comments

Comments
 (0)