pull request webhooks
This commit is contained in:
@@ -24,12 +24,12 @@ class General extends Component
|
||||
public string|null $global_wildcard_domain = null;
|
||||
|
||||
public bool $is_static;
|
||||
public bool $is_git_submodules_allowed;
|
||||
public bool $is_git_lfs_allowed;
|
||||
public bool $is_debug;
|
||||
public bool $is_previews;
|
||||
public bool $is_auto_deploy;
|
||||
public bool $is_force_https;
|
||||
public bool $is_git_submodules_enabled;
|
||||
public bool $is_git_lfs_enabled;
|
||||
public bool $is_debug_enabled;
|
||||
public bool $is_preview_deployments_enabled;
|
||||
public bool $is_auto_deploy_enabled;
|
||||
public bool $is_force_https_enabled;
|
||||
|
||||
protected $rules = [
|
||||
'application.name' => 'required|min:6',
|
||||
@@ -51,12 +51,12 @@ class General extends Component
|
||||
{
|
||||
// @TODO: find another way - if possible
|
||||
$this->application->settings->is_static = $this->is_static;
|
||||
$this->application->settings->is_git_submodules_allowed = $this->is_git_submodules_allowed;
|
||||
$this->application->settings->is_git_lfs_allowed = $this->is_git_lfs_allowed;
|
||||
$this->application->settings->is_debug = $this->is_debug;
|
||||
$this->application->settings->is_previews = $this->is_previews;
|
||||
$this->application->settings->is_auto_deploy = $this->is_auto_deploy;
|
||||
$this->application->settings->is_force_https = $this->is_force_https;
|
||||
$this->application->settings->is_git_submodules_enabled = $this->is_git_submodules_enabled;
|
||||
$this->application->settings->is_git_lfs_enabled = $this->is_git_lfs_enabled;
|
||||
$this->application->settings->is_debug_enabled = $this->is_debug_enabled;
|
||||
$this->application->settings->is_preview_deployments_enabled = $this->is_preview_deployments_enabled;
|
||||
$this->application->settings->is_auto_deploy_enabled = $this->is_auto_deploy_enabled;
|
||||
$this->application->settings->is_force_https_enabled = $this->is_force_https_enabled;
|
||||
$this->application->settings->save();
|
||||
$this->application->refresh();
|
||||
$this->emit('saved', 'Application settings updated!');
|
||||
@@ -72,12 +72,12 @@ class General extends Component
|
||||
public function mount()
|
||||
{
|
||||
$this->is_static = $this->application->settings->is_static;
|
||||
$this->is_git_submodules_allowed = $this->application->settings->is_git_submodules_allowed;
|
||||
$this->is_git_lfs_allowed = $this->application->settings->is_git_lfs_allowed;
|
||||
$this->is_debug = $this->application->settings->is_debug;
|
||||
$this->is_previews = $this->application->settings->is_previews;
|
||||
$this->is_auto_deploy = $this->application->settings->is_auto_deploy;
|
||||
$this->is_force_https = $this->application->settings->is_force_https;
|
||||
$this->is_git_submodules_enabled = $this->application->settings->is_git_submodules_enabled;
|
||||
$this->is_git_lfs_enabled = $this->application->settings->is_git_lfs_enabled;
|
||||
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
||||
$this->is_preview_deployments_enabled = $this->application->settings->is_preview_deployments_enabled;
|
||||
$this->is_auto_deploy_enabled = $this->application->settings->is_auto_deploy_enabled;
|
||||
$this->is_force_https_enabled = $this->application->settings->is_force_https_enabled;
|
||||
$this->checkWildCardDomain();
|
||||
}
|
||||
public function generateGlobalRandomDomain()
|
||||
|
||||
@@ -75,10 +75,7 @@ class Previews extends Component
|
||||
ray('Stopping container: ' . $container_name);
|
||||
|
||||
instant_remote_process(["docker rm -f $container_name"], $this->application->destination->server, throwError: false);
|
||||
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||
if ($found) {
|
||||
$found->delete();
|
||||
}
|
||||
ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->delete();
|
||||
$this->application->refresh();
|
||||
} catch (\Throwable $th) {
|
||||
return general_error_handler($th, $this);
|
||||
|
||||
@@ -501,7 +501,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
||||
// Set labels for http (redirect to https)
|
||||
$labels[] = "traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
||||
$labels[] = "traefik.http.routers.{$http_label}.entryPoints=http";
|
||||
if ($this->application->settings->is_force_https) {
|
||||
if ($this->application->settings->is_force_https_enabled) {
|
||||
$labels[] = "traefik.http.routers.{$http_label}.middlewares=redirect-to-https";
|
||||
}
|
||||
} else {
|
||||
@@ -539,7 +539,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
||||
'command' => $commandText,
|
||||
]);
|
||||
$this->activity->save();
|
||||
if ($isDebuggable && !$this->application->settings->is_debug) {
|
||||
if ($isDebuggable && !$this->application->settings->is_debug_enabled) {
|
||||
$hideFromOutput = true;
|
||||
}
|
||||
$remote_process = resolve(RunRemoteProcess::class, [
|
||||
@@ -565,10 +565,10 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
||||
if ($this->application->git_commit_sha !== 'HEAD') {
|
||||
$git_clone_command = "{$git_clone_command} && cd {$this->workdir} && git -c advice.detachedHead=false checkout {$this->application->git_commit_sha} >/dev/null 2>&1";
|
||||
}
|
||||
if ($this->application->settings->is_git_submodules_allowed) {
|
||||
if ($this->application->settings->is_git_submodules_enabled) {
|
||||
$git_clone_command = "{$git_clone_command} && cd {$this->workdir} && git submodule update --init --recursive";
|
||||
}
|
||||
if ($this->application->settings->is_git_lfs_allowed) {
|
||||
if ($this->application->settings->is_git_lfs_enabled) {
|
||||
$git_clone_command = "{$git_clone_command} && cd {$this->workdir} && git lfs pull";
|
||||
}
|
||||
return $git_clone_command;
|
||||
|
||||
@@ -154,7 +154,14 @@ class Application extends BaseModel
|
||||
}
|
||||
public function isDeployable(): bool
|
||||
{
|
||||
if ($this->settings->is_auto_deploy) {
|
||||
if ($this->settings->is_auto_deploy_enabled) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public function isPRDeployable(): bool
|
||||
{
|
||||
if ($this->settings->is_preview_deployments_enabled) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -15,5 +15,6 @@ class ApplicationDeploymentQueue extends Model
|
||||
'force_rebuild',
|
||||
'commit',
|
||||
'status',
|
||||
'is_webhook',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -7,10 +7,24 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ApplicationSetting extends Model
|
||||
{
|
||||
protected $cast = [
|
||||
'is_static' => 'boolean',
|
||||
'is_auto_deploy_enabled' => 'boolean',
|
||||
'is_force_https_enabled' => 'boolean',
|
||||
'is_debug_enabled' => 'boolean',
|
||||
'is_preview_deployments_enabled' => 'boolean',
|
||||
'is_git_submodules_enabled' => 'boolean',
|
||||
'is_git_lfs_enabled' => 'boolean',
|
||||
];
|
||||
protected $fillable = [
|
||||
'application_id',
|
||||
'is_git_submodules_allowed',
|
||||
'is_git_lfs_allowed',
|
||||
'is_static',
|
||||
'is_auto_deploy_enabled',
|
||||
'is_force_https_enabled',
|
||||
'is_debug_enabled',
|
||||
'is_preview_deployments_enabled',
|
||||
'is_git_submodules_enabled',
|
||||
'is_git_lfs_enabled',
|
||||
];
|
||||
public function isStatic(): Attribute
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user