This repository has been archived by the owner on Jul 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
46 lines (35 loc) · 1.74 KB
/
circle.yml
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
35
36
37
38
39
40
41
42
43
44
45
machine:
services:
- docker
environment:
herd_service_name: hello
herd_unittest_cmd: python test_hello_service.py
herd_build_tag: $(cat $CIRCLE_PROJECT_REPONAME/Version)_build.$(echo $CIRCLE_SHA1 | cut -c1-7)
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
CLOUDSDK_PYTHON_SITEPACKAGES: 1
CLOUDSDK_COMPUTE_ZONE: us-central1-b
PATH: $PATH:/home/ubuntu/google-cloud-sdk/bin
dependencies:
cache_directories:
- ~/google-cloud-sdk
- ~/docker
override:
# install gcloud
- if [ ! -d ~/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
- ~/google-cloud-sdk/bin/gcloud components update preview
- curl --header X-CI-Token:$registry_password http://104.197.109.161/commit/$CIRCLE_PROJECT_REPONAME/$CIRCLE_BRANCH/$CIRCLE_BRANCH/$CIRCLE_SHA1; true
# build the image
- echo $gcloud_key | base64 --decode > gcloud.json; gcloud auth activate-service-account $gcloud_email --key-file gcloud.json; ssh-keygen -f ~/.ssh/google_compute_engine -N ""
- if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi
- docker build -t us.gcr.io/lexical-cider-93918/$herd_service_name:$herd_build_tag .
# cache the image to speed up the next build
- mkdir -p ~/docker; docker save us.gcr.io/lexical-cider-93918/$herd_service_name:$herd_build_tag > ~/docker/image.tar
test:
override:
- docker run us.gcr.io/lexical-cider-93918/$herd_service_name:$herd_build_tag $herd_unittest_cmd
deployment:
index:
branch: /.*/
commands:
- gcloud docker push us.gcr.io/lexical-cider-93918/$herd_service_name:$herd_build_tag
- curl --header X-CI-Token:$registry_password http://104.197.109.161/build/$CIRCLE_SHA1/us.gcr.io/lexical-cider-93918/$herd_service_name:$herd_build_tag?