Skip to content

Commit

Permalink
Bug 1932257 - CircleCI configuration cleanups and removal of un-used …
Browse files Browse the repository at this point in the history
…code in entrypoint.pl
  • Loading branch information
dklawren authored Nov 21, 2024
1 parent 979c058 commit 48f38d8
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 141 deletions.
70 changes: 18 additions & 52 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,6 @@ defaults:
username: $DOCKER_USER
password: $DOCKER_PASS

build_image: &build_image
run:
name: Build Docker BMO Image
command: |
docker build \
--build-arg CI="$CI" \
--build-arg CIRCLE_SHA1="$CIRCLE_SHA1" \
--build-arg CIRCLE_BUILD_URL="$CIRCLE_BUILD_URL" \
--target base \
-t bmo .
build_selenium_image: &build_selenium_image
run:
name: Build Selenium Image
command: |
docker build \
--build-arg CI="$CI" \
--build-arg CIRCLE_SHA1="$CIRCLE_SHA1" \
--build-arg CIRCLE_BUILD_URL="$CIRCLE_BUILD_URL" \
--target test \
-t bmo .
store_log: &store_log
store_artifacts:
path: bugzilla.log
Expand All @@ -68,25 +46,21 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_image
- run: |
[[ -d build_info ]] || mkdir build_info
- attach_workspace:
at: build_info
- run:
name: build version.json
command: |
docker-compose -f docker-compose.test.yml run bmo.test version | sed '1d' > build_info/version.json
- run:
name: build push data
name: build version.json and push data
command: |
docker-compose -f docker-compose.test.yml run --name push_data bmo.test push_data
docker cp push_data:/app/build_info/blog.push.txt build_info/blog.push.txt
docker cp push_data:/app/build_info/markdown.push.txt build_info/markdown.push.txt
docker cp push_data:/app/build_info/bug.push.txt build_info/bug.push.txt
docker cp push_data:/app/build_info/email.push.txt build_info/email.push.txt
docker cp push_data:/app/build_info/tag.txt build_info/tag.txt
docker cp push_data:/app/build_info/wiki.push.txt build_info/wiki.push.txt
docker-compose -f docker-compose.test.yml run --build --name push_data bmo.test push_data
docker cp push_data:/app/push_data/blog.push.txt build_info/blog.push.txt
docker cp push_data:/app/push_data/markdown.push.txt build_info/markdown.push.txt
docker cp push_data:/app/push_data/bug.push.txt build_info/bug.push.txt
docker cp push_data:/app/push_data/email.push.txt build_info/email.push.txt
docker cp push_data:/app/push_data/tag.txt build_info/tag.txt
docker cp push_data:/app/push_data/wiki.push.txt build_info/wiki.push.txt
docker cp push_data:/app/version.json build_info/version.json
docker rm push_data
- run:
name: only publish if tag exists
Expand Down Expand Up @@ -117,7 +91,7 @@ jobs:
echo yes > build_info/only_version_changed.txt
- persist_to_workspace:
root: build_info
paths: ["*.txt"]
paths: ["*.txt", "*.json"]
- store_artifacts:
path: build_info
- *store_log
Expand All @@ -130,12 +104,12 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_image
- attach_workspace:
at: build_info
- deploy:
command: |
[[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0
docker build --tag bmo --target base .
if [[ "$CIRCLE_BRANCH" == "master" ]]; then
TAG="$(cat build_info/tag.txt)"
if [[ -n "$TAG" && -f build_info/publish.txt ]]; then
Expand Down Expand Up @@ -163,7 +137,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -172,8 +145,7 @@ jobs:
name: run sanity tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run --no-deps bmo.test \
test_sanity t/*.t extensions/*/t/*.t
docker-compose -f docker-compose.test.yml run --build --no-deps bmo.test test_sanity t/*.t extensions/*/t/*.t
- store_artifacts:
path: artifacts
- *store_log
Expand All @@ -186,7 +158,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -195,7 +166,7 @@ jobs:
name: run webservice tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run bmo.test test_webservices
docker-compose -f docker-compose.test.yml run --build bmo.test test_webservices
- store_artifacts:
path: artifacts
- *store_log
Expand All @@ -208,7 +179,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_selenium_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -217,7 +187,7 @@ jobs:
name: run selenium tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=1 bmo.test test_selenium
docker-compose -f docker-compose.test.yml run --build -e SELENIUM_GROUP=1 bmo.test test_selenium
- store_artifacts:
path: artifacts
- *store_log
Expand All @@ -230,7 +200,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_selenium_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -239,7 +208,7 @@ jobs:
name: run selenium tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=2 bmo.test test_selenium 2
docker-compose -f docker-compose.test.yml run --build -e SELENIUM_GROUP=2 bmo.test test_selenium 2
- store_artifacts:
path: artifacts
- *store_log
Expand All @@ -252,7 +221,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_selenium_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -261,7 +229,7 @@ jobs:
name: run selenium tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=3 bmo.test test_selenium 3
docker-compose -f docker-compose.test.yml run --build -e SELENIUM_GROUP=3 bmo.test test_selenium 3
- store_artifacts:
path: artifacts
- *store_log
Expand All @@ -274,7 +242,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_selenium_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -283,7 +250,7 @@ jobs:
name: run selenium tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=4 bmo.test test_selenium 4
docker-compose -f docker-compose.test.yml run --build -e SELENIUM_GROUP=4 bmo.test test_selenium 4
- store_artifacts:
path: artifacts
- *store_log
Expand All @@ -296,7 +263,6 @@ jobs:
- setup_local_docker
- checkout
- *docker_login
- *build_selenium_image
- run: |
[[ -d artifacts ]] || mkdir artifacts
- attach_workspace:
Expand All @@ -305,7 +271,7 @@ jobs:
name: run bmo specific tests
command: |
[[ -f build_info/only_version_changed.txt ]] && exit 0
docker-compose -f docker-compose.test.yml run bmo.test test_bmo -q -f t/bmo/*.t
docker-compose -f docker-compose.test.yml run --build bmo.test test_bmo -q -f t/bmo/*.t
- *store_log

workflows:
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,75 +8,75 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target base .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build bmo.test
- name: Run sanity tests
run: docker-compose -f docker-compose.test.yml run --no-deps bmo.test test_sanity t/*.t extensions/*/t/*.t

test_webservices:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target base .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build
- name: Run webservice tests
run: docker-compose -f docker-compose.test.yml run bmo.test test_webservices

test_bmo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target test .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build
- name: Run bmo specific tests
run: docker-compose -f docker-compose.test.yml run -e CI=1 bmo.test test_bmo -q -f t/bmo/*.t

test_selenium_1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target test .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build
- name: Run Selenium tests (1)
run: docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=1 bmo.test test_selenium

test_selenium_2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target test .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build
- name: Run Selenium tests (2)
run: docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=2 bmo.test test_selenium

test_selenium_3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target test .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build
- name: Run Selenium tests (3)
run: docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=3 bmo.test test_selenium

test_selenium_4:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target test .
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build Docker test images
run: docker-compose -f docker-compose.test.yml build
- name: Run Selenium tests (4)
run: docker-compose -f docker-compose.test.yml run -e SELENIUM_GROUP=4 bmo.test test_selenium
12 changes: 4 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -t bmo --target base .
- name: Create directory for artifacts
run: mkdir build_info
- name: Install docker-compose
run: sudo apt update && sudo apt install -y docker-compose
- name: Build version.json
run: |
docker-compose -f docker-compose.test.yml run --no-deps --name version_json --entrypoint true bmo.test
docker cp version_json:/app/version.json build_info/version.json
docker rm version_json
- name: Build push data
- name: Build Docker image
run: docker-compose -f docker-compose.test.yml build bmo.test
- name: Copy version.json and build push data
run: |
docker-compose -f docker-compose.test.yml run --no-deps --name push_data bmo.test push_data
docker cp push_data:/app/build_info/blog.push.txt build_info/blog.push.txt
Expand All @@ -36,6 +31,7 @@ jobs:
docker cp push_data:/app/build_info/email.push.txt build_info/email.push.txt
docker cp push_data:/app/build_info/tag.txt build_info/tag.txt
docker cp push_data:/app/build_info/wiki.push.txt build_info/wiki.push.txt
docker cp push_data:/app/version.json build_info/version.json
docker rm push_data
- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla.pm
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ sub check_rate_limit {
my $rules = decode_json($params->{rate_limit_rules});
my $limit = $rules->{$name};
unless ($limit) {
warn "no rules for $name!";
WARN("no rules for $name!");
return 0;
}
if (Bugzilla->memcached->should_rate_limit("$name:$identifier", @$limit)) {
Expand Down
12 changes: 5 additions & 7 deletions Bugzilla/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ sub update {
{
if ($old_value ne $new_value) {
$dbh->do('UPDATE params SET value = ? WHERE name = ?', undef, $new_value, $key);
$changes{"$id:$key"} = [$old_value, $new_value];
$changes{$key} = [$old_value, $new_value];
}
}
else {
$dbh->do('INSERT INTO params (name, value) VALUES (?, ?)',
undef, $key, $new_value);
$changes{"$id:$key"} = ['', $new_value];
$changes{$key} = ['', $new_value];
}
}

Expand All @@ -132,10 +132,8 @@ sub update {
# not the case here so we assign the 'id' variable each interation
# to make audit_log think each is a separate instance of
# Bugzilla::Config and each change is a separate transaction.
foreach my $item (keys %changes) {
my ($id, $key) = split /:/, $item;
$self->{id} = $id;
$self->audit_log({$key => [$changes{$item}->[0], $changes{$item}->[1]]});
foreach my $key (keys %changes) {
$self->audit_log({$key => [$changes{$key}->[0], $changes{$key}->[1]]});
}
}
catch {
Expand Down Expand Up @@ -301,7 +299,7 @@ sub migrate_params {
}

# Generate unique Duo integration secret key
if ($param->{duo_akey} eq '') {
if (!exists $param->{duo_akey} || $param->{duo_akey} eq '') {
require Bugzilla::Util;
$param->{duo_akey} = Bugzilla::Util::generate_random_password(40);
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/DB/Schema/Mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ sub _get_create_index_ddl {

my $sql = "CREATE ";
$sql .= "$index_type "
if ($index_type eq 'UNIQUE' || $index_type eq 'FULLTEXT');
if ($index_type && ($index_type eq 'UNIQUE' || $index_type eq 'FULLTEXT'));
$sql
.= "INDEX "
. $dbh->quote_identifier($index_name) . " ON "
Expand Down
Loading

0 comments on commit 48f38d8

Please sign in to comment.