From d62d74727322c6b7c5a681eddefc4c9fee83a4d3 Mon Sep 17 00:00:00 2001 From: haroldwoo Date: Mon, 16 Jul 2018 08:26:46 -0700 Subject: [PATCH] [Bug 1473089] Migrate telemetry-analysis-service to circle2.0 (#1216) --- .circleci/config.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++ bin/deploy | 4 +-- circle.yml | 43 ------------------------------- 3 files changed, 63 insertions(+), 45 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..973509f9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,61 @@ +# These environment variables must be set in CircleCI UI +# +# DOCKERHUB_REPO - docker hub repo, format: / +# DOCKER_USER +# DOCKER_PASS +# + +version: 2 +jobs: + build: + machine: + enable: true + working_directory: ~/mozilla/telemetry-analysis-service + steps: + - checkout + - run: ./bin/build + + test: + machine: + enable: true + working_directory: ~/mozilla/telemetry-analysis-service + steps: + - checkout + - run: sudo apt-get update + - run: sudo apt-get install python-dev + - run: sudo pip install --upgrade pip + - run: pip install docker-compose + - run: docker info + - run: docker --version + - run: ./bin/test + + deploy: + machine: + enable: true + working_directory: ~/mozilla/telemetry-analysis-service + steps: + - checkout + - run: ./bin/build && ./bin/deploy + +workflows: + version: 2 + build-test-deploy: + jobs: + - build: + filters: + tags: + only: /.*/ + + - test: + filters: + tags: + only: /.*/ + + - deploy: + requires: + - test + filters: + tags: + only: /.*/ + branches: + only: master diff --git a/bin/deploy b/bin/deploy index 0b9f380d..bc1c66ef 100755 --- a/bin/deploy +++ b/bin/deploy @@ -22,7 +22,7 @@ function retry() { } echo "Logging into Docker hub" -retry 3 docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USER" -p="$DOCKER_PASS" +retry 3 docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" echo "Tagging app:build with $CIRCLE_TAG" docker tag app:build "$DOCKERHUB_REPO:$CIRCLE_TAG" || @@ -32,4 +32,4 @@ echo "Pushing tag $CIRCLE_TAG to $DOCKERHUB_REPO" retry 3 docker push "$DOCKERHUB_REPO:$CIRCLE_TAG" || (echo "Couldn't push $DOCKERHUB_REPO:$CIRCLE_TAG" && false) - echo "Pushed $DOCKERHUB_REPO:$TAG" +echo "Pushed $DOCKERHUB_REPO:$TAG" diff --git a/circle.yml b/circle.yml deleted file mode 100644 index a64a2f84..00000000 --- a/circle.yml +++ /dev/null @@ -1,43 +0,0 @@ -# These environment variables must be set in CircleCI UI -# -# DOCKERHUB_REPO - docker hub repo, format: / -# DOCKER_EMAIL - login info for docker hub -# DOCKER_USER -# DOCKER_PASS -# -machine: - pre: - # Install CircleCI's fork for Docker 1.10.0 - - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 - - chmod -R 777 $CIRCLE_TEST_REPORTS $CIRCLE_ARTIFACTS - services: - - docker - -dependencies: - pre: - - docker info - - sudo apt-get update - - sudo apt-get install python-dev - # run tests using an upgraded version of docker-compose - - pip install --upgrade docker-compose - override: - # build Docker image first to make sure it'll build correctly - - ./bin/build - -test: - override: - # run the tests using our test script - - ./bin/test - -deployment: - latest: - branch: master - commands: - # appropriately tag and push the container to dockerhub - - ./bin/deploy - - tags: - # push all tags - tag: /.*/ - commands: - - ./bin/deploy