fix: public repo branch selection

fix: commit sha selection in source tabs
This commit is contained in:
Andras Bacsai 2023-10-01 12:29:50 +02:00
parent bcffbe418b
commit e4296345b3
2 changed files with 7 additions and 9 deletions

View File

@ -26,6 +26,10 @@ class PublicGitRepository extends Component
public string $git_branch = 'main'; public string $git_branch = 'main';
public int $rate_limit_remaining = 0; public int $rate_limit_remaining = 0;
public $rate_limit_reset = 0; public $rate_limit_reset = 0;
private object $repository_url_parsed;
public GithubApp|GitlabApp|null $git_source = null;
public string $git_host;
public string $git_repository;
protected $rules = [ protected $rules = [
'repository_url' => 'required|url', 'repository_url' => 'required|url',
'port' => 'required|numeric', 'port' => 'required|numeric',
@ -38,10 +42,6 @@ class PublicGitRepository extends Component
'is_static' => 'static', 'is_static' => 'static',
'publish_directory' => 'publish directory', 'publish_directory' => 'publish directory',
]; ];
private object $repository_url_parsed;
private GithubApp|GitlabApp|null $git_source = null;
private string $git_host;
private string $git_repository;
public function mount() public function mount()
{ {
@ -76,6 +76,7 @@ public function load_branch()
$this->get_branch(); $this->get_branch();
$this->selected_branch = $this->git_branch; $this->selected_branch = $this->git_branch;
} catch (\Throwable $e) { } catch (\Throwable $e) {
ray($e->getMessage());
if (!$this->branch_found && $this->git_branch == 'main') { if (!$this->branch_found && $this->git_branch == 'main') {
try { try {
$this->git_branch = 'master'; $this->git_branch = 'master';
@ -123,9 +124,6 @@ public function submit()
$project_uuid = $this->parameters['project_uuid']; $project_uuid = $this->parameters['project_uuid'];
$environment_name = $this->parameters['environment_name']; $environment_name = $this->parameters['environment_name'];
$this->get_git_source();
$this->git_branch = $this->selected_branch ?? $this->git_branch;
$destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); $destination = StandaloneDocker::where('uuid', $destination_uuid)->first();
if (!$destination) { if (!$destination) {
$destination = SwarmDocker::where('uuid', $destination_uuid)->first(); $destination = SwarmDocker::where('uuid', $destination_uuid)->first();

View File

@ -167,7 +167,6 @@ public function handle(): void
"hidden" => true, "hidden" => true,
] ]
); );
$this->next(ApplicationDeploymentStatus::FAILED->value);
} }
} }
private function deploy_docker_compose() private function deploy_docker_compose()
@ -402,7 +401,7 @@ private function clone_repository()
{ {
$this->execute_remote_command( $this->execute_remote_command(
[ [
"echo -n 'Importing {$this->application->git_repository}:{$this->application->git_branch} to {$this->workdir}. '" "echo -n 'Importing {$this->application->git_repository}:{$this->application->git_branch} (commit sha {$this->application->git_commit_sha}) to {$this->workdir}. '"
], ],
[ [
$this->importing_git_repository() $this->importing_git_repository()
@ -799,5 +798,6 @@ public function failed(Throwable $exception): void
["echo 'Oops something is not okay, are you okay? 😢'"], ["echo 'Oops something is not okay, are you okay? 😢'"],
["echo '{$exception->getMessage()}'"] ["echo '{$exception->getMessage()}'"]
); );
$this->next(ApplicationDeploymentStatus::FAILED->value);
} }
} }