WHMSLIVE 部署验证企微HR主数据镜像
这个提交包含在:
@@ -100,6 +100,9 @@ function summarizeError(json) {
|
||||
async function login(baseUrl, credential) {
|
||||
const result = await fetchJson(`${baseUrl}/api/auth/login`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"x-device-fingerprint": "whmslive-hr-master-sync",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
identifier: credential.identifier,
|
||||
password: credential.password,
|
||||
@@ -145,6 +148,14 @@ function sanitizeRun(run) {
|
||||
};
|
||||
}
|
||||
|
||||
function isAcceptableRun(run) {
|
||||
return run?.status === "success" || run?.status === "partial";
|
||||
}
|
||||
|
||||
function isSkippedRun(run) {
|
||||
return run?.status === "skipped";
|
||||
}
|
||||
|
||||
async function execute(options) {
|
||||
const startedAt = new Date().toISOString();
|
||||
const steps = [];
|
||||
@@ -206,7 +217,18 @@ async function execute(options) {
|
||||
steps: [...steps, step("FAIL", "dry-run", { status: dryRun.status, error: summarizeError(dryRun.json) })],
|
||||
};
|
||||
}
|
||||
steps.push(step("PASS", "dry-run", sanitizeRun(dryRun.json?.data)));
|
||||
const dryRunSummary = sanitizeRun(dryRun.json?.data);
|
||||
if (!isAcceptableRun(dryRunSummary)) {
|
||||
const status = isSkippedRun(dryRunSummary) ? "SKIP" : "FAIL";
|
||||
return {
|
||||
status,
|
||||
conclusion: isSkippedRun(dryRunSummary) ? "DRY_RUN_SKIPPED" : "DRY_RUN_FAILED",
|
||||
startedAt,
|
||||
finishedAt: new Date().toISOString(),
|
||||
steps: [...steps, step(status, "dry-run", dryRunSummary)],
|
||||
};
|
||||
}
|
||||
steps.push(step("PASS", "dry-run", dryRunSummary));
|
||||
|
||||
if (!options.applyApproved) {
|
||||
return {
|
||||
@@ -245,12 +267,24 @@ async function execute(options) {
|
||||
};
|
||||
}
|
||||
|
||||
const applySummary = sanitizeRun(apply.json?.data);
|
||||
if (!isAcceptableRun(applySummary)) {
|
||||
const status = isSkippedRun(applySummary) ? "SKIP" : "FAIL";
|
||||
return {
|
||||
status,
|
||||
conclusion: isSkippedRun(applySummary) ? "APPLY_SKIPPED" : "APPLY_FAILED",
|
||||
startedAt,
|
||||
finishedAt: new Date().toISOString(),
|
||||
steps: [...steps, step(status, "apply", applySummary)],
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
status: "PASS",
|
||||
conclusion: "APPLY_DONE",
|
||||
startedAt,
|
||||
finishedAt: new Date().toISOString(),
|
||||
steps: [...steps, step("PASS", "apply", sanitizeRun(apply.json?.data))],
|
||||
steps: [...steps, step("PASS", "apply", applySummary)],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户