@@ -95,7 +95,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
95
95
private ?string $ buildTarget = null ;
96
96
private Collection $ saved_outputs ;
97
97
private ?string $ full_healthcheck_url = null ;
98
- private bool $ custom_healthcheck_found = false ;
99
98
100
99
private string $ serverUser = 'root ' ;
101
100
private string $ serverUserHomeDir = '/root ' ;
@@ -903,10 +902,13 @@ private function health_check()
903
902
if ($ this ->server ->isSwarm ()) {
904
903
// Implement healthcheck for swarm
905
904
} else {
906
- if ($ this ->application ->isHealthcheckDisabled () && $ this ->custom_healthcheck_found === false ) {
905
+ if ($ this ->application ->isHealthcheckDisabled () && $ this ->application -> custom_healthcheck_found === false ) {
907
906
$ this ->newVersionIsHealthy = true ;
908
907
return ;
909
908
}
909
+ if ($ this ->application ->custom_healthcheck_found ) {
910
+ $ this ->application_deployment_queue ->addLogEntry ("Custom healthcheck found, skipping default healthcheck. " );
911
+ }
910
912
// ray('New container name: ', $this->container_name);
911
913
if ($ this ->container_name ) {
912
914
$ counter = 1 ;
@@ -1272,16 +1274,14 @@ private function generate_compose_file()
1272
1274
return escapeDollarSign ($ value );
1273
1275
});
1274
1276
$ labels = $ labels ->merge (defaultLabels ($ this ->application ->id , $ this ->application ->uuid , $ this ->pull_request_id ))->toArray ();
1277
+
1275
1278
// Check for custom HEALTHCHECK
1276
- $ this ->custom_healthcheck_found = false ;
1277
1279
if ($ this ->application ->build_pack === 'dockerfile ' || $ this ->application ->dockerfile ) {
1278
1280
$ this ->execute_remote_command ([
1279
1281
executeInDocker ($ this ->deployment_uuid , "cat {$ this ->workdir }{$ this ->dockerfile_location }" ), "hidden " => true , "save " => 'dockerfile_from_repo ' , "ignore_errors " => true
1280
1282
]);
1281
1283
$ dockerfile = collect (Str::of ($ this ->saved_outputs ->get ('dockerfile_from_repo ' ))->trim ()->explode ("\n" ));
1282
- if (str ($ dockerfile )->contains ('HEALTHCHECK ' )) {
1283
- $ this ->custom_healthcheck_found = true ;
1284
- }
1284
+ $ this ->application ->parseHealthcheckFromDockerfile ($ dockerfile );
1285
1285
}
1286
1286
$ docker_compose = [
1287
1287
'version ' => '3.8 ' ,
@@ -1327,18 +1327,17 @@ private function generate_compose_file()
1327
1327
if (!is_null ($ this ->env_filename )) {
1328
1328
$ docker_compose ['services ' ][$ this ->container_name ]['env_file ' ] = [$ this ->env_filename ];
1329
1329
}
1330
- if (!$ this ->custom_healthcheck_found ) {
1331
- $ docker_compose ['services ' ][$ this ->container_name ]['healthcheck ' ] = [
1332
- 'test ' => [
1333
- 'CMD-SHELL ' ,
1334
- $ this ->generate_healthcheck_commands ()
1335
- ],
1336
- 'interval ' => $ this ->application ->health_check_interval . 's ' ,
1337
- 'timeout ' => $ this ->application ->health_check_timeout . 's ' ,
1338
- 'retries ' => $ this ->application ->health_check_retries ,
1339
- 'start_period ' => $ this ->application ->health_check_start_period . 's '
1340
- ];
1341
- }
1330
+ $ docker_compose ['services ' ][$ this ->container_name ]['healthcheck ' ] = [
1331
+ 'test ' => [
1332
+ 'CMD-SHELL ' ,
1333
+ $ this ->generate_healthcheck_commands ()
1334
+ ],
1335
+ 'interval ' => $ this ->application ->health_check_interval . 's ' ,
1336
+ 'timeout ' => $ this ->application ->health_check_timeout . 's ' ,
1337
+ 'retries ' => $ this ->application ->health_check_retries ,
1338
+ 'start_period ' => $ this ->application ->health_check_start_period . 's '
1339
+ ];
1340
+
1342
1341
if (!is_null ($ this ->application ->limits_cpuset )) {
1343
1342
data_set ($ docker_compose , 'services. ' . $ this ->container_name . '.cpuset ' , $ this ->application ->limits_cpuset );
1344
1343
}
0 commit comments