Skip to content

Commit

Permalink
Update Circle CI for our workflow
Browse files Browse the repository at this point in the history
- Use new master / rc release release strategy (#440)
- Migrate Circle CI 2.0 (#488, #502)
  • Loading branch information
robotblake authored and jezdez committed Dec 10, 2018
1 parent aceaaca commit 0f67e7b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 34 deletions.
85 changes: 51 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
name: Copy Test Results
command: |
mkdir -p /tmp/test-results/unit-tests
docker cp tests:/app/coverage.xml ./coverage.xml
docker cp tests:/app/coverage.xml ./coverage.xml
docker cp tests:/app/junit.xml /tmp/test-results/unit-tests/results.xml
- store_test_results:
path: /tmp/test-results
Expand Down Expand Up @@ -74,29 +74,41 @@ jobs:
- run:
name: Execute Cypress tests
command: docker-compose run cypress ./node_modules/.bin/cypress run
build-tarball:
deploy-master:
docker:
- image: circleci/node:8
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: sudo apt install python-pip
- run: npm install
- run: npm run bundle
- run: npm run build
- run: .circleci/update_version
- run: .circleci/pack
- store_artifacts:
path: /tmp/artifacts/
build-docker-image:
- run: ./bin/dockerflow-version "master"
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t $DOCKERHUB_REPO:master .
- run: docker push $DOCKERHUB_REPO:master
deploy-rc:
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: ./bin/dockerflow-version "rc"
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t $DOCKERHUB_REPO:rc .
- run: docker push $DOCKERHUB_REPO:rc
deploy-milestone:
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: .circleci/update_version
- run: ./bin/dockerflow-version "$CIRCLE_TAG"
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t redash/redash:$(.circleci/docker_tag) .
- run: docker push redash/redash:$(.circleci/docker_tag)
- run: docker build -t $DOCKERHUB_REPO:$CIRCLE_TAG .
- run: docker push $DOCKERHUB_REPO:$CIRCLE_TAG
# Create alias from tag to "latest"
- run: docker tag $DOCKERHUB_REPO:$CIRCLE_TAG $DOCKERHUB_REPO:latest
- run: docker push $DOCKERHUB_REPO:latest


workflows:
version: 2
build:
Expand All @@ -106,22 +118,27 @@ workflows:
- backend-unit-tests
- frontend-unit-tests
- frontend-e2e-tests
- build-tarball:
requires:
- backend-unit-tests
filters:
tags:
only: /v[0-9]+(\.[0-9\-a-z]+)*/
branches:
only:
- master
- /release\/.*/
- build-docker-image:
requires:
- backend-unit-tests
filters:
branches:
only:
- master
- preview-build
- /release\/.*/
- deploy-master:
requires:
- backend-unit-tests
filters:
branches:
only:
- master

- deploy-rc:
requires:
- backend-unit-tests
filters:
branches:
only:
- release

- deploy-milestone:
requires:
- backend-unit-tests
filters:
tags:
only: /^m[0-9]+(\.[0-9]+)?$/
branches:
ignore: /.*/
13 changes: 13 additions & 0 deletions bin/dockerflow-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -eo pipefail

VERSION="$1"

printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \
"$CIRCLE_SHA1" \
"$VERSION" \
"$CIRCLE_PROJECT_USERNAME" \
"$CIRCLE_PROJECT_REPONAME" \
"$CIRCLE_BUILD_URL" \
> version.json

0 comments on commit 0f67e7b

Please sign in to comment.