Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUA-958: Push images to Dockerhub instead of GCR #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: 2

jobs:
test:
machine:
docker_layer_caching: true
working_directory: ~/codeclimate/codeclimate-rubymotion
steps:
- checkout
- run: make image
- run: make test

release_images:
machine:
docker_layer_caching: true
working_directory: ~/codeclimate/codeclimate-rubymotion
steps:
- checkout
- run:
name: Validate owner
command: |
if [ "$CIRCLE_PROJECT_USERNAME" -ne "codeclimate" ]
then
echo "Skipping release for non-codeclimate branches"
circleci step halt
fi
- run: make image
- run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- run:
name: Push image to Dockerhub
command: |
make release RELEASE_TAG="b$CIRCLE_BUILD_NUM"
make release RELEASE_TAG="$(echo $CIRCLE_BRANCH | grep -oP 'channel/\K[\w\-]+')"

workflows:
version: 2
build_deploy:
jobs:
- test
- release_images:
context: Quality
requires:
- test
filters:
branches:
only: /master|channel\/[\w-]+/
notify:
webhooks:
- url: https://cc-slack-proxy.herokuapp.com/circle
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: image test release

IMAGE_NAME ?= codeclimate/codeclimate-rubymotion
RELEASE_REGISTRY ?= codeclimate

ifndef RELEASE_TAG
override RELEASE_TAG = latest
endif

image:
docker build --rm -t $(IMAGE_NAME) .

test: image
docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && bundle install --with=test && bundle exec rake"

release:
docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-rubymotion:$(RELEASE_TAG)
docker push $(RELEASE_REGISTRY)/codeclimate-rubymotion:$(RELEASE_TAG)
24 changes: 0 additions & 24 deletions circle.yml

This file was deleted.