Add jobId to deployment flow for tracking deployments

Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-31 06:04:25 +00:00
parent 2e0d444cb2
commit 240f0b6017
7 changed files with 45 additions and 9 deletions

View File

@@ -167,10 +167,12 @@ export const deployApplication = async ({
applicationId,
titleLog = "Manual deployment",
descriptionLog = "",
jobId,
}: {
applicationId: string;
titleLog: string;
descriptionLog: string;
jobId?: string;
}) => {
const application = await findApplicationById(applicationId);
const serverId = application.buildServerId || application.serverId;
@@ -180,6 +182,7 @@ export const deployApplication = async ({
applicationId: applicationId,
title: titleLog,
description: descriptionLog,
jobId,
});
try {
@@ -270,10 +273,12 @@ export const rebuildApplication = async ({
applicationId,
titleLog = "Rebuild deployment",
descriptionLog = "",
jobId,
}: {
applicationId: string;
titleLog: string;
descriptionLog: string;
jobId?: string;
}) => {
const application = await findApplicationById(applicationId);
const serverId = application.buildServerId || application.serverId;
@@ -283,6 +288,7 @@ export const rebuildApplication = async ({
applicationId: applicationId,
title: titleLog,
description: descriptionLog,
jobId,
});
try {
@@ -337,11 +343,13 @@ export const deployPreviewApplication = async ({
titleLog = "Preview Deployment",
descriptionLog = "",
previewDeploymentId,
jobId,
}: {
applicationId: string;
titleLog: string;
descriptionLog: string;
previewDeploymentId: string;
jobId?: string;
}) => {
const application = await findApplicationById(applicationId);
@@ -349,6 +357,7 @@ export const deployPreviewApplication = async ({
title: titleLog,
description: descriptionLog,
previewDeploymentId: previewDeploymentId,
jobId,
});
const previewDeployment =

View File

@@ -205,10 +205,12 @@ export const deployCompose = async ({
composeId,
titleLog = "Manual deployment",
descriptionLog = "",
jobId,
}: {
composeId: string;
titleLog: string;
descriptionLog: string;
jobId?: string;
}) => {
const compose = await findComposeById(composeId);
@@ -219,6 +221,7 @@ export const deployCompose = async ({
composeId: composeId,
title: titleLog,
description: descriptionLog,
jobId,
});
try {
@@ -321,10 +324,12 @@ export const rebuildCompose = async ({
composeId,
titleLog = "Rebuild deployment",
descriptionLog = "",
jobId,
}: {
composeId: string;
titleLog: string;
descriptionLog: string;
jobId?: string;
}) => {
const compose = await findComposeById(composeId);
@@ -332,6 +337,7 @@ export const rebuildCompose = async ({
composeId: composeId,
title: titleLog,
description: descriptionLog,
jobId,
});
try {

View File

@@ -71,7 +71,7 @@ export const createDeployment = async (
deployment: Omit<
typeof apiCreateDeployment._type,
"deploymentId" | "createdAt" | "status" | "logPath"
>,
> & { jobId?: string },
) => {
const application = await findApplicationById(deployment.applicationId);
try {
@@ -107,6 +107,7 @@ export const createDeployment = async (
const deploymentCreate = await db
.insert(deployments)
.values({
...(deployment.jobId && { deploymentId: deployment.jobId }),
applicationId: deployment.applicationId,
title: deployment.title || "Deployment",
status: "running",
@@ -152,7 +153,7 @@ export const createDeploymentPreview = async (
deployment: Omit<
typeof apiCreateDeploymentPreview._type,
"deploymentId" | "createdAt" | "status" | "logPath"
>,
> & { jobId?: string },
) => {
const previewDeployment = await findPreviewDeploymentById(
deployment.previewDeploymentId,
@@ -191,6 +192,7 @@ export const createDeploymentPreview = async (
const deploymentCreate = await db
.insert(deployments)
.values({
...(deployment.jobId && { deploymentId: deployment.jobId }),
title: deployment.title || "Deployment",
status: "running",
logPath: logFilePath,
@@ -235,7 +237,7 @@ export const createDeploymentCompose = async (
deployment: Omit<
typeof apiCreateDeploymentCompose._type,
"deploymentId" | "createdAt" | "status" | "logPath"
>,
> & { jobId?: string },
) => {
const compose = await findComposeById(deployment.composeId);
try {
@@ -268,6 +270,7 @@ echo "Initializing deployment\n" >> ${logFilePath};
const deploymentCreate = await db
.insert(deployments)
.values({
...(deployment.jobId && { deploymentId: deployment.jobId }),
composeId: deployment.composeId,
title: deployment.title || "Deployment",
description: deployment.description || "",