Skip to content

Commit 7f196d9

Browse files
committed
ci(workflow): 更新测试工作流以使用 docker-backup 脚本并列出备份产物
ci(workflow): update test workflow to use docker-backup script and list backup artifacts
1 parent 598d893 commit 7f196d9

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/go-test.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ jobs:
3737
run: |
3838
echo "port=8080" > backup.conf
3939
echo "callback_secret=my-test-secret" >> backup.conf
40-
echo "scriptpath=./test-script.sh" >> backup.conf
41-
echo "#!/bin/bash" > test-script.sh
42-
echo 'echo "script output"' >> test-script.sh
43-
chmod +x test-script.sh
40+
echo "scriptpath=./docker-backup.sh" >> backup.conf
4441
4542
- name: Run integration test
4643
run: |
@@ -89,3 +86,23 @@ jobs:
8986
- name: Output application logs
9087
if: always()
9188
run: cat app.log
89+
90+
- name: List backup artifacts (if any)
91+
if: always()
92+
run: |
93+
echo "=== Listing Docker backup artifacts ==="
94+
# List directories that match the backup pattern created by docker-backup.sh
95+
echo "Backup directories:"
96+
ls -la /tmp/docker-backups/ 2>/dev/null || echo "No backup directory found at /tmp/docker-backups/"
97+
98+
# If backup directories exist, show their contents
99+
if [[ -d "/tmp/docker-backups" ]]; then
100+
for backup_dir in /tmp/docker-backups/*/; do
101+
if [[ -d "$backup_dir" ]]; then
102+
echo "Contents of $backup_dir:"
103+
ls -la "$backup_dir"
104+
echo "---"
105+
fi
106+
done
107+
fi
108+
echo "=== End of Docker backup artifact listing ==="

go/callback/internal/handler/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,6 @@ func (h *BackupHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
8787
}
8888

8989
h.logger.Info("Backup script executed successfully", "output", string(output))
90+
9091
response.JSON(w, r, http.StatusOK, map[string]string{"message": "Backup initiated successfully", "output": string(output)})
9192
}

0 commit comments

Comments
 (0)