From 781d034484c3942ab667b5ff11d994f43a8ffc97 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sun, 3 Apr 2022 22:18:04 +0200 Subject: [PATCH] fix: Build log fix attempt #1 --- src/lib/queues/builder.ts | 29 +++++-------------- .../applications/[id]/logs/build/index.svelte | 8 +++-- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts index be46976c5..9af28504c 100644 --- a/src/lib/queues/builder.ts +++ b/src/lib/queues/builder.ts @@ -160,7 +160,7 @@ export default async function (job) { }); deployNeeded = true; if (configHash) { - saveBuildLog({ line: 'Configuration changed.', buildId, applicationId }); + await saveBuildLog({ line: 'Configuration changed.', buildId, applicationId }); } } else { deployNeeded = false; @@ -209,13 +209,13 @@ export default async function (job) { pythonVariable }); else { - saveBuildLog({ line: `Build pack ${buildPack} not found`, buildId, applicationId }); + await saveBuildLog({ line: `Build pack ${buildPack} not found`, buildId, applicationId }); throw new Error(`Build pack ${buildPack} not found.`); } deployNeeded = true; } else { deployNeeded = false; - saveBuildLog({ line: 'Nothing changed.', buildId, applicationId }); + await saveBuildLog({ line: 'Nothing changed.', buildId, applicationId }); } // Deploy to Docker Engine @@ -265,15 +265,7 @@ export default async function (job) { // } try { - saveBuildLog({ line: 'Deployment started.', buildId, applicationId }); - // for await (const volume of volumes) { - // const id = volume.split(':')[0]; - // try { - // await asyncExecShell(`DOCKER_HOST=${host} docker volume inspect ${id}`); - // } catch (error) { - // await asyncExecShell(`DOCKER_HOST=${host} docker volume create ${id}`); - // } - // } + await saveBuildLog({ line: 'Deployment started.', buildId, applicationId }); const composeVolumes = volumes.map((volume) => { return { [`${volume.split(':')[0]}`]: { @@ -306,19 +298,12 @@ export default async function (job) { await asyncExecShell( `DOCKER_HOST=${host} docker compose --project-directory ${workdir} up -d` ); - - // const { stderr } = await asyncExecShell( - // `DOCKER_HOST=${host} docker run ${envFound && `--env-file=${workdir}/.env`} ${labels.join( - // ' ' - // )} --name ${imageId} --network ${docker.network} --restart always ${volumes.length > 0 ? volumes : '' - // } -d ${applicationId}:${tag}` - // ); - saveBuildLog({ line: 'Deployment successful!', buildId, applicationId }); + await saveBuildLog({ line: 'Deployment successful!', buildId, applicationId }); } catch (error) { - saveBuildLog({ line: error, buildId, applicationId }); + await saveBuildLog({ line: error, buildId, applicationId }); sentry.captureException(error); throw new Error(error); } - saveBuildLog({ line: 'Proxy will be updated shortly.', buildId, applicationId }); + await saveBuildLog({ line: 'Proxy will be updated shortly.', buildId, applicationId }); } } diff --git a/src/routes/applications/[id]/logs/build/index.svelte b/src/routes/applications/[id]/logs/build/index.svelte index 6af35e417..da79168a7 100644 --- a/src/routes/applications/[id]/logs/build/index.svelte +++ b/src/routes/applications/[id]/logs/build/index.svelte @@ -195,9 +195,11 @@ {/each} -
- -
+ {#if builds.length > 0} +
+ +
+ {/if}
{#if buildId}