From 0d820e69bc52f5ee1f9f1ea89eb83b82d83550db Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 4 Apr 2018 09:57:20 -0400 Subject: no bug - circleci config tweaks --- .circleci/config.yml | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index f5c761af4..1283d573b 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: mozillabteam/bmo-slim:20180330.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 @@ -81,6 +86,8 @@ jobs: name: build push data command: | mv /opt/bmo/local /app/local + perl Makefile.PL + perl -I/app -I/app/local/lib/perl5 -MBugzilla -e 1 perl checksetup.pl --no-database --no-templates --no-permissions perl scripts/build-bmo-push-data.pl - run: @@ -115,6 +122,7 @@ jobs: paths: ["*.txt"] - store_artifacts: path: /app/build_info + - *store_log build: working_directory: /app @@ -138,6 +146,7 @@ jobs: - run: "docker cp bmo:/app/version.json build_info/version.json" - store_artifacts: path: /app/build_info + - *store_log - deploy: command: | TAG="$(cat /app/build_info/tag.txt)" @@ -158,7 +167,7 @@ jobs: docker push "$DOCKERHUB_REPO:latest" test_sanity: - parallelism: 2 + parallelism: 1 working_directory: /app docker: - <<: *bmo_slim_image @@ -181,6 +190,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 @@ -199,6 +209,7 @@ jobs: /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts + - *store_log test_selenium: parallelism: 1 @@ -217,6 +228,7 @@ jobs: /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts + - *store_log test_bmo: parallelism: 1 @@ -246,6 +258,7 @@ jobs: - run: | [[ -f build_info/only_version_changed.txt ]] && exit 0 /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t + - *store_log workflows: version: 2 -- cgit v1.2.3-24-g4f1b From 85a2490e1e696c8d62562f8752fc486c02578ec3 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 4 Apr 2018 10:37:09 -0400 Subject: no bug - add dev build pipeline to circleci --- .circleci/build.sh | 12 ++++++++++++ .circleci/deploy.sh | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .circleci/build.sh create mode 100644 .circleci/deploy.sh (limited to '.circleci') 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/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 -- cgit v1.2.3-24-g4f1b