Skip to content

Commit 4bacd0d

Browse files
authored
Merge pull request #131 from fradelg/bugfix/skip-dump-date
Fixed database name on dumps
2 parents cff595e + 1d3c439 commit 4bacd0d

File tree

4 files changed

+29
-25
lines changed

4 files changed

+29
-25
lines changed

.github/workflows/image.yml .github/workflows/build.yml

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
1+
12
name: build docker image
23

34
on:
4-
workflow_dispatch:
55
push:
6-
branches:
7-
- "**"
86
tags:
97
- "**"
108

119
jobs:
12-
test:
13-
runs-on: ubuntu-22.04
14-
steps:
15-
- name: Checkout the code
16-
uses: actions/checkout@v4
17-
- name: Test Bash scripts
18-
run: sudo apt-get -qq update && sudo apt-get install -y devscripts shellcheck && make test
19-
- name: Test image
20-
env:
21-
VOLUME_PATH: /tmp/mariadb
22-
DATABASE_NAME: foo
23-
MARIADB_ROOT_PASSWORD: abcd
24-
run: |
25-
docker compose up -d mariadb
26-
docker compose run backup /backup.sh
27-
docker compose run backup /restore.sh /backup/latest.foo.sql.gz
28-
docker compose stop
2910
build:
3011
runs-on: ubuntu-22.04
31-
needs: test
3212
steps:
3313
- name: Checkout the code
3414
uses: actions/checkout@v4

.github/workflows/test.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: build docker image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- "**"
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout the code
14+
uses: actions/checkout@v4
15+
- name: Test Bash scripts
16+
run: sudo apt-get -qq update && sudo apt-get install -y devscripts shellcheck && make test
17+
- name: Test image
18+
env:
19+
VOLUME_PATH: /tmp/mariadb
20+
DATABASE_NAME: foo
21+
MARIADB_ROOT_PASSWORD: abcd
22+
run: |
23+
docker compose up -d mariadb
24+
docker compose run backup /backup.sh
25+
docker compose run backup /restore.sh /backup/latest.foo.sql.gz
26+
docker compose stop

backup.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ do
3232
BASIC_OPTS="--single-transaction"
3333
if [ -n "$REMOVE_DUPLICATES" ]
3434
then
35-
echo "WARNING: disabling comments in backup to remove deuplicate backups. Automatic database name detection won't work so set MYSQL_DATABASE on restore"
36-
BASIC_OPTS="$BASIC_OPTS" --skip-comments
35+
BASIC_OPTS="$BASIC_OPTS --skip-dump-date"
3736
fi
3837
if mysqldump $BASIC_OPTS $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME"
3938
then
@@ -52,7 +51,7 @@ do
5251
cd /backup || exit && ln -s "$BASENAME" "$(basename "$LATEST")"
5352
if [ -n "$REMOVE_DUPLICATES" ]
5453
then
55-
echo "=> Removing duplicate database dumps"
54+
echo "==> Removing duplicate database dumps"
5655
fdupes -idN /backup/
5756
fi
5857
if [ -n "$MAX_BACKUPS" ]

docker-compose.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ services:
3030
environment:
3131
- MYSQL_HOST=my_mariadb
3232
- MYSQL_USER=root
33-
- MYSQL_DATABASE=${DATABASE_NAME}
3433
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
3534
- MAX_BACKUPS=1
3635
- INIT_BACKUP=1

0 commit comments

Comments
 (0)