(cmd: string, stateDir: string, type: "artifacts" | "cache", dockerCmdExtras: string[])
| 1525 | } |
| 1526 | |
| 1527 | private async copyOut (cmd: string, stateDir: string, type: "artifacts" | "cache", dockerCmdExtras: string[]) { |
| 1528 | const safeJobName = this.safeJobName; |
| 1529 | const buildVolumeName = this.buildVolumeName; |
| 1530 | const cwd = this.argv.cwd; |
| 1531 | const helperImageName = this.argv.helperImage; |
| 1532 | |
| 1533 | await fs.mkdirp(`${cwd}/${stateDir}/${type}`); |
| 1534 | |
| 1535 | if (this.imageName(this._variables)) { |
| 1536 | const cmdWithWritablePerms = `${cmd}\nchmod -R u+w /${type} 2>/dev/null || true`; |
| 1537 | // eslint-disable-next-line @stylistic/quotes |
| 1538 | const escapedCmd = cmdWithWritablePerms.replaceAll('"', String.raw`\"`); |
| 1539 | const {stdout: containerId} = await Utils.bash(`${this.argv.containerExecutable} create -i ${dockerCmdExtras.join(" ")} -v ${buildVolumeName}:${this.ciProjectDir} -w ${this.ciProjectDir} ${helperImageName} bash -c "${escapedCmd}"`, cwd); |
| 1540 | this._containersToClean.push(containerId); |
| 1541 | await Utils.spawn([this.argv.containerExecutable, "start", containerId, "--attach"]); |
| 1542 | await Utils.spawn([this.argv.containerExecutable, "cp", `${containerId}:/${type}/.`, `${stateDir}/${type}/.`], cwd); |
| 1543 | } else if (this.argv.shellIsolation) { |
| 1544 | await Utils.bash(`bash -eo pipefail -c "${cmd}"`, `${cwd}/${stateDir}/builds/${safeJobName}`); |
| 1545 | } else if (!this.argv.shellIsolation) { |
| 1546 | await Utils.bash(`bash -eo pipefail -c "${cmd}"`, `${cwd}`); |
| 1547 | } |
| 1548 | } |
| 1549 | |
| 1550 | private refreshLongRunningSilentTimeout (writeStreams: WriteStreams) { |
| 1551 | clearTimeout(this._longRunningSilentTimeout); |
no test coverage detected