mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-12 06:40:58 +04:30
Track real website deploy success/failure and support master branch.
Deploy agent waits for build completion, writes status, and checks out origin/HEAD (main or master) so empty-main repos like mashinify can deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
acc8f35682
commit
f7cee26975
@@ -417,7 +417,7 @@ export class DomainAdminService {
|
||||
throw new BadRequestException('This domain has no storefront deploy configured');
|
||||
}
|
||||
|
||||
const markDeploy = async (status: 'started' | 'failed') => {
|
||||
const markDeploy = async (status: 'started' | 'success' | 'failed') => {
|
||||
const updated = await this.prisma.domain.update({
|
||||
where: { id: domainId },
|
||||
data: {
|
||||
@@ -428,28 +428,37 @@ export class DomainAdminService {
|
||||
return updated;
|
||||
};
|
||||
|
||||
await markDeploy('started');
|
||||
|
||||
try {
|
||||
await this.websiteDeployAgent.deploy(slug);
|
||||
const result = await this.websiteDeployAgent.deploy(slug, { wait: true });
|
||||
const updated = await markDeploy(
|
||||
result.status === 'success' || result.status === 'accepted'
|
||||
? 'success'
|
||||
: 'failed',
|
||||
);
|
||||
|
||||
return {
|
||||
status: 'ok' as const,
|
||||
slug,
|
||||
host: domain.host,
|
||||
message:
|
||||
result.detail?.trim() ||
|
||||
(updated.lastDeployStatus === 'success'
|
||||
? 'Deploy succeeded on websites server'
|
||||
: 'Deploy finished with unknown status'),
|
||||
lastDeployedAt: updated.lastDeployedAt?.toISOString() ?? null,
|
||||
lastDeployStatus: updated.lastDeployStatus,
|
||||
};
|
||||
} catch (err) {
|
||||
await markDeploy('failed');
|
||||
if (err instanceof ServiceUnavailableException) {
|
||||
throw err;
|
||||
}
|
||||
throw new ServiceUnavailableException(
|
||||
err instanceof Error ? err.message : 'Deploy failed to start',
|
||||
err instanceof Error ? err.message : 'Deploy failed',
|
||||
);
|
||||
}
|
||||
|
||||
const updated = await markDeploy('started');
|
||||
|
||||
return {
|
||||
status: 'accepted' as const,
|
||||
slug,
|
||||
host: domain.host,
|
||||
message: 'Deploy started on websites server',
|
||||
lastDeployedAt: updated.lastDeployedAt?.toISOString() ?? null,
|
||||
lastDeployStatus: updated.lastDeployStatus,
|
||||
};
|
||||
}
|
||||
|
||||
async update(domainIdRaw: string, dto: UpdateDomainAdminDto, actor: AuthUser) {
|
||||
|
||||
Reference in New Issue
Block a user