feat: add scoped image sync endpoint

This commit is contained in:
2026-08-06 14:58:41 +00:00
parent 5078f6f3b1
commit 2fb618aa5c
11 changed files with 229 additions and 6 deletions
+18
View File
@@ -77,6 +77,22 @@ export class GitService {
});
}
async deploySync({ requestKey, expectedCommit }) {
return this.enqueue(async () => {
if (this.state.syncRequests.includes(requestKey)) {
return { duplicate: true, ...this.publicStatus() };
}
const result = await this.#deploy({
branch: this.state.activeBranch,
expectedCommit,
allowUnrelated: false,
});
this.state.syncRequests = [...this.state.syncRequests.slice(-199), requestKey];
await this.#saveState();
return result;
});
}
async #deploy({ branch, expectedCommit, allowUnrelated }) {
this.#validateBranch(branch);
await this.#assertClean();
@@ -163,6 +179,7 @@ export class GitService {
activeBranch: saved.activeBranch ?? this.config.defaultBranch,
deliveries: Array.isArray(saved.deliveries) ? saved.deliveries : [],
adminRequests: Array.isArray(saved.adminRequests) ? saved.adminRequests : [],
syncRequests: Array.isArray(saved.syncRequests) ? saved.syncRequests : [],
lastSuccess: saved.lastSuccess ?? null,
lastError: saved.lastError ?? null,
};
@@ -174,6 +191,7 @@ export class GitService {
activeBranch: this.config.defaultBranch,
deliveries: [],
adminRequests: [],
syncRequests: [],
lastSuccess: null,
lastError: null,
};