Skip to content

Commit 140584f

Browse files
committed
ci(docker): fix migration condition
1 parent 61e3120 commit 140584f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

deployment/docker/server/server-wrapper

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ fi
158158
#
159159
# Generate new config.json if it does not exist
160160
#
161+
SEMAPHORE_FIRST_RUN=no
161162
if [ ! -f "${SEMAPHORE_CONFIG_PATH}/config.json" ]; then
163+
SEMAPHORE_FIRST_RUN=yes
162164
echoerr "Generating setup file ${TMP_STDIN_CONFIG_FILE} ..."
163165

164166
TMP_STDIN_CONFIG_FILE=$(mktemp)
@@ -271,13 +273,11 @@ fi
271273

272274

273275
#
274-
# Migrate from BoltDB if SEMAPHORE_MIGRATE_FROM_BOLTDB is set (SQLite only, skipped if DB file already exists)
276+
# Migrate from BoltDB if SEMAPHORE_MIGRATE_FROM_BOLTDB is set (first run only, SQLite only, skipped if DB file already exists)
275277
#
276-
if [ -n "${SEMAPHORE_MIGRATE_FROM_BOLTDB:-}" ]; then
278+
if [ -n "${SEMAPHORE_MIGRATE_FROM_BOLTDB:-}" ] && [ "${SEMAPHORE_FIRST_RUN}" = "yes" ]; then
277279
if [ "${SEMAPHORE_DB_DIALECT}" != "sqlite" ]; then
278280
echoerr "SEMAPHORE_MIGRATE_FROM_BOLTDB is only supported with SQLite dialect, ignoring"
279-
elif [ -f "${SEMAPHORE_DB_HOST}" ]; then
280-
echoerr "SQLite database ${SEMAPHORE_DB_HOST} already exists, skipping BoltDB migration"
281281
else
282282
echoerr "Migrating from BoltDB: ${SEMAPHORE_MIGRATE_FROM_BOLTDB}"
283283
MIGRATE_ARGS="--from-boltdb=${SEMAPHORE_MIGRATE_FROM_BOLTDB} --merge-existing-users"

0 commit comments

Comments
 (0)