commit
3137131a1a
@ -72,6 +72,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
||||
private bool $is_debug_enabled;
|
||||
private $build_args;
|
||||
private $env_args;
|
||||
private $env_nixpacks_args;
|
||||
private $docker_compose;
|
||||
private $docker_compose_base64;
|
||||
private ?string $nixpacks_plan = null;
|
||||
@ -692,7 +693,8 @@ private function health_check()
|
||||
[
|
||||
"docker inspect --format='{{json .State.Health.Status}}' {$this->container_name}",
|
||||
"hidden" => true,
|
||||
"save" => "health_check"
|
||||
"save" => "health_check",
|
||||
"append" => false
|
||||
],
|
||||
|
||||
);
|
||||
@ -854,7 +856,6 @@ private function check_git_if_build_needed()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->saved_outputs->get('git_commit_sha')) {
|
||||
$this->commit = $this->saved_outputs->get('git_commit_sha')->before("\t");
|
||||
}
|
||||
@ -910,9 +911,10 @@ private function generate_nixpacks_confs()
|
||||
if ($this->nixpacks_plan) {
|
||||
$parsed = Toml::Parse($this->nixpacks_plan);
|
||||
// Do any modifications here
|
||||
$cmds = collect(data_get($parsed, 'phases.setup.cmds', []));
|
||||
// $cmds = collect(data_get($parsed, 'phases.setup.cmds', []));
|
||||
$this->generate_env_variables();
|
||||
data_set($parsed, 'phases.setup.cmds', $cmds);
|
||||
// data_set($parsed, 'phases.setup.cmds', $cmds);
|
||||
ray($this->env_args->toArray());
|
||||
$merged_envs = $this->env_args->merge(collect(data_get($parsed, 'variables', [])));
|
||||
data_set($parsed, 'variables', $merged_envs->toArray());
|
||||
$this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT);
|
||||
@ -922,7 +924,8 @@ private function generate_nixpacks_confs()
|
||||
|
||||
private function nixpacks_build_cmd()
|
||||
{
|
||||
$nixpacks_command = "nixpacks plan -f toml";
|
||||
$this->generate_nixpacks_env_variables();
|
||||
$nixpacks_command = "nixpacks plan -f toml {$this->env_nixpacks_args}";
|
||||
if ($this->application->build_command) {
|
||||
$nixpacks_command .= " --build-cmd \"{$this->application->build_command}\"";
|
||||
}
|
||||
@ -935,26 +938,33 @@ private function nixpacks_build_cmd()
|
||||
$nixpacks_command .= " {$this->workdir}";
|
||||
return $nixpacks_command;
|
||||
}
|
||||
private function generate_nixpacks_env_variables()
|
||||
{
|
||||
$this->env_nixpacks_args = collect([]);
|
||||
if ($this->pull_request_id === 0) {
|
||||
foreach ($this->application->nixpacks_environment_variables as $env) {
|
||||
$this->env_nixpacks_args->push("--env {$env->key}={$env->value}");
|
||||
}
|
||||
} else {
|
||||
foreach ($this->application->nixpacks_environment_variables_preview as $env) {
|
||||
$this->env_nixpacks_args->push("--env {$env->key}={$env->value}");
|
||||
}
|
||||
}
|
||||
|
||||
$this->env_nixpacks_args = $this->env_nixpacks_args->implode(' ');
|
||||
}
|
||||
private function generate_env_variables()
|
||||
{
|
||||
$this->env_args = collect([]);
|
||||
if ($this->pull_request_id === 0) {
|
||||
foreach ($this->application->nixpacks_environment_variables as $env) {
|
||||
$this->env_args->put($env->key, $env->value);
|
||||
}
|
||||
foreach ($this->application->build_environment_variables as $env) {
|
||||
$this->env_args->put($env->key, $env->value);
|
||||
}
|
||||
} else {
|
||||
foreach ($this->application->nixpacks_environment_variables_preview as $env) {
|
||||
$this->env_args->put($env->key, $env->value);
|
||||
}
|
||||
foreach ($this->application->build_environment_variables_preview as $env) {
|
||||
$this->env_args->put($env->key, $env->value);
|
||||
}
|
||||
}
|
||||
// $this->env_args = $this->env_args->implode(' ');
|
||||
}
|
||||
|
||||
private function generate_compose_file()
|
||||
|
@ -32,10 +32,11 @@ public function execute_remote_command(...$commands)
|
||||
$hidden = data_get($single_command, 'hidden', false);
|
||||
$customType = data_get($single_command, 'type');
|
||||
$ignore_errors = data_get($single_command, 'ignore_errors', false);
|
||||
$append = data_get($single_command, 'append', true);
|
||||
$this->save = data_get($single_command, 'save');
|
||||
|
||||
$remote_command = generateSshCommand($this->server, $command);
|
||||
$process = Process::timeout(3600)->idleTimeout(3600)->start($remote_command, function (string $type, string $output) use ($command, $hidden, $customType) {
|
||||
$process = Process::timeout(3600)->idleTimeout(3600)->start($remote_command, function (string $type, string $output) use ($command, $hidden, $customType, $append) {
|
||||
$output = Str::of($output)->trim();
|
||||
if ($output->startsWith('╔')) {
|
||||
$output = "\n" . $output;
|
||||
@ -59,7 +60,15 @@ public function execute_remote_command(...$commands)
|
||||
$this->application_deployment_queue->save();
|
||||
|
||||
if ($this->save) {
|
||||
$this->saved_outputs[$this->save] = Str::of($output)->trim();
|
||||
if (data_get($this->saved_outputs, $this->save, null) === null) {
|
||||
data_set($this->saved_outputs, $this->save, str());
|
||||
}
|
||||
if ($append) {
|
||||
$this->saved_outputs[$this->save] .= str($output)->trim();
|
||||
$this->saved_outputs[$this->save] = str($this->saved_outputs[$this->save]);
|
||||
} else {
|
||||
$this->saved_outputs[$this->save] = str($output)->trim();
|
||||
}
|
||||
}
|
||||
});
|
||||
$this->application_deployment_queue->update([
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// The release version of your application
|
||||
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
||||
'release' => '4.0.0-beta.186',
|
||||
'release' => '4.0.0-beta.187',
|
||||
// When left empty or `null` the Laravel environment will be used
|
||||
'environment' => config('app.env'),
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
|
||||
return '4.0.0-beta.186';
|
||||
return '4.0.0-beta.187';
|
||||
|
@ -4,7 +4,7 @@
|
||||
"version": "3.12.36"
|
||||
},
|
||||
"v4": {
|
||||
"version": "4.0.0-beta.186"
|
||||
"version": "4.0.0-beta.187"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user