diff --git a/app/Models/Application.php b/app/Models/Application.php index 204cb96b2..d1bded126 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -511,9 +511,9 @@ class Application extends BaseModel { $newConfigHash = $this->fqdn . $this->git_repository . $this->git_branch . $this->git_commit_sha . $this->build_pack . $this->static_image . $this->install_command . $this->build_command . $this->start_command . $this->ports_exposes . $this->ports_mappings . $this->base_directory . $this->publish_directory . $this->dockerfile . $this->dockerfile_location . $this->custom_labels . $this->custom_docker_run_options . $this->dockerfile_target_build; if ($this->pull_request_id === 0 || $this->pull_request_id === null) { - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); } else { - $newConfigHash .= json_encode($this->environment_variables_preview->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables_preview->get('value')->sort()); } $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); diff --git a/app/Models/Service.php b/app/Models/Service.php index 9f0d2b67e..c15f090a9 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -14,20 +14,21 @@ class Service extends BaseModel public function isConfigurationChanged(bool $save = false) { - $domains = $this->applications()->get()->pluck('fqdn')->toArray(); + $domains = $this->applications()->get()->pluck('fqdn')->sort()->toArray(); $domains = implode(',', $domains); - $applicationImages = $this->applications()->get()->pluck('image'); - $databaseImages = $this->databases()->get()->pluck('image'); + $applicationImages = $this->applications()->get()->pluck('image')->sort(); + ray($applicationImages->toArray()); + $databaseImages = $this->databases()->get()->pluck('image')->sort(); $images = $applicationImages->merge($databaseImages); $images = implode(',', $images->toArray()); - $applicationStorages = $this->applications()->get()->pluck('persistentStorages')->flatten(); - $databaseStorages = $this->databases()->get()->pluck('persistentStorages')->flatten(); + $applicationStorages = $this->applications()->get()->pluck('persistentStorages')->flatten()->sortBy('id'); + $databaseStorages = $this->databases()->get()->pluck('persistentStorages')->flatten()->sortBy('id'); $storages = $applicationStorages->merge($databaseStorages)->implode('updated_at'); $newConfigHash = $images . $domains . $images . $storages; - $newConfigHash .= json_encode($this->environment_variables()->get('value')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneClickhouse.php b/app/Models/StandaloneClickhouse.php index a3a7cea8f..2197d51df 100644 --- a/app/Models/StandaloneClickhouse.php +++ b/app/Models/StandaloneClickhouse.php @@ -45,7 +45,7 @@ class StandaloneClickhouse extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneDragonfly.php b/app/Models/StandaloneDragonfly.php index 593b63506..d9c34d4d7 100644 --- a/app/Models/StandaloneDragonfly.php +++ b/app/Models/StandaloneDragonfly.php @@ -44,7 +44,7 @@ class StandaloneDragonfly extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneKeydb.php b/app/Models/StandaloneKeydb.php index be9e66992..1dc55228a 100644 --- a/app/Models/StandaloneKeydb.php +++ b/app/Models/StandaloneKeydb.php @@ -44,7 +44,7 @@ class StandaloneKeydb extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings . $this->keydb_conf; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.php index 4c143d9b8..5e18bbfde 100644 --- a/app/Models/StandaloneMariadb.php +++ b/app/Models/StandaloneMariadb.php @@ -46,7 +46,7 @@ class StandaloneMariadb extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings . $this->mariadb_conf; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.php index c23854376..8e4d327a3 100644 --- a/app/Models/StandaloneMongodb.php +++ b/app/Models/StandaloneMongodb.php @@ -49,7 +49,7 @@ class StandaloneMongodb extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings . $this->mongo_conf; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.php index 7885b8441..eede451d7 100644 --- a/app/Models/StandaloneMysql.php +++ b/app/Models/StandaloneMysql.php @@ -46,7 +46,7 @@ class StandaloneMysql extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings . $this->mysql_conf; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.php index b42dbdcb8..cf449a815 100644 --- a/app/Models/StandalonePostgresql.php +++ b/app/Models/StandalonePostgresql.php @@ -58,7 +58,7 @@ class StandalonePostgresql extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings . $this->postgres_initdb_args . $this->postgres_host_auth_method; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) { diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php index e6231be3c..da4701df9 100644 --- a/app/Models/StandaloneRedis.php +++ b/app/Models/StandaloneRedis.php @@ -41,7 +41,7 @@ class StandaloneRedis extends BaseModel public function isConfigurationChanged(bool $save = false) { $newConfigHash = $this->image . $this->ports_mappings . $this->redis_conf; - $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); + $newConfigHash .= json_encode($this->environment_variables()->get('value')->sort()); $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); if ($oldConfigHash === null) {