fix : ajout d'un préfix pour les path des app et correction de l'affichage
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
@@ -7,19 +7,33 @@ namespace App\Service;
|
||||
use App\Entity\Environment;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
final class DeployService
|
||||
final readonly class DeployService
|
||||
{
|
||||
public function __construct(
|
||||
private AppPathResolver $pathResolver,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return array{success: bool, output: string, exitCode: int}
|
||||
*/
|
||||
public function deploy(Environment $environment, string $tag): array
|
||||
{
|
||||
$scriptPath = $environment->getDeployScriptPath();
|
||||
$relativePath = $environment->getDeployScriptPath();
|
||||
|
||||
if (null === $scriptPath || !file_exists($scriptPath)) {
|
||||
if (null === $relativePath) {
|
||||
return [
|
||||
'success' => false,
|
||||
'output' => sprintf('Deploy script not found: %s', $scriptPath ?? 'null'),
|
||||
'output' => 'Deploy script path is not configured.',
|
||||
'exitCode' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
$scriptPath = $this->pathResolver->resolve($relativePath);
|
||||
|
||||
if (!file_exists($scriptPath)) {
|
||||
return [
|
||||
'success' => false,
|
||||
'output' => sprintf('Deploy script not found: %s', $scriptPath),
|
||||
'exitCode' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user