diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-04-08 17:59:51 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-04-08 17:59:51 +0200 |
commit | 3cf92acb65f76fd5a922a6fbba4ef936cb01b2c3 (patch) | |
tree | cab8da7430ea1fb1fe5647940d65dbeaaf9e0a98 /.circleci | |
parent | f6013b2b6a26a23c6d06c1ee6748bc4515e83903 (diff) | |
parent | 755bc194dcea3481fa41b5884a98a5aa086fe09e (diff) | |
download | bugzilla-3cf92acb65f76fd5a922a6fbba4ef936cb01b2c3.tar.gz bugzilla-3cf92acb65f76fd5a922a6fbba4ef936cb01b2c3.tar.xz |
Merge remote-tracking branch 'bmo/master' into unstable
Diffstat (limited to '.circleci')
-rw-r--r-- | .circleci/build.sh | 12 | ||||
-rw-r--r-- | .circleci/config.yml | 32 | ||||
-rw-r--r-- | .circleci/deploy.sh | 25 |
3 files changed, 61 insertions, 8 deletions
diff --git a/.circleci/build.sh b/.circleci/build.sh new file mode 100644 index 000000000..7d476c85d --- /dev/null +++ b/.circleci/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -euf -o pipefail + +docker build \ + --build-arg CI="$CI" \ + --build-arg CIRCLE_SHA1="$CIRCLE_SHA1" \ + --build-arg CIRCLE_BUILD_URL="$CIRCLE_BUILD_URL" \ + -t bmo . + +docker run --name bmo --entrypoint true bmo +docker cp bmo:/app/version.json build_info/version.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 7183001b9..f5b35833a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,13 +5,6 @@ version: 2 -main_filters: &main_filters - branches: - ignore: - - /^(?:release|test)-20\d\d\d\d\d\d\.\d+/ - - /\// - - production - defaults: bmo_slim_image: &bmo_slim_image image: bugzilla/harmony-slim:20180318.1 @@ -20,6 +13,18 @@ defaults: mysql_image: &mysql_image image: mozillabteam/bmo-mysql:5.6 + store_log: &store_log + store_artifacts: + path: /app/bugzilla.log + destination: bugzilla.log + + main_filters: &main_filters + branches: + ignore: + - /^(?:release|test)-20\d\d\d\d\d\d\.\d+/ + - /\// + - production + bmo_env: &bmo_env PORT: 8000 LOGGING_PORT: 5880 @@ -83,12 +88,19 @@ jobs: --build-arg CIRCLE_SHA1="$CIRCLE_SHA1" \ --build-arg CIRCLE_BUILD_URL="$CIRCLE_BUILD_URL" \ -t bmo . + - attach_workspace: + at: /app/build_info + - run: "docker run --name bmo --entrypoint true bmo" + - run: "docker cp bmo:/app/version.json build_info/version.json" + - store_artifacts: + path: /app/build_info + - *store_log - deploy: command: | exit 0 test_sanity: - parallelism: 2 + parallelism: 1 working_directory: /app docker: - <<: *bmo_slim_image @@ -106,6 +118,7 @@ jobs: /app/scripts/entrypoint.pl prove -qf $(circleci tests glob 't/*.t' | circleci tests split) | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts + - *store_log test_webservices: parallelism: 1 @@ -120,6 +133,7 @@ jobs: /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts + - *store_log test_selenium: parallelism: 1 @@ -134,6 +148,7 @@ jobs: /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts + - *store_log test_bmo: parallelism: 1 @@ -159,6 +174,7 @@ jobs: mkdir artifacts - run: | /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t + - *store_log workflows: version: 2 diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh new file mode 100644 index 000000000..3d8a3852f --- /dev/null +++ b/.circleci/deploy.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -euf -o pipefail + +[[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0 +docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" + +if [[ "$CIRCLE_BRANCH" == "master" ]]; then + TAG="$(cat /app/build_info/tag.txt)" + [[ -n "$GITHUB_PERSONAL_TOKEN" ]] || exit 0 + if [[ -n "$TAG" && -f build_info/publish.txt ]]; then + git config credential.helper "cache --timeout 120" + git config user.email "$GITHUB_EMAIL" + git config user.name "$GITHUB_NAME" + git tag $TAG + git push https://${GITHUB_PERSONAL_TOKEN}:x-oauth-basic@github.com/$GITHUB_REPO.git $TAG + docker tag bmo "$DOCKERHUB_REPO:$TAG" + docker push "$DOCKERHUB_REPO:$TAG" + fi + docker tag bmo "$DOCKERHUB_REPO:latest" + docker push "$DOCKERHUB_REPO:latest" +elif [[ "$CIRCLE_BRANCH" == "development" ]]; then + docker tag bmo "$DOCKERHUB_REPO:build-${CIRCLE_BUILD_NUM}" + docker push "$DOCKERHUB_REPO:build-${CIRCLE_BUILD_NUM}" +fi |