Skip to content

feat(docker): add docker pause strategy #755

Merged
acouvreur merged 11 commits into
sablierapp:mainfrom
ylecuyer:docker-pause-yle
Nov 27, 2025
Merged

feat(docker): add docker pause strategy #755
acouvreur merged 11 commits into
sablierapp:mainfrom
ylecuyer:docker-pause-yle

Conversation

@ylecuyer

Copy link
Copy Markdown
Contributor

Resolves #212

A bit similar to #618

Adds a strategy for the docker provider, either stop or pause ( stop by default for backward compatibility)

Stop strategy (unchanged):

stop_strategy.mp4

Pause strategy:

pause_strategy.mp4

@ylecuyer ylecuyer requested a review from acouvreur as a code owner November 27, 2025 00:00
Copilot AI review requested due to automatic review settings November 27, 2025 00:00
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
35.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a pause strategy option for the Docker provider, allowing containers to be paused instead of stopped when they become idle. This provides faster resume times as container state remains in memory, though at the cost of higher system resource usage.

Key Changes:

  • Added a configurable strategy field to the Docker provider configuration (options: stop or pause)
  • Implemented pause/unpause functionality alongside existing stop/start behavior
  • Added comprehensive test coverage and validation for the new strategy option

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.tool-versions Specifies Go version 1.25.4 (invalid version - see critical issue)
sablier.sample.yaml Adds docker strategy configuration example
pkg/config/provider.go Adds Docker config struct with strategy field and validation logic
pkg/config/provider_test.go Adds comprehensive tests for Docker strategy validation
pkg/sabliercmd/root.go Registers new CLI flag for docker strategy configuration
pkg/sabliercmd/provider.go Passes strategy parameter to Docker provider initialization
pkg/sabliercmd/cmd_test.go Updates test to include new strategy parameter
pkg/sabliercmd/testdata/* Updates test fixtures with Docker strategy configuration
pkg/provider/docker/docker.go Accepts and stores strategy parameter in provider
pkg/provider/docker/container_stop.go Implements strategy-based routing between stop and pause operations
pkg/provider/docker/container_start.go Implements strategy-based routing between start and unpause operations
pkg/provider/docker/*_test.go Updates all tests to pass strategy parameter and adds new pause/unpause tests
docs/providers/docker.md Documents both stop and pause strategies with configuration examples
docs/configuration.md Adds docker strategy to configuration documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@acouvreur

Copy link
Copy Markdown
Member

Hello @ylecuyer !

Thanks for the pull request!

I'm not really sure about the strategy parameter. I've seen that using "strategies" often confuse people instead of using some dedicated configuration such as "use-pause".

But I also like it because I might implement the checkpoint feature.

@codecov

codecov Bot commented Nov 27, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.41667% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
pkg/config/provider.go 72.72% 3 Missing ⚠️
pkg/provider/docker/container_start.go 84.21% 2 Missing and 1 partial ⚠️
pkg/sabliercmd/provider.go 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
pkg/provider/docker/container_stop.go 80.00% <100.00%> (+13.33%) ⬆️
pkg/provider/docker/docker.go 86.66% <100.00%> (+0.95%) ⬆️
pkg/sabliercmd/root.go 97.46% <100.00%> (+0.06%) ⬆️
pkg/sabliercmd/provider.go 0.00% <0.00%> (ø)
pkg/config/provider.go 44.82% <72.72%> (+44.82%) ⬆️
pkg/provider/docker/container_start.go 88.46% <84.21%> (-11.54%) ⬇️

@acouvreur

acouvreur commented Nov 27, 2025

Copy link
Copy Markdown
Member

Nice work @ylecuyer !

I think that's a pretty nice implementation overall! How did you find the testing experience using testcontainers ?


I need to enhance the configuration a lot so that it is generated instead.

@acouvreur acouvreur merged commit 0d699ef into sablierapp:main Nov 27, 2025
10 of 13 checks passed
@ylecuyer

Copy link
Copy Markdown
Contributor Author

@acouvreur Thanks for merging the PR

How did you find the testing experience using testcontainers ?

It was good, all transparent I didn't have to worry about anything

emilien-jegou pushed a commit to emilien-jegou/sablier that referenced this pull request Dec 29, 2025
* add tmp test

* add strategy config

* strategy config

* pause / unpause strategy impl

* Fix tests

* fix compilation

* add pause / unpause tests

* add doc

* add config test

* start if not paused

* remove test files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Ability to halt the container

3 participants