From 9db4c8c33362c1abb59191e92dbddaf9720c0bc7 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Sun, 29 Jun 2025 11:07:09 +0700 Subject: [PATCH] [core] Check docker health in CI fix #1085 --- .github/workflows/build.yaml | 11 ++++++++++- .pre-commit-config.yaml | 1 + tests/smoke/goss.yaml | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1eabcbab..0c4561dc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -126,7 +126,16 @@ jobs: working-directory: tests/smoke timeout-minutes: 2 run: | - docker run -d --name smoke --rm -p3000:3000 ${{ vars.DOCKER_IMAGE }}:${{ matrix.tag }} + docker run -d \ + --name smoke \ + --health-interval 1s \ + --health-retries 60 \ + --health-timeout 2s \ + --health-start-period 2s \ + --health-start-interval 1s \ + --rm -p3000:3000 \ + ${{ vars.DOCKER_IMAGE }}:${{ matrix.tag }} + sleep 3 docker logs smoke goss validate --retry-timeout 30s --sleep 1s diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e49ec9ca..f8dd8afa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,7 @@ repos: (?x)^( docs/.*| README.md| + tests/smoke/goss.yaml| )$ - repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs rev: v1.1.2 diff --git a/tests/smoke/goss.yaml b/tests/smoke/goss.yaml index 42f520ad..930df823 100644 --- a/tests/smoke/goss.yaml +++ b/tests/smoke/goss.yaml @@ -5,3 +5,11 @@ http: no-follow-redirects: true timeout: 5000 body: ['version'] + +command: + docker smoke health: + exec: "docker inspect --format '{{`{{if .State.Health}}{{.State.Health.Status}}{{else}}no healthcheck{{end}}`}}' smoke" + exit-status: 0 + stdout: + - 'healthy' + timeout: 5000