File tree Expand file tree Collapse file tree 1 file changed +35
-19
lines changed Expand file tree Collapse file tree 1 file changed +35
-19
lines changed Original file line number Diff line number Diff line change 1
1
version : 2
2
+
2
3
jobs :
3
4
build :
4
- machine : true
5
- environment :
6
- CLOUDSDK_CORE_DISABLE_PROMPTS : 1
7
- PRIVATE_REGISTRY : us.gcr.io/code_climate
5
+ machine :
6
+ docker_layer_caching : false
7
+ working_directory : ~/codeclimate/codeclimate-gotvet
8
+ steps :
9
+ - checkout
10
+ - run : make image
8
11
12
+ release_images :
13
+ machine :
14
+ docker_layer_caching : false
15
+ working_directory : ~/codeclimate/codeclimate-gotvet
9
16
steps :
10
- # CircleCI 2.0 doesn't expand env vars yet so we have to do it manually.
11
- - run :
12
- name : Env
13
- command : |
14
- echo 'export IMAGE_NAME="${PRIVATE_REGISTRY}/${CIRCLE_PROJECT_REPONAME}:b${CIRCLE_BUILD_NUM}"' >> ${BASH_ENV}
15
17
- checkout
16
18
- run :
17
- name : Build image
18
- command : make image
19
- - run :
20
- name : Deployment
19
+ name : Validate owner
21
20
command : |
22
- if [ "${CIRCLE_BRANCH}" == "master" ]; then
23
- echo $gcloud_json_key_base64 | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
24
- curl https://sdk.cloud.google.com | bash
25
- gcloud auth activate-service-account --key-file /tmp/gcloud_key.json
26
- gcloud docker -a
27
- docker push ${IMAGE_NAME}
21
+ if [ "$CIRCLE_PROJECT_USERNAME" -ne "codeclimate" ]
22
+ then
23
+ echo "Skipping release for non-codeclimate branches"
24
+ circleci step halt
28
25
fi
26
+ - run : make image
27
+ - run : echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io
28
+ - run :
29
+ name : Push image to GCR
30
+ command : |
31
+ docker tag codeclimate/codeclimate-gotvet \
32
+ us.gcr.io/code-climate/codeclimate-gotvet:b$CIRCLE_BUILD_NUM
33
+ docker push us.gcr.io/code-climate/codeclimate-gotvet:b$CIRCLE_BUILD_NUM
29
34
35
+ workflows :
36
+ version : 2
37
+ build_deploy :
38
+ jobs :
39
+ - build
40
+ - release_images :
41
+ requires :
42
+ - build
43
+ filters :
44
+ branches :
45
+ only : /master|channel\/[\w-]+/
30
46
notify :
31
47
webhooks :
32
48
- url : https://cc-slack-proxy.herokuapp.com/circle
You can’t perform that action at this time.
0 commit comments