Merge pull request #413 from coollabsio/next

v2.7.0 again
This commit is contained in:
Andras Bacsai 2022-05-06 15:40:30 +02:00 committed by GitHub
commit 6a3f4ba171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 155 additions and 145 deletions

View File

@ -114,5 +114,5 @@ export const getSession: GetSession = function ({ locals }) {
};
export async function handleError({ error, event }) {
if (!dev) sentry.captureException(error, event);
// if (!dev) sentry.captureException(error, event);
}

View File

@ -20,21 +20,21 @@ import { t } from './translations';
try {
if (!dev) {
Sentry.init({
dsn: process.env['COOLIFY_SENTRY_DSN'],
tracesSampleRate: 0,
environment: 'production',
debug: true,
release: currentVersion,
initialScope: {
tags: {
appId: process.env['COOLIFY_APP_ID'],
'os.arch': getOsArch(),
'os.platform': os.platform(),
'os.release': os.release()
}
}
});
// Sentry.init({
// dsn: process.env['COOLIFY_SENTRY_DSN'],
// tracesSampleRate: 0,
// environment: 'production',
// debug: true,
// release: currentVersion,
// initialScope: {
// tags: {
// appId: process.env['COOLIFY_APP_ID'],
// 'os.arch': getOsArch(),
// 'os.platform': os.platform(),
// 'os.release': os.release()
// }
// }
// });
}
} catch (err) {
console.log('Could not initialize Sentry, no worries.');

View File

@ -58,7 +58,7 @@ export function ErrorHandler(e: {
truncatedError.message = 'git clone failed';
}
if (!e.message?.includes('Coolify Proxy is not running')) {
sentry.captureException(truncatedError);
// sentry.captureException(truncatedError);
}
const payload = {
status: truncatedError.status || 500,

View File

@ -328,7 +328,7 @@ export default async function (job: Job<BuilderJob, void, string>): Promise<void
await saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });
} catch (error) {
await saveBuildLog({ line: error, buildId, applicationId });
sentry.captureException(error);
// sentry.captureException(error);
throw new Error(error);
}
await saveBuildLog({ line: 'Proxy will be updated shortly.', buildId, applicationId });

View File

@ -3,21 +3,19 @@ import { buildQueue } from '$lib/queues';
import type { RequestHandler } from '@sveltejs/kit';
import * as db from '$lib/database';
export const post: RequestHandler = async (event) => {
const { buildId, applicationId } = await event.request.json();
if (!buildId) {
return {
status: 500,
body: {
message: 'Build ID not found.'
async function cleanupDB(buildId: string) {
const data = await db.prisma.build.findUnique({ where: { id: buildId } });
if (data?.status === 'queued' || data?.status === 'running') {
await db.prisma.build.update({ where: { id: buildId }, data: { status: 'failed' } });
}
};
}
try {
async function stopBuild(buildId, applicationId) {
let count = 0;
await new Promise<void>(async (resolve, reject) => {
const job = await buildQueue.getJob(buildId);
if (!job) {
await cleanupDB(buildId);
return resolve();
}
const {
@ -31,9 +29,9 @@ export const post: RequestHandler = async (event) => {
clearInterval(interval);
return resolve();
}
if (count > 60) {
if (count > 100) {
clearInterval(interval);
reject(new Error('Could not cancel build.'));
return reject(new Error('Build canceled'));
}
const { stdout: buildContainers } = await asyncExecShell(
@ -57,14 +55,21 @@ export const post: RequestHandler = async (event) => {
}
count++;
} catch (error) {}
}, 1000);
resolve();
}, 100);
});
const data = await db.prisma.build.findUnique({ where: { id: buildId } });
if (data?.status === 'queued' || data?.status === 'running') {
await db.prisma.build.update({ where: { id: buildId }, data: { status: 'failed' } });
}
export const post: RequestHandler = async (event) => {
const { buildId, applicationId } = await event.request.json();
if (!buildId) {
return {
status: 500,
body: {
message: 'Build ID not found.'
}
};
}
try {
await stopBuild(buildId, applicationId);
return {
status: 200,
body: {

View File

@ -129,9 +129,13 @@
{#if currentStatus === 'running'}
<button
on:click={cancelBuild}
class:animation-spin={cancelInprogress}
class="bg-transparent hover:text-red-500 hover:bg-coolgray-500"
data-tooltip="Cancel build"
>
{#if cancelInprogress}
Cancelling...
{:else}
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
@ -146,6 +150,7 @@
<circle cx="12" cy="12" r="9" />
<path d="M10 10l4 4m0 -4l-4 4" />
</svg>
{/if}
</button>
{/if}
</div>