feat(core): You can validate compose files with docker compose config
fix(core): labels are now accepted with both compose styles refactor: remove lots of ray's
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
//use Livewire\Component;
|
||||
// use Livewire\Component;
|
||||
use Illuminate\View\Component;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
|
||||
@@ -52,12 +52,6 @@ class DockerCompose extends Component
|
||||
'dockerComposeRaw' => 'required',
|
||||
]);
|
||||
$this->dockerComposeRaw = Yaml::dump(Yaml::parse($this->dockerComposeRaw), 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);
|
||||
|
||||
$isValid = validateComposeFile($this->dockerComposeRaw, $server_id);
|
||||
if ($isValid !== 'OK') {
|
||||
return $this->dispatch('error', "Invalid docker-compose file.\n$isValid");
|
||||
}
|
||||
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $this->parameters['environment_uuid'])->first();
|
||||
|
||||
|
||||
@@ -39,6 +39,16 @@ class EditCompose extends Component
|
||||
$this->service = Service::find($this->serviceId);
|
||||
}
|
||||
|
||||
public function validateCompose()
|
||||
{
|
||||
$isValid = validateComposeFile($this->service->docker_compose_raw, $this->service->server_id);
|
||||
if ($isValid !== 'OK') {
|
||||
$this->dispatch('error', "Invalid docker-compose file.\n$isValid");
|
||||
} else {
|
||||
$this->dispatch('success', 'Docker compose is valid.');
|
||||
}
|
||||
}
|
||||
|
||||
public function saveEditedCompose()
|
||||
{
|
||||
$this->dispatch('info', 'Saving new docker compose...');
|
||||
|
||||
@@ -63,7 +63,7 @@ class StackForm extends Component
|
||||
public function saveCompose($raw)
|
||||
{
|
||||
$this->service->docker_compose_raw = $raw;
|
||||
$this->submit(notify: false);
|
||||
$this->submit(notify: true);
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
@@ -76,10 +76,6 @@ class StackForm extends Component
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
$isValid = validateComposeFile($this->service->docker_compose_raw, $this->service->server->id);
|
||||
if ($isValid !== 'OK') {
|
||||
throw new \Exception("Invalid docker-compose file.\n$isValid");
|
||||
}
|
||||
$this->service->save();
|
||||
$this->service->saveExtraFields($this->fields);
|
||||
$this->service->parse();
|
||||
|
||||
@@ -29,8 +29,6 @@ class Webhooks extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
// ray()->clearAll();
|
||||
// ray()->showQueries();
|
||||
$this->deploywebhook = generateDeployWebhook($this->resource);
|
||||
|
||||
$this->githubManualWebhookSecret = data_get($this->resource, 'manual_webhook_secret_github');
|
||||
|
||||
@@ -105,7 +105,6 @@ class Deploy extends Component
|
||||
|
||||
$startTime = Carbon::now()->getTimestamp();
|
||||
while ($process->running()) {
|
||||
ray('running');
|
||||
if (Carbon::now()->getTimestamp() - $startTime >= $timeout) {
|
||||
$this->forceStopContainer($containerName);
|
||||
break;
|
||||
|
||||
@@ -101,7 +101,6 @@ class Change extends Component
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// ray($runners_by_repository);
|
||||
// }
|
||||
|
||||
public function mount()
|
||||
|
||||
Reference in New Issue
Block a user