Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed May 30, 2023
1 parent 726d46c commit ca77738
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions app/Http/Livewire/Project/Application/Previews.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ public function deploy(int $pull_request_id)
{
try {
$this->set_deployment_uuid();
ApplicationPreview::create([
'application_id' => $this->application->id,
'pull_request_id' => $pull_request_id,
]);
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
if (!$found) {
ApplicationPreview::create([
'application_id' => $this->application->id,
'pull_request_id' => $pull_request_id,
]);
}
queue_application_deployment(
application_id: $this->application->id,
deployment_uuid: $this->deployment_uuid,
Expand Down
6 changes: 3 additions & 3 deletions app/Jobs/ApplicationDeploymentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ private function build_image()
}
private function deploy_pull_request()
{
$this->build_image_name = "{$this->application->uuid}:pr_{$this->pull_request_id}-build";
$this->production_image_name = "{$this->application->uuid}:pr_{$this->pull_request_id}";
$this->build_image_name = "{$this->application->uuid}:pr-{$this->pull_request_id}-build";
$this->production_image_name = "{$this->application->uuid}:pr-{$this->pull_request_id}";
$this->container_name = generate_container_name($this->application->uuid, $this->pull_request_id);
// Deploy pull request
$this->execute_now([
Expand Down Expand Up @@ -577,7 +577,7 @@ private function importing_git_repository()
{
$git_clone_command = "git clone -q -b {$this->application->git_branch}";
if ($this->pull_request_id) {
$pr_branch_name = "pr_{$this->pull_request_id}_coolify";
$pr_branch_name = "pr-{$this->pull_request_id}-coolify";
}

if ($this->application->deploymentType() === 'source') {
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/helpers/docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function get_container_status(Server $server, string $container_id, bool $throwE
function generate_container_name(string $uuid, int|null $pull_request_id = null)
{
if ($pull_request_id) {
return $uuid . '_pr_' . $pull_request_id;
return $uuid . '-pr-' . $pull_request_id;
} else {
return $uuid;
}
Expand Down

0 comments on commit ca77738

Please sign in to comment.