fix(git-import): explicitly specify ssh key and remove duplicate validation rules

- Add -i flag to explicitly specify ssh key path in git ls-remote operations
- Remove static $rules properties in favor of dynamic rules() method
- Fix test syntax error
This commit is contained in:
Andras Bacsai 2026-03-12 14:19:53 +01:00
parent 0991f8e2ca
commit aac34f1d14
4 changed files with 1 additions and 22 deletions

View file

@ -2133,7 +2133,7 @@ private function check_git_if_build_needed()
executeInDocker($this->deployment_uuid, 'chmod 600 /root/.ssh/id_rsa'), executeInDocker($this->deployment_uuid, 'chmod 600 /root/.ssh/id_rsa'),
], ],
[ [
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$lsRemoteRef}"), executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git ls-remote {$this->fullRepoUrl} {$lsRemoteRef}"),
'hidden' => true, 'hidden' => true,
'save' => 'git_commit_sha', 'save' => 'git_commit_sha',
] ]

View file

@ -57,16 +57,6 @@ class GithubPrivateRepositoryDeployKey extends Component
private ?string $git_repository = null; private ?string $git_repository = null;
protected $rules = [
'repository_url' => ['required', 'string'],
'branch' => ['required', 'string'],
'port' => 'required|numeric',
'is_static' => 'required|boolean',
'publish_directory' => 'nullable|string',
'build_pack' => 'required|string',
'docker_compose_location' => \App\Support\ValidationPatterns::filePathRules(),
];
protected function rules() protected function rules()
{ {
return [ return [

View file

@ -63,16 +63,6 @@ class PublicGitRepository extends Component
public bool $new_compose_services = false; public bool $new_compose_services = false;
protected $rules = [
'repository_url' => ['required', 'string'],
'port' => 'required|numeric',
'isStatic' => 'required|boolean',
'publish_directory' => 'nullable|string',
'build_pack' => 'required|string',
'base_directory' => 'nullable|string',
'docker_compose_location' => \App\Support\ValidationPatterns::filePathRules(),
];
protected function rules() protected function rules()
{ {
return [ return [

View file

@ -169,7 +169,6 @@
expect($validator->fails())->toBeFalse(); expect($validator->fails())->toBeFalse();
}); });
});
test('dockerfile_location validation allows paths with @ for scoped packages', function () { test('dockerfile_location validation allows paths with @ for scoped packages', function () {
$rules = sharedDataApplications(); $rules = sharedDataApplications();