Fix issue with submodules and Base Directory

This commit is contained in:
Ben 2025-08-28 12:08:36 +02:00
parent 69082670f9
commit c906212c18

View file

@ -1492,9 +1492,25 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
]
);
$this->create_workdir();
$dirWithCommit = $this->workdir;
if ($this->application->settings->is_git_submodules_enabled && $this->basedir !== $this->workdir) {
$this->execute_remote_command(
[
executeInDocker($this->deployment_uuid, "if git cat-file -e {$this->commit}^{commit} > /dev/null 2>&1;then echo 'No'; else echo 'Yes';fi"),
'hidden' => true,
'save' => 'workdir_is_submodule',
]
);
$this->application_deployment_queue->addLogEntry("Workdir is submodule: {$this->saved_outputs->get('workdir_is_submodule')}");
if (trim($this->saved_outputs->get('workdir_is_submodule')) === 'Yes') {
$dirWithCommit = $this->basedir;
}
}
$this->execute_remote_command(
[
executeInDocker($this->deployment_uuid, "cd {$this->workdir} && git log -1 {$this->commit} --pretty=%B"),
executeInDocker($this->deployment_uuid, "cd {$dirWithCommit} && git log -1 {$this->commit} --pretty=%B"),
'hidden' => true,
'save' => 'commit_message',
]