Merge pull request #6964 from coollabsio/andrasbacsai/healthcheck-removal-bug
Fix healthcheck reset when removed from Dockerfile
This commit is contained in:
commit
cb5462abfd
1 changed files with 11 additions and 1 deletions
|
|
@ -1804,7 +1804,9 @@ public function getFilesFromServer(bool $isInit = false)
|
||||||
public function parseHealthcheckFromDockerfile($dockerfile, bool $isInit = false)
|
public function parseHealthcheckFromDockerfile($dockerfile, bool $isInit = false)
|
||||||
{
|
{
|
||||||
$dockerfile = str($dockerfile)->trim()->explode("\n");
|
$dockerfile = str($dockerfile)->trim()->explode("\n");
|
||||||
if (str($dockerfile)->contains('HEALTHCHECK') && ($this->isHealthcheckDisabled() || $isInit)) {
|
$hasHealthcheck = str($dockerfile)->contains('HEALTHCHECK');
|
||||||
|
|
||||||
|
if ($hasHealthcheck && ($this->isHealthcheckDisabled() || $isInit)) {
|
||||||
$healthcheckCommand = null;
|
$healthcheckCommand = null;
|
||||||
$lines = $dockerfile->toArray();
|
$lines = $dockerfile->toArray();
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
|
|
@ -1845,6 +1847,14 @@ public function parseHealthcheckFromDockerfile($dockerfile, bool $isInit = false
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif (! $hasHealthcheck && $this->custom_healthcheck_found) {
|
||||||
|
// HEALTHCHECK was removed from Dockerfile, reset to defaults
|
||||||
|
$this->custom_healthcheck_found = false;
|
||||||
|
$this->health_check_interval = 5;
|
||||||
|
$this->health_check_timeout = 5;
|
||||||
|
$this->health_check_retries = 10;
|
||||||
|
$this->health_check_start_period = 5;
|
||||||
|
$this->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue