wip
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Jobs\ApplicationDeploymentJob;
|
||||
use App\Jobs\ApplicationDeploymentJobNew;
|
||||
use App\Models\Application;
|
||||
use App\Models\ApplicationDeploymentQueue;
|
||||
|
||||
@@ -28,15 +27,7 @@ function queue_application_deployment(int $application_id, string $deployment_uu
|
||||
if ($running_deployments->count() > 0) {
|
||||
return;
|
||||
}
|
||||
// dispatch(new ApplicationDeploymentJob(
|
||||
// application_deployment_queue_id: $deployment->id,
|
||||
// application_id: $application_id,
|
||||
// deployment_uuid: $deployment_uuid,
|
||||
// force_rebuild: $force_rebuild,
|
||||
// rollback_commit: $commit,
|
||||
// pull_request_id: $pull_request_id,
|
||||
// ))->onConnection('long-running')->onQueue('long-running');
|
||||
dispatch(new ApplicationDeploymentJobNew(
|
||||
dispatch(new ApplicationDeploymentJob(
|
||||
application_deployment_queue_id: $deployment->id,
|
||||
))->onConnection('long-running')->onQueue('long-running');
|
||||
}
|
||||
@@ -47,10 +38,6 @@ function queue_next_deployment(Application $application)
|
||||
if ($next_found) {
|
||||
dispatch(new ApplicationDeploymentJob(
|
||||
application_deployment_queue_id: $next_found->id,
|
||||
application_id: $next_found->application_id,
|
||||
deployment_uuid: $next_found->deployment_uuid,
|
||||
force_rebuild: $next_found->force_rebuild,
|
||||
pull_request_id: $next_found->pull_request_id
|
||||
))->onConnection('long-running')->onQueue('long-running');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ function get_container_status(Server $server, string $container_id, bool $all_da
|
||||
return $container[0]['State']['Status'];
|
||||
}
|
||||
|
||||
function generate_container_name(string $uuid, int|null $pull_request_id = null)
|
||||
function generate_container_name(string $uuid, int $pull_request_id = 0)
|
||||
{
|
||||
if ($pull_request_id) {
|
||||
if ($pull_request_id !== 0) {
|
||||
return $uuid . '-pr-' . $pull_request_id;
|
||||
} else {
|
||||
return $uuid;
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
use App\Actions\CoolifyTask\PrepareCoolifyTask;
|
||||
use App\Data\CoolifyTaskArgs;
|
||||
use App\Enums\ActivityTypes;
|
||||
use App\Enums\ApplicationDeploymentStatus;
|
||||
use App\Jobs\ApplicationDeploymentJobNew;
|
||||
use App\Models\Application;
|
||||
use App\Models\ApplicationDeploymentQueue;
|
||||
use App\Models\InstanceSettings;
|
||||
use App\Models\Server;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -28,13 +25,16 @@ function remote_process(
|
||||
string $type = ActivityTypes::INLINE->value,
|
||||
?string $type_uuid = null,
|
||||
?Model $model = null,
|
||||
bool $ignore_errors = false
|
||||
bool $ignore_errors = false,
|
||||
): Activity {
|
||||
|
||||
$command_string = implode("\n", $command);
|
||||
|
||||
// @TODO: Check if the user has access to this server
|
||||
// checkTeam($server->team_id);
|
||||
if (auth()->user()) {
|
||||
$teams = auth()->user()->teams->pluck('id');
|
||||
if (!$teams->contains($server->team_id) && !$teams->contains(0)) {
|
||||
throw new \Exception("User is not part of the team that owns this server");
|
||||
}
|
||||
}
|
||||
|
||||
$private_key_location = save_private_key_for_server($server);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user