CircleCI build improvements (#3511)

* Make sure master builds tarball/docker image only when backend and frontend tests pass.

* Build a redash/preview image alongside redash/redash image.

* Fix version variable
This commit is contained in:
Arik Fraimovich 2019-02-28 15:23:47 +02:00 committed by GitHub
parent 549f878c98
commit a93741e64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 30 deletions

View File

@ -96,9 +96,7 @@ jobs:
- setup_remote_docker
- checkout
- run: .circleci/update_version
- 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: .circleci/docker_build
workflows:
version: 2
build:
@ -109,21 +107,23 @@ workflows:
- 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\/.*/
requires:
- backend-unit-tests
- frontend-unit-tests
- frontend-e2e-tests
filters:
branches:
only:
- master
- /release\/.*/
- build-docker-image:
requires:
- backend-unit-tests
filters:
branches:
only:
- master
- preview-build
- /release\/.*/
requires:
- backend-unit-tests
- frontend-unit-tests
- frontend-e2e-tests
filters:
branches:
only:
- master
- preview-image
- /release\/.*/

17
.circleci/docker_build Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
VERSION=$(jq -r .version package.json)
VERSION_TAG=$VERSION.b$CIRCLE_BUILD_NUM
docker login -u $DOCKER_USER -p $DOCKER_PASS
if [ $CIRCLE_BRANCH = master ] || [ $CIRCLE_BRANCH = preview-image ]
then
docker build -t redash/redash:preview -t redash/preview:$VERSION_TAG .
docker push redash/redash:preview
docker push redash/preview:$VERSION_TAG
else
docker build -t redash/redash:$VERSION_TAG .
docker push redash/redash:$VERSION_TAG
fi
echo "Built: $VERSION_TAG"

View File

@ -1,10 +0,0 @@
#!/bin/bash
if [ $CIRCLE_BRANCH = master ] || [ $CIRCLE_BRANCH = preview-build ]
then
FULL_VERSION='preview'
else
VERSION=$(jq -r .version package.json)
FULL_VERSION=$VERSION.b$CIRCLE_BUILD_NUM
fi
echo $FULL_VERSION