fix: .env saved to deployment server, not to build server
This commit is contained in:
parent
7c0b98bb70
commit
676c022e41
@ -24,6 +24,7 @@
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Sleep;
|
use Illuminate\Support\Sleep;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
@ -743,6 +744,7 @@ private function save_environment_variables()
|
|||||||
$envs = $envs->sort(function ($a, $b) {
|
$envs = $envs->sort(function ($a, $b) {
|
||||||
return strpos($a, '$') === false ? -1 : 1;
|
return strpos($a, '$') === false ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
Log::info("message", $envs->implode("\n"));
|
||||||
} else {
|
} else {
|
||||||
$this->env_filename = ".env";
|
$this->env_filename = ".env";
|
||||||
foreach ($this->application->environment_variables as $env) {
|
foreach ($this->application->environment_variables as $env) {
|
||||||
@ -779,6 +781,9 @@ private function save_environment_variables()
|
|||||||
|
|
||||||
if ($envs->isEmpty()) {
|
if ($envs->isEmpty()) {
|
||||||
$this->env_filename = null;
|
$this->env_filename = null;
|
||||||
|
if ($this->use_build_server) {
|
||||||
|
$this->server = $this->original_server;
|
||||||
|
}
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
"command" => "rm -f $this->configuration_dir/{$this->env_filename}",
|
"command" => "rm -f $this->configuration_dir/{$this->env_filename}",
|
||||||
@ -786,16 +791,28 @@ private function save_environment_variables()
|
|||||||
"ignore_errors" => true
|
"ignore_errors" => true
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
if ($this->use_build_server) {
|
||||||
|
$this->server = $this->build_server;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$envs_base64 = base64_encode($envs->implode("\n"));
|
$envs_base64 = base64_encode($envs->implode("\n"));
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/{$this->env_filename} > /dev/null")
|
executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/{$this->env_filename} > /dev/null")
|
||||||
],
|
],
|
||||||
|
|
||||||
|
);
|
||||||
|
if ($this->use_build_server) {
|
||||||
|
$this->server = $this->original_server;
|
||||||
|
}
|
||||||
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
"echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null"
|
"echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
if ($this->use_build_server) {
|
||||||
|
$this->server = $this->build_server;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// $this->execute_remote_command([
|
// $this->execute_remote_command([
|
||||||
// executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"),
|
// executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"),
|
||||||
|
Loading…
Reference in New Issue
Block a user