feat(#147): add hash commit when deploying

This commit is contained in:
Mauricio Siu
2024-06-27 21:53:26 -06:00
parent 817fa91173
commit 3cfc2d6cd8
9 changed files with 71 additions and 2 deletions

View File

@@ -162,6 +162,7 @@ export const applicationRouter = createTRPCRouter({
const jobData: DeploymentJob = {
applicationId: input.applicationId,
titleLog: "Rebuild deployment",
descriptionLog: "",
type: "redeploy",
applicationType: "application",
};
@@ -294,6 +295,7 @@ export const applicationRouter = createTRPCRouter({
const jobData: DeploymentJob = {
applicationId: input.applicationId,
titleLog: "Manual deployment",
descriptionLog: "",
type: "deploy",
applicationType: "application",
};

View File

@@ -130,15 +130,18 @@ export const updateApplicationStatus = async (
export const deployApplication = async ({
applicationId,
titleLog = "Manual deployment",
descriptionLog = "",
}: {
applicationId: string;
titleLog: string;
descriptionLog: string;
}) => {
const application = await findApplicationById(applicationId);
const admin = await findAdmin();
const deployment = await createDeployment({
applicationId: applicationId,
title: titleLog,
description: descriptionLog,
});
try {
@@ -173,14 +176,17 @@ export const deployApplication = async ({
export const rebuildApplication = async ({
applicationId,
titleLog = "Rebuild deployment",
descriptionLog = "",
}: {
applicationId: string;
titleLog: string;
descriptionLog: string;
}) => {
const application = await findApplicationById(applicationId);
const deployment = await createDeployment({
applicationId: applicationId,
title: titleLog,
description: descriptionLog,
});
try {

View File

@@ -134,15 +134,18 @@ export const updateCompose = async (
export const deployCompose = async ({
composeId,
titleLog = "Manual deployment",
descriptionLog = "",
}: {
composeId: string;
titleLog: string;
descriptionLog: string;
}) => {
const compose = await findComposeById(composeId);
const admin = await findAdmin();
const deployment = await createDeploymentCompose({
composeId: composeId,
title: titleLog,
description: descriptionLog,
});
try {
@@ -170,14 +173,17 @@ export const deployCompose = async ({
export const rebuildCompose = async ({
composeId,
titleLog = "Rebuild deployment",
descriptionLog = "",
}: {
composeId: string;
titleLog: string;
descriptionLog: string;
}) => {
const compose = await findComposeById(composeId);
const deployment = await createDeploymentCompose({
composeId: composeId,
title: titleLog,
description: descriptionLog,
});
try {

View File

@@ -60,6 +60,7 @@ export const createDeployment = async (
title: deployment.title || "Deployment",
status: "running",
logPath: logFilePath,
description: deployment.description || "",
})
.returning();
if (deploymentCreate.length === 0 || !deploymentCreate[0]) {
@@ -100,6 +101,7 @@ export const createDeploymentCompose = async (
.values({
composeId: deployment.composeId,
title: deployment.title || "Deployment",
description: deployment.description || "",
status: "running",
logPath: logFilePath,
})