fix: change to execa from utils

This commit is contained in:
Andras Bacsai 2022-09-08 09:32:50 +02:00
parent e184f99617
commit a1a973a873

View File

@ -500,6 +500,7 @@ export async function createRemoteEngineConfiguration(id: string) {
return await fs.writeFile(`${homedir}/.ssh/config`, sshConfig.stringify(config)) return await fs.writeFile(`${homedir}/.ssh/config`, sshConfig.stringify(config))
} }
export async function executeDockerCmd({ debug, buildId, applicationId, dockerId, command }: { debug?: boolean, buildId?: string, applicationId?: string, dockerId: string, command: string }): Promise<any> { export async function executeDockerCmd({ debug, buildId, applicationId, dockerId, command }: { debug?: boolean, buildId?: string, applicationId?: string, dockerId: string, command: string }): Promise<any> {
const { execaCommand } = await import('execa')
let { remoteEngine, remoteIpAddress, engine } = await prisma.destinationDocker.findUnique({ where: { id: dockerId } }) let { remoteEngine, remoteIpAddress, engine } = await prisma.destinationDocker.findUnique({ where: { id: dockerId } })
if (remoteEngine) { if (remoteEngine) {
await createRemoteEngineConfiguration(dockerId) await createRemoteEngineConfiguration(dockerId)
@ -515,10 +516,7 @@ export async function executeDockerCmd({ debug, buildId, applicationId, dockerId
if (command.startsWith(`docker build --progress plain`)) { if (command.startsWith(`docker build --progress plain`)) {
return await asyncExecShellStream({ debug, buildId, applicationId, command, engine }); return await asyncExecShellStream({ debug, buildId, applicationId, command, engine });
} }
return await asyncExecShell( return await execaCommand(command, { env: { DOCKER_BUILDKIT: "1", DOCKER_HOST: engine }, shell: true })
`DOCKER_BUILDKIT=1 DOCKER_HOST="${engine}" ${command}`
);
} }
export async function startTraefikProxy(id: string): Promise<void> { export async function startTraefikProxy(id: string): Promise<void> {
const { engine, network, remoteEngine, remoteIpAddress } = await prisma.destinationDocker.findUnique({ where: { id } }) const { engine, network, remoteEngine, remoteIpAddress } = await prisma.destinationDocker.findUnique({ where: { id } })