fix: Build log fix attempt #1

This commit is contained in:
Andras Bacsai
2022-04-03 22:18:04 +02:00
parent 5160d0780e
commit 781d034484
2 changed files with 12 additions and 25 deletions

View File

@@ -160,7 +160,7 @@ export default async function (job) {
}); });
deployNeeded = true; deployNeeded = true;
if (configHash) { if (configHash) {
saveBuildLog({ line: 'Configuration changed.', buildId, applicationId }); await saveBuildLog({ line: 'Configuration changed.', buildId, applicationId });
} }
} else { } else {
deployNeeded = false; deployNeeded = false;
@@ -209,13 +209,13 @@ export default async function (job) {
pythonVariable pythonVariable
}); });
else { 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.`); throw new Error(`Build pack ${buildPack} not found.`);
} }
deployNeeded = true; deployNeeded = true;
} else { } else {
deployNeeded = false; deployNeeded = false;
saveBuildLog({ line: 'Nothing changed.', buildId, applicationId }); await saveBuildLog({ line: 'Nothing changed.', buildId, applicationId });
} }
// Deploy to Docker Engine // Deploy to Docker Engine
@@ -265,15 +265,7 @@ export default async function (job) {
// //
} }
try { try {
saveBuildLog({ line: 'Deployment started.', buildId, applicationId }); await 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}`);
// }
// }
const composeVolumes = volumes.map((volume) => { const composeVolumes = volumes.map((volume) => {
return { return {
[`${volume.split(':')[0]}`]: { [`${volume.split(':')[0]}`]: {
@@ -306,19 +298,12 @@ export default async function (job) {
await asyncExecShell( await asyncExecShell(
`DOCKER_HOST=${host} docker compose --project-directory ${workdir} up -d` `DOCKER_HOST=${host} docker compose --project-directory ${workdir} up -d`
); );
await saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });
// 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 });
} catch (error) { } catch (error) {
saveBuildLog({ line: error, buildId, applicationId }); await saveBuildLog({ line: error, buildId, applicationId });
sentry.captureException(error); sentry.captureException(error);
throw new Error(error); throw new Error(error);
} }
saveBuildLog({ line: 'Proxy will be updated shortly.', buildId, applicationId }); await saveBuildLog({ line: 'Proxy will be updated shortly.', buildId, applicationId });
} }
} }

View File

@@ -195,9 +195,11 @@
</div> </div>
{/each} {/each}
</div> </div>
<div class="flex space-x-2"> {#if builds.length > 0}
<button disabled={noMoreBuilds} class="w-full" on:click={loadMoreBuilds}>Load More</button> <div class="flex space-x-2">
</div> <button disabled={noMoreBuilds} class="w-full" on:click={loadMoreBuilds}>Load More</button>
</div>
{/if}
</div> </div>
<div class="flex-1 md:w-96"> <div class="flex-1 md:w-96">
{#if buildId} {#if buildId}