Skip to content

Commit 6a1a5f4

Browse files
Merge pull request #24 from codeclimate-community/fe/circle2
Add correct steps for shipbot to pick it up
2 parents 9d0b4e7 + 7d013fa commit 6a1a5f4

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

.circleci/config.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,48 @@
11
version: 2
2+
23
jobs:
34
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
811

12+
release_images:
13+
machine:
14+
docker_layer_caching: false
15+
working_directory: ~/codeclimate/codeclimate-gotvet
916
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}
1517
- checkout
1618
- run:
17-
name: Build image
18-
command: make image
19-
- run:
20-
name: Deployment
19+
name: Validate owner
2120
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
2825
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
2934
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-]+/
3046
notify:
3147
webhooks:
3248
- url: https://cc-slack-proxy.herokuapp.com/circle

0 commit comments

Comments
 (0)