Support start_period for healthcheck in Docker Compose#475
Support start_period for healthcheck in Docker Compose#475dnephin merged 2 commits intodocker:masterfrom
Conversation
| }, | ||
| "timeout": {"type": "string"} | ||
| "timeout": {"type": "string"}, | ||
| "start_period": {"type": "string"} |
There was a problem hiding this comment.
indentation looks off. This file uses spaces not tabs.
cli/compose/types/types.go
Outdated
| Interval string | ||
| Retries *uint64 | ||
| StartPeriod string | ||
| StartPeriod string `mapstructure:"start_period"` |
There was a problem hiding this comment.
This field should be a *time.Duration not a string. I just noticed that the other fields here are wrong. We'll need to fix that.
There was a problem hiding this comment.
func convertHealthcheck(healthcheck *composetypes.HealthCheckConfig) (*container.HealthConfig, error)
will parse and convert the string into time.Duration
There was a problem hiding this comment.
It will yes, but it's an unnecessary step. The config should be of type *time.Duration. This is a mistake that was made in other fields of the HealthCheckConfig (that we need to fix), but there are other fields in the service that use *time.Duration correctly.
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
==========================================
- Coverage 48.62% 47.41% -1.21%
==========================================
Files 199 199
Lines 16396 16398 +2
==========================================
- Hits 7972 7775 -197
- Misses 8008 8228 +220
+ Partials 416 395 -21 |
68fb22c to
e94b6c7
Compare
e94b6c7 to
15d242e
Compare
Signed-off-by: Li Yi <denverdino@gmail.com>
099e73c to
0abdad6
Compare
|
Changed the type of interval, timeout and start_period of healthcheck from string to * time.Duration Thanks |
dnephin
left a comment
There was a problem hiding this comment.
thanks, just one comment
| ] | ||
| }, | ||
| "timeout": {"type": "string"} | ||
| "timeout": {"type": "string", "format": "duration"} |
There was a problem hiding this comment.
Normally we do not make any changes to previous versions of the schema. They should be frozen. Would you mind reverting this change in the previous versions?
There was a problem hiding this comment.
Do you think the change on the datatype will impact the parsing for old version?
…from string to * time.Duration Signed-off-by: Li Yi <denverdino@gmail.com>
e19ef5c to
e02fcfd
Compare
|
@dnephin Thanks for your comments, the change on the 3.0~3.3 schema is reverted |
|
I was waiting for this feature, but I think I am missing something here. start_period Additional property start_period is not allowed I checked the schema file in the 17.09 release of docker-ce and it seems correct. |
|
// edited: works with docker-compose file version 3.4 |
Signed-off-by: Li Yi denverdino@gmail.com
- What I did
The
--health-start-period durationis supported bydocker runanddocker service createsince 17.05, but it is missing in the Docker Compose.The PR adds the start_period for healthcheck to Docker Compose.
- How I did it
Adds the start_period for healthcheck to Docker Compose.
- How to verify it
Using the bellow compose file: docker-compose.yaml
docker stack deploy -c docker-compose.yaml elasticsearch
- Description for the changelog
Support start_period for healthcheck in Docker Compose
- A picture of a cute animal (not mandatory but encouraged)