This commit is contained in:
Andras Bacsai 2022-12-07 13:45:56 +01:00
parent c0882dffde
commit 0dad616c38
2 changed files with 17 additions and 16 deletions

View File

@ -20,7 +20,11 @@ export default async function (data) {
.toString()
.trim()
.split('\n');
Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
Dockerfile.forEach((line, index) => {
if (line.startsWith('FROM')) {
Dockerfile.splice(index + 1, 0, `LABEL coolify.buildId=${buildId}`);
}
});
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
@ -28,11 +32,9 @@ export default async function (data) {
(pullmergeRequestId && secret.isPRMRSecret) ||
(!pullmergeRequestId && !secret.isPRMRSecret)
) {
Dockerfile.unshift(`ARG ${secret.name}=${secret.value}`);
Dockerfile.forEach((line, index) => {
if (line.startsWith('FROM')) {
Dockerfile.splice(index + 1, 0, `ARG ${secret.name}`);
Dockerfile.splice(index + 1, 0, `ARG ${secret.name}=${secret.value}`);
}
});
}

View File

@ -843,18 +843,11 @@ export async function saveApplicationSource(request: FastifyRequest<SaveApplicat
const { id } = request.params
const { gitSourceId, forPublic, type, simpleDockerfile } = request.body
if (forPublic) {
if (gitSourceId) {
await prisma.application.update({
where: { id },
data: { gitSource: { connect: { id: gitSourceId } } }
});
} else {
const publicGit = await prisma.gitSource.findFirst({ where: { type, forPublic } });
await prisma.application.update({
where: { id },
data: { gitSource: { connect: { id: publicGit.id } } }
});
}
const publicGit = await prisma.gitSource.findFirst({ where: { type, forPublic } });
await prisma.application.update({
where: { id },
data: { gitSource: { connect: { id: publicGit.id } } }
});
}
if (simpleDockerfile) {
await prisma.application.update({
@ -862,6 +855,12 @@ export async function saveApplicationSource(request: FastifyRequest<SaveApplicat
data: { simpleDockerfile, settings: { update: { autodeploy: false } } }
});
}
if (gitSourceId) {
await prisma.application.update({
where: { id },
data: { gitSource: { connect: { id: gitSourceId } } }
});
}
return reply.code(201).send()