Commit fdb18f6a by Haohao Jiang

Merge branch 'develop' into test-detect-master-if-publish

parents f67fe20a 4c79b31e
docker build -t reg.i.strikingly.com/falcon:v0.7.2 . docker build -t reg.i.strikingly.com/falcon:v0.7.3-uat .
docker push reg.i.strikingly.com/falcon:v0.7.2 docker push reg.i.strikingly.com/falcon:v0.7.3-uat
\ No newline at end of file
import { spawn } from "bun"; import { spawnSync } from "bun";
import Redis from "ioredis"; import Redis from "ioredis";
// 任务执行入口,自动设置 SLACK_WEBHOOK 并依次运行 gsheet、gsheet:ai 和 notify-slack // 任务执行入口,自动设置 SLACK_WEBHOOK 并依次运行 gsheet、gsheet:ai 和 notify-slack
...@@ -38,24 +38,32 @@ async function main() { ...@@ -38,24 +38,32 @@ async function main() {
// 运行 bun run detect // 运行 bun run detect
console.log(`[${task_trigger}] 开始执行 detect`); console.log(`[${task_trigger}] 开始执行 detect`);
const detectProcess = spawn({ const detectResult = spawnSync({
cmd: ["bun", "run", "detect"], cmd: ["bun", "run", "detect"],
env, env,
stdout: "inherit", stdout: "inherit",
stderr: "inherit" stderr: "inherit"
}); });
await detectProcess.exited; if (detectResult.exitCode !== 0) {
console.error(`[${task_trigger}] detect 执行失败,退出码: ${detectResult.exitCode}`);
await redis.quit();
process.exit(1);
}
console.log(`[${task_trigger}] detect 执行完成`); console.log(`[${task_trigger}] detect 执行完成`);
// 运行 bun run task:gsheet // 运行 bun run task:gsheet
console.log(`[${task_trigger}] 开始执行 task:gsheet`); console.log(`[${task_trigger}] 开始执行 task:gsheet`);
const gsheetProcess = spawn({ const gsheetResult = spawnSync({
cmd: ["bun", "run", "task:gsheet"], cmd: ["bun", "run", "task:gsheet"],
env, env,
stdout: "inherit", stdout: "inherit",
stderr: "inherit" stderr: "inherit"
}); });
await gsheetProcess.exited; if (gsheetResult.exitCode !== 0) {
console.error(`[${task_trigger}] task:gsheet 执行失败,退出码: ${gsheetResult.exitCode}`);
await redis.quit();
process.exit(1);
}
console.log(`[${task_trigger}] task:gsheet 执行完成`); console.log(`[${task_trigger}] task:gsheet 执行完成`);
// 延迟执行 task:gsheet:ai 避免 Google Sheet 限流 // 延迟执行 task:gsheet:ai 避免 Google Sheet 限流
...@@ -65,24 +73,32 @@ async function main() { ...@@ -65,24 +73,32 @@ async function main() {
// 运行 bun run task:gsheet:ai // 运行 bun run task:gsheet:ai
console.log(`[${task_trigger}] 开始执行 task:gsheet:ai`); console.log(`[${task_trigger}] 开始执行 task:gsheet:ai`);
const gsheetAiProcess = spawn({ const gsheetAiResult = spawnSync({
cmd: ["bun", "run", "task:gsheet:ai"], cmd: ["bun", "run", "task:gsheet:ai"],
env, env,
stdout: "inherit", stdout: "inherit",
stderr: "inherit" stderr: "inherit"
}); });
await gsheetAiProcess.exited; if (gsheetAiResult.exitCode !== 0) {
console.error(`[${task_trigger}] task:gsheet:ai 执行失败,退出码: ${gsheetAiResult.exitCode}`);
await redis.quit();
process.exit(1);
}
console.log(`[${task_trigger}] task:gsheet:ai 执行完成`); console.log(`[${task_trigger}] task:gsheet:ai 执行完成`);
// 运行 bun run notify-slack // 运行 bun run notify-slack
console.log(`[${task_trigger}] 开始执行 notify-slack`); console.log(`[${task_trigger}] 开始执行 notify-slack`);
const notifySlackProcess = spawn({ const notifySlackResult = spawnSync({
cmd: ["bun", "run", "notify-slack"], cmd: ["bun", "run", "notify-slack"],
env, env,
stdout: "inherit", stdout: "inherit",
stderr: "inherit" stderr: "inherit"
}); });
await notifySlackProcess.exited; if (notifySlackResult.exitCode !== 0) {
console.error(`[${task_trigger}] notify-slack 执行失败,退出码: ${notifySlackResult.exitCode}`);
await redis.quit();
process.exit(1);
}
console.log(`[${task_trigger}] notify-slack 执行完成`); console.log(`[${task_trigger}] notify-slack 执行完成`);
if (task_trigger === "should_run_tasks") { if (task_trigger === "should_run_tasks") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment