start_daemon and stop_daemon polled "while True" with no bound, and no seaf-cli exit code was checked. A daemon that failed to start left the container spinning forever with nothing pointing at the cause, and there was no signal handling, so "docker stop" waited the full 10 second grace period and then SIGKILLed the process with the daemon still running. Readiness polling is now bounded by DAEMON_START_TIMEOUT and DAEMON_STOP_TIMEOUT. The stop timeout is 8 seconds so a graceful shutdown fits inside the docker stop grace period, and a test asserts that relation. SIGTERM and SIGINT raise GracefulShutdown, and the lifecycle moved into start.run(), which always stops the daemon on the way out and returns the process exit code: 0 on a clean finish or a stop signal, 1 on a daemon or configuration failure. seaf-cli exit codes are checked. A failed sync is reported per library and does not stop the remaining libraries, since one bad library should not take the container down. Verified in the built image: "docker stop" now returns in 0s with exit code 0 and the daemon stopped, against 10s and exit 137 before. A daemon that cannot start exits 1 with the failing command and its exit code in the log. Also bumps actions/setup-python to v7, which clears the last Node 20 deprecation warning; v7 only drops the unused pip-install input.
89 lines
1.9 KiB
YAML
89 lines
1.9 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- '*'
|
|
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
IMAGE: snegov/seafile-client
|
|
|
|
jobs:
|
|
# Application failures must be distinguishable from packaging failures, so
|
|
# the unit tests do not depend on the image build.
|
|
unit-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: '3.11'
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements-dev.txt
|
|
|
|
- name: Run unit tests
|
|
run: pytest -q
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Validate compose example
|
|
run: docker compose --file compose.example.yaml config --quiet
|
|
|
|
- name: Build image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
push: false
|
|
load: true
|
|
tags: ${{ env.IMAGE }}:ci
|
|
|
|
push:
|
|
needs: [unit-test, test]
|
|
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
# Every tag of a release must resolve to one manifest digest, so the
|
|
# image is built once and all tags are attached to that single build.
|
|
- name: Collect tags and labels
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ env.IMAGE }}
|
|
tags: |
|
|
type=ref,event=tag
|
|
flavor: |
|
|
latest=true
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|