fixes
This commit is contained in:
parent
9d3ed85ffd
commit
12c0760cb3
@ -90,11 +90,6 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add default docker registry (dockerhub)
|
|
||||||
// const registries = await prisma.dockerRegistry.findMany()
|
|
||||||
// if (registries.length === 0) {
|
|
||||||
// await prisma.dockerRegistry.create({ data: { id: "0", name: 'Docker Hub', url: 'https://index.docker.io/v1/', isSystemWide: true, team: { connect: { id: '0' } } } })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
main()
|
main()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
@ -301,7 +301,7 @@ import * as buildpacks from '../lib/buildPacks';
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await executeDockerCmd({ debug, buildId, applicationId, dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
await executeDockerCmd({ debug, buildId, applicationId, dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
||||||
await saveBuildLog({ line: 'Deployment | Successful! 🎉', buildId, applicationId });
|
await saveBuildLog({ line: 'Deployed successfully 🎉', buildId, applicationId });
|
||||||
await prisma.build.update({ where: { id: buildId }, data: { status: 'success' } });
|
await prisma.build.update({ where: { id: buildId }, data: { status: 'success' } });
|
||||||
await prisma.application.update({
|
await prisma.application.update({
|
||||||
where: { id: applicationId },
|
where: { id: applicationId },
|
||||||
@ -362,7 +362,7 @@ import * as buildpacks from '../lib/buildPacks';
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await saveBuildLog({ line: 'Deployment | Deployment initiated.', buildId, applicationId });
|
await saveBuildLog({ line: 'Deployment initiated', buildId, applicationId });
|
||||||
const composeVolumes = volumes.map((volume) => {
|
const composeVolumes = volumes.map((volume) => {
|
||||||
return {
|
return {
|
||||||
[`${volume.split(':')[0]}`]: {
|
[`${volume.split(':')[0]}`]: {
|
||||||
@ -394,7 +394,7 @@ import * as buildpacks from '../lib/buildPacks';
|
|||||||
};
|
};
|
||||||
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
||||||
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
||||||
await saveBuildLog({ line: 'Deployment | Successful! 🎉', buildId, applicationId });
|
await saveBuildLog({ line: 'Deployed successfully 🎉', buildId, applicationId });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await saveBuildLog({ line: error, buildId, applicationId });
|
await saveBuildLog({ line: error, buildId, applicationId });
|
||||||
const foundBuild = await prisma.build.findUnique({ where: { id: buildId } })
|
const foundBuild = await prisma.build.findUnique({ where: { id: buildId } })
|
||||||
|
@ -641,9 +641,9 @@ export async function buildImage({
|
|||||||
commit
|
commit
|
||||||
}) {
|
}) {
|
||||||
if (isCache) {
|
if (isCache) {
|
||||||
await saveBuildLog({ line: `Cache | Building cache image.`, buildId, applicationId });
|
await saveBuildLog({ line: `Building cache image`, buildId, applicationId });
|
||||||
} else {
|
} else {
|
||||||
await saveBuildLog({ line: `Production | Building production image.`, buildId, applicationId });
|
await saveBuildLog({ line: `Building production image`, buildId, applicationId });
|
||||||
}
|
}
|
||||||
if (!debug) {
|
if (!debug) {
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
@ -667,12 +667,12 @@ export async function buildImage({
|
|||||||
|
|
||||||
const { status } = await prisma.build.findUnique({ where: { id: buildId } })
|
const { status } = await prisma.build.findUnique({ where: { id: buildId } })
|
||||||
if (status === 'canceled') {
|
if (status === 'canceled') {
|
||||||
throw new Error('Deployment | Canceled.')
|
throw new Error('Canceled.')
|
||||||
}
|
}
|
||||||
if (isCache) {
|
if (isCache) {
|
||||||
await saveBuildLog({ line: `Cache | Successful! 🎉`, buildId, applicationId });
|
await saveBuildLog({ line: `Building cache image built successful 🎉`, buildId, applicationId });
|
||||||
} else {
|
} else {
|
||||||
await saveBuildLog({ line: `Production | Successful! 🎉`, buildId, applicationId });
|
await saveBuildLog({ line: `Building production image built successful 🎉`, buildId, applicationId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1535,7 +1535,7 @@ export async function stopBuild(buildId, applicationId) {
|
|||||||
scheduler.workers.get('deployApplication').postMessage('cancel');
|
scheduler.workers.get('deployApplication').postMessage('cancel');
|
||||||
}
|
}
|
||||||
await cleanupDB(buildId, applicationId);
|
await cleanupDB(buildId, applicationId);
|
||||||
return reject(new Error('Deployment | Canceled.'));
|
return reject(new Error('Canceled.'));
|
||||||
}
|
}
|
||||||
const { stdout: buildContainers } = await executeDockerCmd({
|
const { stdout: buildContainers } = await executeDockerCmd({
|
||||||
dockerId,
|
dockerId,
|
||||||
@ -1568,7 +1568,7 @@ async function cleanupDB(buildId: string, applicationId: string) {
|
|||||||
if (data?.status === 'queued' || data?.status === 'running') {
|
if (data?.status === 'queued' || data?.status === 'running') {
|
||||||
await prisma.build.update({ where: { id: buildId }, data: { status: 'canceled' } });
|
await prisma.build.update({ where: { id: buildId }, data: { status: 'canceled' } });
|
||||||
}
|
}
|
||||||
await saveBuildLog({ line: 'Deployment | Canceled.', buildId, applicationId });
|
await saveBuildLog({ line: 'Canceled.', buildId, applicationId });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertTolOldVolumeNames(type) {
|
export function convertTolOldVolumeNames(type) {
|
||||||
|
@ -30,16 +30,15 @@ export default async function ({
|
|||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
const { default: got } = await import('got')
|
const { default: got } = await import('got')
|
||||||
const url = htmlUrl.replace('https://', '').replace('http://', '');
|
const url = htmlUrl.replace('https://', '').replace('http://', '');
|
||||||
await saveBuildLog({ line: 'Importer | Warming up GitHub importer.', buildId, applicationId });
|
|
||||||
if (forPublic) {
|
if (forPublic) {
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
line: `Importer | Cloning ${repository}:${branch} branch.`,
|
line: `Cloning ${repository}:${branch} branch`,
|
||||||
buildId,
|
buildId,
|
||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
if (gitCommitHash) {
|
if (gitCommitHash) {
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
line: `Importer | Checking out ${gitCommitHash} commit.`,
|
line: `Checking out ${gitCommitHash} commit`,
|
||||||
buildId,
|
buildId,
|
||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
@ -71,13 +70,13 @@ export default async function ({
|
|||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
line: `Importer | Cloning ${repository}:${branch} branch.`,
|
line: `Cloning ${repository}:${branch} branch`,
|
||||||
buildId,
|
buildId,
|
||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
if (gitCommitHash) {
|
if (gitCommitHash) {
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
line: `Importer | Checking out ${gitCommitHash} commit.`,
|
line: `Checking out ${gitCommitHash} commit`,
|
||||||
buildId,
|
buildId,
|
||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
|
@ -27,21 +27,19 @@ export default async function ({
|
|||||||
forPublic: boolean;
|
forPublic: boolean;
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
const url = htmlUrl.replace('https://', '').replace('http://', '').replace(/\/$/, '');
|
const url = htmlUrl.replace('https://', '').replace('http://', '').replace(/\/$/, '');
|
||||||
await saveBuildLog({ line: 'Importer | Warming up GitLab importer.', buildId, applicationId });
|
|
||||||
|
|
||||||
if (!forPublic) {
|
if (!forPublic) {
|
||||||
await asyncExecShell(`echo '${privateSshKey}' > ${repodir}/id.rsa`);
|
await asyncExecShell(`echo '${privateSshKey}' > ${repodir}/id.rsa`);
|
||||||
await asyncExecShell(`chmod 600 ${repodir}/id.rsa`);
|
await asyncExecShell(`chmod 600 ${repodir}/id.rsa`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
line: `Importer | Cloning ${repository}:${branch} branch.`,
|
line: `Cloning ${repository}:${branch} branch`,
|
||||||
buildId,
|
buildId,
|
||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
if (gitCommitHash) {
|
if (gitCommitHash) {
|
||||||
await saveBuildLog({
|
await saveBuildLog({
|
||||||
line: `Importer | Checking out ${gitCommitHash} commit.`,
|
line: `Checking out ${gitCommitHash} commit`,
|
||||||
buildId,
|
buildId,
|
||||||
applicationId
|
applicationId
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user