summaryrefslogtreecommitdiffstats
path: root/.circleci
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-08-07 19:35:47 +0200
committerGitHub <noreply@github.com>2017-08-07 19:35:47 +0200
commit4663032035039cc642db9b3f82b289418d02c430 (patch)
tree553648b0cc683692cabcbc9ae45ef46f8af3b759 /.circleci
parent28a1de6319da8b481b9b5ec08f070bce65e17bb3 (diff)
downloadbugzilla-4663032035039cc642db9b3f82b289418d02c430.tar.gz
bugzilla-4663032035039cc642db9b3f82b289418d02c430.tar.xz
Bug 1383355 - Migrate CI tests from taskcluster to CircleCI
Diffstat (limited to '.circleci')
-rw-r--r--.circleci/checksetup_answers.txt11
-rw-r--r--.circleci/config.yml104
-rwxr-xr-x.circleci/deploy.pl52
-rw-r--r--.circleci/selenium_test.conf49
4 files changed, 212 insertions, 4 deletions
diff --git a/.circleci/checksetup_answers.txt b/.circleci/checksetup_answers.txt
new file mode 100644
index 000000000..6bcdd2dcc
--- /dev/null
+++ b/.circleci/checksetup_answers.txt
@@ -0,0 +1,11 @@
+$answer{'ADMIN_EMAIL'} = 'admin@mozilla.bugs';
+$answer{'ADMIN_OK'} = 'Y';
+$answer{'ADMIN_PASSWORD'} = 'password';
+$answer{'ADMIN_REALNAME'} = 'QA Admin';
+$answer{'NO_PAUSE'} = 1;
+$answer{'bugzilla_version'} = '1';
+$answer{'create_htaccess'} = '';
+$answer{'cvsbin'} = '/usr/bin/cvs';
+$answer{'diffpath'} = '/usr/bin';
+$answer{'interdiffbin'} = '/usr/bin/interdiff';
+$answer{'urlbase'} = 'http://<<HOSTNAME>>:8000/bmo/';
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 18d282917..b4fbe1874 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -4,13 +4,49 @@
#
version: 2
+
+test_docker: &test_docker
+ - image: mozillabteam/bmo-slim:20170803.1
+ user: app
+ environment:
+ PORT: 8000
+ BMO_db_user: bugs
+ BMO_db_host: 127.0.0.1
+ BMO_db_pass: bugs
+ BMO_db_name: bugs
+ BMO_memcached_servers: localhost:11211
+ BMO_memcached_namespace: "bugzilla:"
+ BZ_QA_CONF_FILE: /app/.circleci/selenium_test.conf
+ BZ_QA_ANSWERS_FILE: /app/.circleci/checksetup_answers.txt
+ - image: mozillabteam/bmo-mysql:5.6
+ environment:
+ MYSQL_DATABASE: bugs
+ MYSQL_USER: bugs
+ MYSQL_PASSWORD: bugs
+ MYSQL_ALLOW_EMPTY_PASSWORD: 1
+ - image: selenium/standalone-firefox:2.53.1
+ - image: memcached:latest
+
+default_setup: &default_setup
+ run:
+ command: |
+ mv /opt/bmo/local /app/local
+ perl -MSys::Hostname -i -pE 's/<<HOSTNAME>>/hostname()/ges' $BZ_QA_CONF_FILE
+ perl -MSys::Hostname -i -pE 's/<<HOSTNAME>>/hostname()/ges' $BZ_QA_ANSWERS_FILE
+ perl checksetup.pl --no-database --default-localconfig
+ mkdir artifacts
+
+run_qa_httpd: &run_qa_httpd
+ run:
+ command: |
+ /app/scripts/entrypoint.pl qa_httpd &> artifacts/httpd.log
+ background: true
+
jobs:
build:
working_directory: /app
docker:
- image: docker:17.06.1-ce
- environment:
- BMO_IMAGE_NAME: mozillabteam/bmo
steps:
- setup_remote_docker
- run:
@@ -18,8 +54,68 @@ jobs:
command: apk update && apk add git openssh-client
- checkout
- run: |
- docker build -t $BMO_IMAGE_NAME:$CIRCLE_BRANCH .
+ docker build -t $DOCKERHUB_REPO:latest .
if [[ -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
- docker push $BMO_IMAGE_NAME:$CIRCLE_BRANCH
+ docker push $DOCKERHUB_REPO:latest
fi
+
+ test_sanity:
+ parallelism: 4
+ working_directory: /app
+ docker:
+ - image: mozillabteam/bmo-slim:20170803.1
+ user: app
+ steps:
+ - checkout
+ - *default_setup
+ - run:
+ name: run sanity tests
+ command: |
+ prove -qf $(circleci tests glob 't/*.t' | circleci tests split) | tee artifacts/$CIRCLE_JOB.txt
+ - store_artifacts:
+ path: /app/artifacts
+
+ test_webservices:
+ parallelism: 1
+ working_directory: /app
+ docker: *test_docker
+ steps:
+ - checkout
+ - *default_setup
+ - run: /app/scripts/entrypoint.pl load_test_data
+ - *run_qa_httpd
+ - run: /app/scripts/entrypoint.pl test_heartbeat
+ - run:
+ command: |
+ /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt
+ - store_artifacts:
+ path: /app/artifacts
+
+ test_selenium:
+ parallelism: 1
+ working_directory: /app
+ docker: *test_docker
+ steps:
+ - checkout
+ - *default_setup
+ - run: /app/scripts/entrypoint.pl load_test_data
+ - *run_qa_httpd
+ - run:
+ command: |
+ /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt
+ - store_artifacts:
+ path: /app/artifacts
+
+workflows:
+ version: 2
+ tests:
+ jobs:
+ - test_sanity
+ - test_webservices
+ - test_selenium
+ - build:
+ requires:
+ - test_sanity
+ - test_webservices
+ - test_selenium
diff --git a/.circleci/deploy.pl b/.circleci/deploy.pl
new file mode 100755
index 000000000..391b9b660
--- /dev/null
+++ b/.circleci/deploy.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/env perl
+use 5.10.1;
+use strict;
+use warnings;
+
+my ($repo, $user, $pass) = check_env(qw(DOCKERHUB_REPO DOCKER_USER DOCKER_PASS));
+run("docker", "login", "-u", $user, "-p", $pass);
+
+my @docker_tags = ($ENV{CIRCLE_SHA1});
+
+if ($ENV{CIRCLE_TAG}) {
+ push @docker_tags, $ENV{CIRCLE_TAG};
+}
+elsif ($ENV{CIRCLE_BRANCH}) {
+ if ($ENV{CIRCLE_BRANCH} eq 'master') {
+ push @docker_tags, 'latest';
+ }
+ else {
+ push @docker_tags, $ENV{CIRCLE_BRANCH};
+ }
+}
+
+say "Pushing tags...";
+say " $_" for @docker_tags;
+foreach my $tag (@docker_tags) {
+ run("docker", "tag", "bmo", "$repo:$tag");
+ run("docker", "push", "$repo:$tag");
+}
+
+sub run {
+ my (@cmd) = @_;
+ my $rv = system(@cmd);
+ exit 1 if $rv != 0;
+}
+
+sub check_env {
+ my (@missing, @found);
+ foreach my $name (@_) {
+ push @missing, $name unless $ENV{$name};
+ push @found, $ENV{$name};
+ }
+
+ if (@missing) {
+ warn "Missing environmental variables: ", join(", ", @missing), "\n";
+ exit;
+ }
+ return @found;
+}
+
+
+
+
diff --git a/.circleci/selenium_test.conf b/.circleci/selenium_test.conf
new file mode 100644
index 000000000..a012ae957
--- /dev/null
+++ b/.circleci/selenium_test.conf
@@ -0,0 +1,49 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+# To make this configuration file useful to you, you have to:
+# - set the path and URL to your Bugzilla installation.
+# - replace @mozilla.test by something more relevant to you,
+# also what comes before @mozilla.test if you want/need to.
+# - set passwords for each user accounts.
+
+{ 'browser' => '*firefox',
+ 'experimental_browser_launcher' => '*chrome',
+ 'host' => 'localhost',
+ 'port' => 4444,
+ 'browser_url' => 'http://<<HOSTNAME>>:8000',
+ 'attachment_file' => 'https://raw.githubusercontent.com/mozilla-bteam/bmo/master/qa/config/patch.diff',
+ 'bugzilla_installation' => 'bmo',
+ 'bugzilla_path' => '/app',
+ 'test_bug_1' => 1,
+ 'test_bug_2' => 2,
+ 'admin_user_login' => 'admin@mozilla.test',
+ 'admin_user_passwd' => 'password',
+ 'admin_user_username' => 'QA Admin',
+ 'admin_user_nick' => 'admin',
+ 'permanent_user' => 'permanent_user@mozilla.test',
+ 'permanent_user_login' => 'permanent_user@mozilla.test',
+ 'permanent_user_passwd' => 'password',
+ 'unprivileged_user_login' => 'no-privs@mozilla.test',
+ 'unprivileged_user_passwd' => 'password',
+ 'unprivileged_user_username' => 'no-privs',
+ 'unprivileged_user_nick' => 'no-privs',
+ 'unprivileged_user_login_truncated' => 'no-privs@mo',
+ 'QA_Selenium_TEST_user_login' => 'QA-Selenium-TEST@mozilla.test',
+ 'QA_Selenium_TEST_user_passwd' => 'password',
+ 'editbugs_user_login' => 'editbugs@mozilla.test',
+ 'editbugs_user_passwd' => 'password',
+ 'canconfirm_user_login' => 'canconfirm@mozilla.test',
+ 'canconfirm_user_passwd' => 'password',
+ 'tweakparams_user_login' => 'tweakparams@mozilla.test',
+ 'tweakparams_user_login_truncated' => 'tweakparams@mo',
+ 'tweakparams_user_passwd' => 'password',
+ 'disabled_user_login' => 'disabled@mozilla.test',
+ 'disabled_user_passwd' => 'password',
+ 'common_email' => '@mozilla.test',
+ 'test_extensions' => 1,
+};