rename parser functions
This commit is contained in:
@@ -451,11 +451,11 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->cleanup_git();
|
$this->cleanup_git();
|
||||||
$this->application->loadComposeFile(isInit: false);
|
$this->application->loadComposeFile(isInit: false);
|
||||||
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
||||||
$this->application->parseRawCompose();
|
$this->application->oldRawParser();
|
||||||
$yaml = $composeFile = $this->application->docker_compose_raw;
|
$yaml = $composeFile = $this->application->docker_compose_raw;
|
||||||
$this->save_environment_variables();
|
$this->save_environment_variables();
|
||||||
} else {
|
} else {
|
||||||
$composeFile = $this->application->parseCompose(pull_request_id: $this->pull_request_id, preview_id: data_get($this->preview, 'id'));
|
$composeFile = $this->application->oldParser(pull_request_id: $this->pull_request_id, preview_id: data_get($this->preview, 'id'));
|
||||||
$this->save_environment_variables();
|
$this->save_environment_variables();
|
||||||
if (! is_null($this->env_filename)) {
|
if (! is_null($this->env_filename)) {
|
||||||
$services = collect($composeFile['services']);
|
$services = collect($composeFile['services']);
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ class Advanced extends Component
|
|||||||
$this->dispatch('resetDefaultLabels', false);
|
$this->dispatch('resetDefaultLabels', false);
|
||||||
}
|
}
|
||||||
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
||||||
$this->application->parseRawCompose();
|
$this->application->oldRawParser();
|
||||||
} else {
|
} else {
|
||||||
$this->application->parseCompose();
|
$this->application->oldParser();
|
||||||
}
|
}
|
||||||
$this->application->settings->save();
|
$this->application->settings->save();
|
||||||
$this->dispatch('success', 'Settings saved.');
|
$this->dispatch('success', 'Settings saved.');
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class General extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->parsedServices = $this->application->parseCompose();
|
$this->parsedServices = $this->application->oldParser();
|
||||||
if (is_null($this->parsedServices) || empty($this->parsedServices)) {
|
if (is_null($this->parsedServices) || empty($this->parsedServices)) {
|
||||||
$this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.');
|
$this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.');
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ class General extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->application->parseCompose();
|
$this->application->oldParser();
|
||||||
$this->dispatch('success', 'Docker compose file loaded.');
|
$this->dispatch('success', 'Docker compose file loaded.');
|
||||||
$this->dispatch('compose_loaded');
|
$this->dispatch('compose_loaded');
|
||||||
$this->dispatch('refreshStorages');
|
$this->dispatch('refreshStorages');
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class All extends Component
|
|||||||
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
||||||
} elseif ($this->resource->type() == 'application') {
|
} elseif ($this->resource->type() == 'application') {
|
||||||
if ($this->resource->build_pack === 'dockercompose') {
|
if ($this->resource->build_pack === 'dockercompose') {
|
||||||
$parsed = $this->resource->parseCompose();
|
$parsed = $this->resource->oldParser();
|
||||||
$containers = collect(data_get($parsed, 'services'))->keys();
|
$containers = collect(data_get($parsed, 'services'))->keys();
|
||||||
$this->containerNames = $containers;
|
$this->containerNames = $containers;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1025,7 +1025,7 @@ class Application extends BaseModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseRawCompose()
|
public function oldRawParser()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$yaml = Yaml::parse($this->docker_compose_raw);
|
$yaml = Yaml::parse($this->docker_compose_raw);
|
||||||
@@ -1085,7 +1085,7 @@ class Application extends BaseModel
|
|||||||
instant_remote_process($commands, $this->destination->server, false);
|
instant_remote_process($commands, $this->destination->server, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dockerComposeParser(int $pull_request_id = 0, ?int $preview_id = null)
|
public function newParser(int $pull_request_id = 0, ?int $preview_id = null)
|
||||||
{
|
{
|
||||||
$pullRequestId = $pull_request_id;
|
$pullRequestId = $pull_request_id;
|
||||||
$isPullRequest = $pullRequestId == 0 ? false : true;
|
$isPullRequest = $pullRequestId == 0 ? false : true;
|
||||||
@@ -1624,10 +1624,10 @@ class Application extends BaseModel
|
|||||||
return $topLevel;
|
return $topLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseCompose(int $pull_request_id = 0, ?int $preview_id = null)
|
public function oldParser(int $pull_request_id = 0, ?int $preview_id = null)
|
||||||
{
|
{
|
||||||
if ($this->compose_parsing_version === '3') {
|
if ($this->compose_parsing_version === '3') {
|
||||||
return $this->dockerComposeParser($pull_request_id, $preview_id);
|
return $this->newParser($pull_request_id, $preview_id);
|
||||||
} else
|
} else
|
||||||
if ($this->docker_compose_raw) {
|
if ($this->docker_compose_raw) {
|
||||||
return parseDockerComposeFile(resource: $this, isNew: false, pull_request_id: $pull_request_id, preview_id: $preview_id);
|
return parseDockerComposeFile(resource: $this, isNew: false, pull_request_id: $pull_request_id, preview_id: $preview_id);
|
||||||
@@ -1681,7 +1681,7 @@ class Application extends BaseModel
|
|||||||
if ($composeFileContent) {
|
if ($composeFileContent) {
|
||||||
$this->docker_compose_raw = $composeFileContent;
|
$this->docker_compose_raw = $composeFileContent;
|
||||||
$this->save();
|
$this->save();
|
||||||
$parsedServices = $this->parseCompose();
|
$parsedServices = $this->oldParser();
|
||||||
if ($this->docker_compose_domains) {
|
if ($this->docker_compose_domains) {
|
||||||
$json = collect(json_decode($this->docker_compose_domains));
|
$json = collect(json_decode($this->docker_compose_domains));
|
||||||
$names = collect(data_get($parsedServices, 'services'))->keys()->toArray();
|
$names = collect(data_get($parsedServices, 'services'))->keys()->toArray();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class ApplicationPreview extends BaseModel
|
|||||||
static::deleting(function ($preview) {
|
static::deleting(function ($preview) {
|
||||||
if ($preview->application->build_pack === 'dockercompose') {
|
if ($preview->application->build_pack === 'dockercompose') {
|
||||||
$server = $preview->application->destination->server;
|
$server = $preview->application->destination->server;
|
||||||
$composeFile = $preview->application->parseCompose(pull_request_id: $preview->pull_request_id);
|
$composeFile = $preview->application->oldParser(pull_request_id: $preview->pull_request_id);
|
||||||
$volumes = data_get($composeFile, 'volumes');
|
$volumes = data_get($composeFile, 'volumes');
|
||||||
$networks = data_get($composeFile, 'networks');
|
$networks = data_get($composeFile, 'networks');
|
||||||
$networkKeys = collect($networks)->keys();
|
$networkKeys = collect($networks)->keys();
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ afterEach(function () {
|
|||||||
test('ComposeParse', function () {
|
test('ComposeParse', function () {
|
||||||
expect($this->jsonComposeFile)->toBeJson()->ray();
|
expect($this->jsonComposeFile)->toBeJson()->ray();
|
||||||
|
|
||||||
$output = $this->application->dockerComposeParser();
|
$output = $this->application->newParser();
|
||||||
$outputOld = $this->application->parseCompose();
|
$outputOld = $this->application->oldParser();
|
||||||
expect($output)->toBeInstanceOf(Collection::class);
|
expect($output)->toBeInstanceOf(Collection::class);
|
||||||
expect($outputOld)->toBeInstanceOf(Collection::class);
|
expect($outputOld)->toBeInstanceOf(Collection::class);
|
||||||
|
|
||||||
@@ -175,8 +175,8 @@ test('ComposeParsePreviewDeployment', function () {
|
|||||||
$previewId = 77;
|
$previewId = 77;
|
||||||
expect($this->jsonComposeFile)->toBeJson()->ray();
|
expect($this->jsonComposeFile)->toBeJson()->ray();
|
||||||
|
|
||||||
$output = $this->application->dockerComposeParser(pull_request_id: $pullRequestId, preview_id: $previewId);
|
$output = $this->application->newParser(pull_request_id: $pullRequestId, preview_id: $previewId);
|
||||||
$outputOld = $this->application->parseCompose();
|
$outputOld = $this->application->oldParser();
|
||||||
expect($output)->toBeInstanceOf(Collection::class);
|
expect($output)->toBeInstanceOf(Collection::class);
|
||||||
expect($outputOld)->toBeInstanceOf(Collection::class);
|
expect($outputOld)->toBeInstanceOf(Collection::class);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user