Skip to content

Commit c9b2f9d

Browse files
committed
feat: add guard when creating release directory
1 parent f9ecf35 commit c9b2f9d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

cli/src/services/release.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ export class Release {
6464
const prevResult = await sshExec(this.connection, `readlink "${stackDir}/current" 2>/dev/null || echo ""`);
6565
const previousSymlink = prevResult.stdout.trim() || null;
6666

67-
await sshExec(this.connection, `mkdir -p "${dir}"`);
67+
const mkdirResult = await sshExec(this.connection, `mkdir -p "${dir}"`);
68+
if (mkdirResult.exitCode !== 0) {
69+
throw new DeployError(
70+
`Failed to create release directory ${dir}: ${mkdirResult.stderr.trim() || `exit ${mkdirResult.exitCode}`}`,
71+
ErrorCode.DEPLOY_FAILED,
72+
`Ensure the deploy user has write access to ${stackDir}. Run once as root:\n mkdir -p '${stackDir}' && chown ${this.connection.user}: '${stackDir}'`,
73+
);
74+
}
6875

6976
// Write compose and metadata via stdin (no shell escaping needed)
7077
const [composeHandle, metaHandle] = await Promise.all([

0 commit comments

Comments
 (0)