Skip to content

Commit 7cd7bcd

Browse files
authored
Merge pull request github#769 from ritchxu/ritchxu/actions-restore
Stop/Restart Actions in ghe-restore
2 parents f74c25a + c7f3854 commit 7cd7bcd

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

bin/ghe-restore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ cleanup () {
9191
update_restore_status "$1"
9292
fi
9393

94+
if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
95+
echo "Restarting Actions after restore ..."
96+
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-start' 1>&3
97+
fi
98+
9499
# Cleanup SSH multiplexing
95100
ghe-ssh --clean
96101
}
@@ -348,6 +353,9 @@ else
348353
fi
349354

350355
if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.actions.enabled'; then
356+
echo "Stopping Actions before restoring databases ..."
357+
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-actions-stop' 1>&3
358+
351359
echo "Restoring MSSQL databases ..."
352360
ghe-restore-mssql "$GHE_HOSTNAME" 1>&3
353361

test/bin/ghe-actions-start

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ghe-fake-import-command

test/bin/ghe-actions-stop

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ghe-fake-import-command

test/test-ghe-restore.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,21 @@ begin_test "ghe-restore with Actions settings"
396396
)
397397
end_test
398398

399+
begin_test "ghe-restore stops and starts Actions"
400+
(
401+
set -e
402+
rm -rf "$GHE_REMOTE_ROOT_DIR"
403+
setup_remote_metadata
404+
enable_actions
405+
406+
setup_maintenance_mode "configured"
407+
408+
output=$(ghe-restore -v -f localhost 2>&1)
409+
410+
echo "$output" | grep -q "ghe-actions-stop .* OK"
411+
echo "$output" | grep -q "ghe-actions-start .* OK"
412+
)
413+
399414
begin_test "ghe-restore with Actions data"
400415
(
401416
set -e

0 commit comments

Comments
 (0)