This is relevant if every project needs to use an individual SSH pubkey.
Include this with all Gitonomy\Git\Repository, and
\Symfony\Component\Process\Processes.
public getProcessEnv ( ) : array | ||
리턴 | array |
/** * Run a shell command. * * @param string $command The command to run * @param string|null $workingDir The working dir to run command in * @throws RuntimeException */ protected function runCommand($command, $workingDir = null) { if (!empty($this->user)) { $command = sprintf('sudo -u %s %s', $this->user, $command); } if ($this->log) { $this->log->write(sprintf('Running command: %s', $command)); } $process = new AbortableProcess($command, $workingDir); $process->setEnv($this->project->getProcessEnv()); $process->setTimeout(1800); $process->run(); if (!$process->isSuccessful()) { throw new RuntimeException($process->getErrorOutput()); } }
/** * Check the status using the deploy:check capistrano method */ public function ping(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) { $env = $project->getProcessEnv(); $command = $this->getCommand('deploy:check', 'web', $project->Name . ':' . $environment->Name, null, $env, $log); $command->run(function ($type, $buffer) use($log) { $log->write($buffer); echo $buffer; }); }