Skip to content

Commit

Permalink
Update runner.js
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Aug 21, 2023
1 parent df9b859 commit dbb172a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/executor/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,11 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
if (source.credentials?.github?.ssh) {
const configFileContent = `Host github.com\n\tStrictHostKeyChecking no\n\tIdentityFile ~/.ssh/id_github_com\n`;
await writeLog("$> writing SSH private key for cloning github.com repository");
await sshExec(`mkdir -p ~/.ssh; touch $HOME/.ssh/{id_github_com,config}; chmod 0600 $HOME/.ssh/*`);
await sshExec(`echo "${Buffer.from(source.credentials.github.ssh).toString('base64')}" | base64 --decode > $HOME/.ssh/config`, true);
await sshExec(`mkdir -p ~/.ssh; touch $HOME/.ssh/{id_github_com,config}; chmod 0600 $HOME/.ssh/*`, false);
await sshExec(`echo "${Buffer.from(source.credentials.github.ssh).toString('base64')}" | base64 --decode > $HOME/.ssh/id_github_com`, false);
// delete old config https://stackoverflow.com/a/36111659/3908409
await sshExec(`sed 's/^Host/\\n&/' $HOME/.ssh/config | sed '/^Host '"github.com"'$/,/^$/d;/^$/d' > $HOME/.ssh/config`, true);
await sshExec(`echo "${Buffer.from(configFileContent).toString('base64')}" | base64 --decode >> ~/.ssh/config`, true);
await sshExec(`sed 's/^Host/\\n&/' $HOME/.ssh/config | sed '/^Host '"github.com"'$/,/^$/d;/^$/d' > $HOME/.ssh/config`, false);
await sshExec(`echo "${Buffer.from(configFileContent).toString('base64')}" | base64 --decode >> ~/.ssh/config`, false);
}
executedCMD.push(`git clone ${escapeShell(url.toString())}` +
`${source.branch ? ` -b ${escapeShell(source.branch)}` : ''}` +
Expand Down

0 comments on commit dbb172a

Please sign in to comment.