Skip to content

Commit fcd8aa8

Browse files
authored
Bug 2005381: Clean up docker configs, run tests locally easier (#151)
1 parent 946d809 commit fcd8aa8

14 files changed

+356
-263
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ on:
1414

1515
jobs:
1616
test_sanity:
17+
name: Sanity Tests
1718
runs-on: ubuntu-latest
1819
steps:
1920
- uses: actions/checkout@v4
2021
- name: Install docker-compose
2122
run: sudo apt-get update && sudo apt-get install -y docker-compose
2223
- name: Build the Docker images
23-
run: docker compose -f docker-compose.test.yml build
24+
run: docker compose -f docker-compose.test-mysql.yml build
2425
- name: Run sanity tests
25-
run: docker compose -f docker-compose.test.yml run --no-deps bugzilla6.test test_sanity t/*.t extensions/*/t/*.t
26+
run: docker compose -f docker-compose.test-mysql.yml run --no-deps bugzilla6.test test_sanity t/*.t extensions/*/t/*.t
2627

2728
# test_webservices:
2829
# runs-on: ubuntu-latest
@@ -31,22 +32,24 @@ jobs:
3132
# - name: Install docker-compose
3233
# run: sudo apt-get update && sudo apt-get install -y docker-compose
3334
# - name: Build the Docker images
34-
# run: docker compose -f docker-compose.test.yml build
35+
# run: docker compose -f docker-compose.test-mysql.yml build
3536
# - name: Run webservice tests
36-
# run: docker compose -f docker-compose.test.yml run bugzilla6.test test_webservices
37+
# run: docker compose -f docker-compose.test-mysql.yml run bugzilla6.test test_webservices
3738

3839
test_bugzilla6_mysql:
40+
name: Interactive Tests with MySQL
3941
runs-on: ubuntu-latest
4042
steps:
4143
- uses: actions/checkout@v4
4244
- name: Install docker-compose
4345
run: sudo apt-get update && sudo apt-get install -y docker-compose
4446
- name: Build the Docker images
45-
run: docker compose -f docker-compose.test.yml build
47+
run: docker compose -f docker-compose.test-mysql.yml build
4648
- name: Run bmo specific tests
47-
run: docker compose -f docker-compose.test.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
49+
run: docker compose -f docker-compose.test-mysql.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
4850

4951
test_bugzilla6_mariadb:
52+
name: Interactive Tests with MariaDB
5053
runs-on: ubuntu-latest
5154
steps:
5255
- uses: actions/checkout@v4
@@ -58,6 +61,7 @@ jobs:
5861
run: docker compose -f docker-compose.test-mariadb.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
5962

6063
test_bugzilla6_pg:
64+
name: Interactive Tests with PostgreSQL
6165
runs-on: ubuntu-latest
6266
steps:
6367
- uses: actions/checkout@v4
@@ -69,6 +73,7 @@ jobs:
6973
run: docker compose -f docker-compose.test-pg.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
7074

7175
test_bugzilla6_sqlite:
76+
name: Interactive Tests with SQLite
7277
runs-on: ubuntu-latest
7378
steps:
7479
- uses: actions/checkout@v4
@@ -79,3 +84,26 @@ jobs:
7984
- name: Run bmo specific tests
8085
run: docker compose -f docker-compose.test-sqlite.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
8186

87+
test_release:
88+
name: Perl Test Suite
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout the repository
92+
uses: actions/checkout@v4
93+
- name: Build Docker image
94+
run: docker build -t bugzilla-release-test -f docker/images/Dockerfile.perl-testsuite .
95+
- name: Run tests
96+
run: docker run --rm bugzilla-release-test
97+
98+
shellcheck:
99+
name: ShellCheck (linting for shell scripts)
100+
runs-on: ubuntu-latest
101+
steps:
102+
- uses: actions/checkout@v4
103+
- name: Install ShellCheck
104+
run: sudo apt-get update && sudo apt-get install -y shellcheck
105+
- name: Run ShellCheck on all scripts
106+
run: |
107+
find . -type f -name '*.sh' | while read -r file; do
108+
shellcheck -x "$file"
109+
done

.github/workflows/release.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
version.json
3333
__lbheartbeat__
3434
.perl-version
35+
*.bak
3536

3637
/skins/contrib/Dusk/admin.css
3738
/skins/contrib/Dusk/bug.css

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG BZDB="-mysql"
22
FROM bugzilla/bugzilla-perl-slim${BZDB}:20250925.1
33

4-
ENV DEBIAN_FRONTEND noninteractive
4+
ENV DEBIAN_FRONTEND=noninteractive
55

66
ENV LOG4PERL_CONFIG_FILE=log4perl-json.conf
77

docker/common.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5+
#
6+
# This Source Code Form is "Incompatible With Secondary Licenses", as
7+
# defined by the Mozilla Public License, v. 2.0.
8+
9+
##################################################
10+
# Common checks and functions for docker scripts #
11+
##################################################
12+
13+
# Function to print text in red if terminal supports it
14+
echo_red() {
15+
if [ -t 1 ] && command -v tput >/dev/null 2>&1 && [ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]; then
16+
echo -e "\033[31m$1\033[0m"
17+
else
18+
echo "$1"
19+
fi
20+
}
21+
22+
# Function to print text in green if terminal supports it
23+
echo_green() {
24+
if [ -t 1 ] && command -v tput >/dev/null 2>&1 && [ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]; then
25+
echo -e "\033[32m$1\033[0m"
26+
else
27+
echo "$1"
28+
fi
29+
}
30+
31+
# Check that we're in the root of the Bugzilla source tree
32+
if [ ! -e 'Makefile.PL' ]; then
33+
echo
34+
echo_red "Please run this from the root of the Bugzilla source tree."
35+
echo
36+
exit 1
37+
fi
38+
39+
# Find and validate the Docker executable
40+
if [ -z "$DOCKER" ]; then
41+
DOCKER=$(which docker)
42+
fi
43+
if [ -n "$DOCKER" ] && [ ! -x "$DOCKER" ]; then
44+
echo
45+
echo_red "You specified a custom Docker executable via the DOCKER"
46+
echo_red "environment variable at $DOCKER"
47+
echo_red "which either does not exist or is not executable."
48+
echo "Please fix it to point at a working Docker or remove the"
49+
echo "DOCKER environment variable to use the one in your PATH"
50+
echo "if it exists."
51+
echo
52+
exit 1
53+
fi
54+
if [ -z "$DOCKER" ]; then
55+
echo
56+
echo_red "You do not appear to have docker installed or I can't find it."
57+
echo "Windows and Mac versions can be downloaded from"
58+
echo "https://www.docker.com/products/docker-desktop"
59+
echo "Linux users can install using your package manager."
60+
echo
61+
echo "Please install docker or specify the location of the docker"
62+
echo "executable in the DOCKER environment variable and try again."
63+
echo
64+
exit 1
65+
fi
66+
67+
# Check that Docker daemon is running
68+
if ! $DOCKER info >/dev/null 2>&1; then
69+
echo
70+
echo_red "The docker daemon is not running or I can't connect to it."
71+
echo "Please make sure it's running and try again."
72+
echo
73+
exit 1
74+
fi
75+
76+
# Disable Docker CLI hints
77+
export DOCKER_CLI_HINTS=false

docker/gen-cpanfile-snapshot.sh

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,18 @@
66
# This Source Code Form is "Incompatible With Secondary Licenses", as
77
# defined by the Mozilla Public License, v. 2.0.
88

9-
if [ -z "$DOCKER" ]; then
10-
DOCKER=`which docker`
11-
fi
12-
if [ ! -x "$DOCKER" ]; then
13-
echo
14-
echo "You specified a custom Docker executable via the DOCKER"
15-
echo "environment variable at $DOCKER"
16-
echo "which either does not exist or is not executable."
17-
echo "Please fix it to point at a working Docker or remove the"
18-
echo "DOCKER environment variable to use the one in your PATH"
19-
echo "if it exists."
20-
echo
21-
exit -1
22-
fi
23-
if [ -z "$DOCKER" ]; then
24-
echo
25-
echo "You do not appear to have docker installed or I can't find it."
26-
echo "Windows and Mac versions can be downloaded from"
27-
echo "https://www.docker.com/products/docker-desktop"
28-
echo "Linux users can install using your package manager."
29-
echo
30-
echo "Please install docker or specify the location of the docker"
31-
echo "executable in the DOCKER environment variable and try again."
32-
echo
33-
exit -1
34-
fi
35-
$DOCKER info 1>/dev/null 2>/dev/null
36-
if [ $? != 0 ]; then
37-
echo
38-
echo "The docker daemon is not running or I can't connect to it."
39-
echo "Please make sure it's running and try again."
40-
echo
41-
exit -1
42-
fi
9+
# Source common Docker script checks and functions
10+
# shellcheck source=docker/common.sh
11+
source "$(dirname "$0")/common.sh"
12+
4313
if [ ! -f "docker/images/Dockerfile.cpanfile" ]; then
4414
echo
4515
echo "Can't locate the Dockerfile, try running from the root of"
4616
echo "your Bugzilla checkout."
4717
echo
48-
exit -1
18+
exit 1
4919
fi
5020

51-
export DOCKER_CLI_HINTS=false
5221
$DOCKER build -t bugzilla-cpanfile -f docker/images/Dockerfile.cpanfile .
5322
$DOCKER run -it -v "$(pwd):/app/result" bugzilla-cpanfile cp cpanfile cpanfile.snapshot /app/result
5423

0 commit comments

Comments
 (0)