From 93acbb99211c5df7d933047255e5ed7248055354 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Sun, 25 Mar 2018 21:37:59 -0400 Subject: no bug - add interdiff --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 48899d254..6b67abaeb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,7 +16,7 @@ main_filters: &main_filters defaults: bmo_slim_image: &bmo_slim_image - image: mozillabteam/bmo-slim:20180314.1 + image: mozillabteam/bmo-slim:20180325.1 user: app mysql_image: &mysql_image -- cgit v1.2.3-24-g4f1b From 413d682cdbb1b0f266e99a891aa6786515fca6a2 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 28 Mar 2018 10:13:24 -0400 Subject: Bug 1449413 - Refactor circleci container building stuff --- .circleci/config.yml | 95 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 25 deletions(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b67abaeb..6f14799a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,8 +11,6 @@ main_filters: &main_filters - /^(?:release|test)-20\d\d\d\d\d\d\.\d+/ - /\// - production - tags: - only: /^(?:release|test)-20\d\d\d\d\d\d\.\d+/ defaults: bmo_slim_image: &bmo_slim_image @@ -69,6 +67,41 @@ defaults: mkdir artifacts jobs: + build_info: + parallelism: 1 + working_directory: /app + docker: + - <<: *bmo_slim_image + environment: + <<: *bmo_env + steps: + - checkout + - run: + name: build push data + command: | + mv /opt/bmo/local /app/local + perl checksetup.pl --no-database --no-templates --no-permissions + perl scripts/build-bmo-push-data.pl + - run: + name: only publish if tag exists + command: | + tag="$(cat build_info/tag.txt)" + git fetch --tags + if git tag | fgrep -q "$tag"; then + echo "tag $tag exists!" + if [[ $CIRCLE_BRANCH == "master" ]]; then + exit 1 + fi + else + echo "tag $tag does not exist" + echo yes > build_info/publish.txt + fi + - persist_to_workspace: + root: /app/build_info + paths: ["*.txt"] + - store_artifacts: + path: /app/build_info + build: working_directory: /app docker: @@ -85,24 +118,30 @@ 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 - deploy: command: | - if [[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]]; then - TAG="" - if [[ -n "$CIRCLE_TAG" ]]; then - TAG="$CIRCLE_TAG" - elif [[ "$CIRCLE_BRANCH" == "master" ]]; then - TAG=latest - fi - if [[ -n "$TAG" ]]; then - docker tag bmo "$DOCKERHUB_REPO:$TAG" - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" - docker push "$DOCKERHUB_REPO:$TAG" - fi - fi + TAG="$(cat /app/build_info/tag.txt)" + [[ "$CIRCLE_BRANCH" == "master" && -n "$TAG" ]] || exit 0 + [[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0 + [[ -n "$GITHUB_PERSONAL_TOKEN" ]] || exit 0 + [[ -f build_info/publish.txt ]] || exit 0 + git config credential.helper cache + 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 login -u "$DOCKER_USER" -p "$DOCKER_PASS" + docker push "$DOCKERHUB_REPO:$TAG" test_sanity: - parallelism: 4 + parallelism: 2 working_directory: /app docker: - <<: *bmo_slim_image @@ -178,23 +217,29 @@ workflows: version: 2 main: jobs: + - build_info: + filters: *main_filters + - build: + filters: *main_filters + requires: + - build_info + - test_sanity + - test_bmo + - test_webservices + - test_selenium - test_sanity: filters: *main_filters + requires: + - build_info - test_bmo: filters: *main_filters requires: - - test_sanity + - build_info - test_webservices: filters: *main_filters requires: - - test_sanity + - build_info - test_selenium: filters: *main_filters requires: - - test_sanity - - build: - filters: *main_filters - requires: - - test_sanity - - test_bmo - - test_webservices + - build_info -- cgit v1.2.3-24-g4f1b From dd25bafd4c4db015e9d98a9a022932840459699e Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 28 Mar 2018 10:16:24 -0400 Subject: no bug - existing tag is non-fatal --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f14799a9..5de22d587 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,6 @@ jobs: git fetch --tags if git tag | fgrep -q "$tag"; then echo "tag $tag exists!" - if [[ $CIRCLE_BRANCH == "master" ]]; then - exit 1 - fi else echo "tag $tag does not exist" echo yes > build_info/publish.txt -- cgit v1.2.3-24-g4f1b From b14d36c66500ca6d57df8cfe310557204eccc5f2 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 28 Mar 2018 11:39:33 -0400 Subject: no bug - skip tests if the only thing changed is the version --- .circleci/config.yml | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 5de22d587..e30304b63 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,6 +61,7 @@ defaults: run: name: default qa setup command: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 mv /opt/bmo/local /app/local perl -MSys::Hostname -i -pE 's/bmo.test/hostname() . ":$ENV{PORT}"/ges' $BZ_QA_CONF_FILE perl checksetup.pl --no-database --default-localconfig @@ -93,6 +94,22 @@ jobs: echo "tag $tag does not exist" echo yes > build_info/publish.txt fi + - run: + name: check if only version changed + command: | + if git diff 'HEAD~..HEAD' --name-only | grep -qv '^Bugzilla.pm'; then + echo "more files than just Bugzilla.pm changed." + exit 0 + fi + if git diff 'HEAD~..HEAD' |grep '^[+-][^+-]' | grep -qv '^[+-]our $VERSION'; then + echo "Something other than the version number changed." + exit 0 + fi + if [[ "$CIRCLE_BRANCH" == "master" ]]; then + echo "Can't cut corners on the master branch" + exit 0 + fi + echo yes > build_info/only_version_changed.txt - persist_to_workspace: root: /app/build_info paths: ["*.txt"] @@ -145,13 +162,19 @@ jobs: environment: *bmo_env steps: - checkout + - attach_workspace: + at: /app/build_info - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 mv /opt/bmo/local /app/local mkdir artifacts - - run: perl Makefile.PL + - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 + perl Makefile.PL - run: name: run sanity tests command: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 /app/scripts/entrypoint.pl prove -qf $(circleci tests glob 't/*.t' | circleci tests split) | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts @@ -162,12 +185,15 @@ jobs: docker: *docker_oldtests steps: - checkout + - attach_workspace: + at: /app/build_info - *default_qa_setup - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 /app/scripts/entrypoint.pl load_test_data - - run: - command: | - /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt + - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 + /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts @@ -177,12 +203,15 @@ jobs: docker: *docker_oldtests steps: - checkout + - attach_workspace: + at: /app/build_info - *default_qa_setup - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 /app/scripts/entrypoint.pl load_test_data --legacy - - run: - command: | - /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt + - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 + /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt - store_artifacts: path: /app/artifacts @@ -203,12 +232,17 @@ jobs: - image: selenium/standalone-firefox:2.53.1 steps: - checkout + - attach_workspace: + at: /app/build_info - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 mv /opt/bmo/local /app/local perl checksetup.pl --no-database /app/scripts/entrypoint.pl load_test_data mkdir artifacts - - run: /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t + - run: | + [[ -f build_info/only_version_changed.txt ]] && exit 0 + /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t workflows: version: 2 -- cgit v1.2.3-24-g4f1b From 3ef33b34236a7341e668887e89ceb19ca8d16b4f Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 28 Mar 2018 13:36:27 -0400 Subject: no bug - always build latest tag --- .circleci/config.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index e30304b63..1743d7451 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -141,18 +141,21 @@ jobs: - deploy: command: | TAG="$(cat /app/build_info/tag.txt)" - [[ "$CIRCLE_BRANCH" == "master" && -n "$TAG" ]] || exit 0 + [[ "$CIRCLE_BRANCH" == "master" ]] || exit 0 [[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0 [[ -n "$GITHUB_PERSONAL_TOKEN" ]] || exit 0 - [[ -f build_info/publish.txt ]] || exit 0 - git config credential.helper cache - 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 login -u "$DOCKER_USER" -p "$DOCKER_PASS" - docker push "$DOCKERHUB_REPO:$TAG" + 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" test_sanity: parallelism: 2 -- cgit v1.2.3-24-g4f1b From 2140cf79a1d1adc96d66c800871bf59e365ece40 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 30 Mar 2018 11:02:06 -0400 Subject: bump base image to bmo-slim:20180330.1 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 1743d7451..f5c761af4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ main_filters: &main_filters defaults: bmo_slim_image: &bmo_slim_image - image: mozillabteam/bmo-slim:20180325.1 + image: mozillabteam/bmo-slim:20180330.1 user: app mysql_image: &mysql_image -- cgit v1.2.3-24-g4f1b