fix: Lets await!

This commit is contained in:
Andras Bacsai 2022-04-03 22:53:11 +02:00
parent c36bd34a1a
commit 53947d805b
5 changed files with 20 additions and 12 deletions

View File

@ -140,7 +140,11 @@ export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, ap
`
);
await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /app`);
saveBuildLog({ line: 'Copied default configuration file for PHP.', buildId, applicationId });
await saveBuildLog({
line: 'Copied default configuration file for PHP.',
buildId,
applicationId
});
} else if (staticDeployments.includes(buildPack)) {
await fs.writeFile(
`${workdir}/nginx.conf`,
@ -194,7 +198,7 @@ export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, ap
}
`
);
saveBuildLog({ line: 'Copied default configuration file.', buildId, applicationId });
await saveBuildLog({ line: 'Copied default configuration file.', buildId, applicationId });
}
} catch (error) {
console.log(error);

View File

@ -88,12 +88,12 @@ export async function buildImage({
debug = false
}) {
if (isCache) {
saveBuildLog({ line: `Building cache image started.`, buildId, applicationId });
await saveBuildLog({ line: `Building cache image started.`, buildId, applicationId });
} else {
saveBuildLog({ line: `Building image started.`, buildId, applicationId });
await saveBuildLog({ line: `Building image started.`, buildId, applicationId });
}
if (!debug && isCache) {
saveBuildLog({
await saveBuildLog({
line: `Debug turned off. To see more details, allow it in the configuration.`,
buildId,
applicationId
@ -132,7 +132,11 @@ export async function streamEvents({ stream, docker, buildId, applicationId, deb
} else if (event.stream) {
if (event.stream !== '\n') {
if (debug)
saveBuildLog({ line: `${event.stream.replace('\n', '')}`, buildId, applicationId });
await saveBuildLog({
line: `${event.stream.replace('\n', '')}`,
buildId,
applicationId
});
}
}
}

View File

@ -14,7 +14,7 @@ export default async function ({
buildId
}): Promise<any> {
try {
saveBuildLog({ line: 'GitHub importer started.', buildId, applicationId });
await saveBuildLog({ line: 'GitHub importer started.', buildId, applicationId });
const { privateKey, appId, installationId } = await db.getUniqueGithubApp({ githubAppId });
const githubPrivateKey = privateKey.replace(/\\n/g, '\n').replace(/"/g, '');
@ -34,7 +34,7 @@ export default async function ({
}
})
.json();
saveBuildLog({
await saveBuildLog({
line: `Cloning ${repository}:${branch} branch.`,
buildId,
applicationId

View File

@ -11,11 +11,11 @@ export default async function ({
buildId,
privateSshKey
}): Promise<any> {
saveBuildLog({ line: 'GitLab importer started.', buildId, applicationId });
await saveBuildLog({ line: 'GitLab importer started.', buildId, applicationId });
await asyncExecShell(`echo '${privateSshKey}' > ${repodir}/id.rsa`);
await asyncExecShell(`chmod 600 ${repodir}/id.rsa`);
saveBuildLog({
await saveBuildLog({
line: `Cloning ${repository}:${branch} branch.`,
buildId,
applicationId

View File

@ -135,12 +135,12 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
const workdir = `/tmp/build-sources/${job.data.repository}`;
if (!dev) await asyncExecShell(`rm -fr ${workdir}`);
}
saveBuildLog({
await saveBuildLog({
line: 'Failed to deploy!',
buildId: job.data.build_id,
applicationId: job.data.id
});
saveBuildLog({
await saveBuildLog({
line: `Reason: ${failedReason.toString()}`,
buildId: job.data.build_id,
applicationId: job.data.id