Repository navigation
Add service filters to -c compose commands - #373
Merged
Merged
Conversation
Words with a key after a compose command pick the services it acts on: service:-sonarr is every service but sonarr, service:radarr,sonarr only those two, service:+sonarr adds sonarr. Words apply left to right, starting from every service; a plain app name keeps only that app. Plain names without filter words behave as before. - A filter that leaves no services, names an unknown service, or mixes "+" and "-" in one word is an error and nothing runs. - If the command would bring back a service a "-" word removed, as a dependency (or a dependent with -D or restart), it stops before asking and names every service that brings it back; --no-deps acts on the filtered services only. - Services with a Compose profile, which DS2 never runs, are left out of the starting set, and naming one is an error. - A "Filter ... -> N services" line shows what the words resolved to, and the question and Running line list the resolved services. Related display fixes: with --no-deps the question names the dependencies it leaves out and the Running line shows --no-deps (pull no longer claims --include-deps), and a multi-service app's other services keep their service part in names (PaperlessNGX-redis).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds filters to
-ccompose commands, so a command can act on "everything but" a service without listing every other one by hand. The motivating case: updating every app while one instance is busy with a long job that a recreate would kill.For now filters are
-conly, andservice:is the only key.Filters
A word with a key after the compose command is a filter. Words apply left to right, starting from every service in the project:
service:radarr,sonarrservice:+sonarrservice:-sonarr=works like:, and names are matched without regard to case.service:word. Without filter words, plain names behave exactly as before.Safety
+and-in one word, or a list item that looks like another filter.-word removed, through a dependency (or a dependent with-D, or arestart: truedependent forrestart), it stops before asking. The message names every service that brings it back: "service:-sonarr excludes sonarr, but seerr depends on it: add --no-deps, or exclude seerr too".--no-depsacts on the filtered services only.Filter … → N servicesline shows what the words resolved to. The question and the Running line list the resolved services, so the shown command is what runs.-c runtakes a job name and refuses a filter.Related display fixes
--no-deps, the question names what it leaves out ("…, without their dependencies: …", or "without the apps that restart with them" forrestart), and the Running line shows--no-depsforupandrestart.pullshowed--include-depseven with--no-deps; it now shows it only when dependencies are included.PaperlessNGX-redisinstead of a secondPaperlessNGX.-cusage text describes filters.Testing
Unit tests cover the resolver (each operator, order, empty results, every error), the refusal for dependencies, dependents and restart dependents (several dependents, chains, merged sentences), profiled services, the preview reading profiles, and the
--no-depsquestion wording.Tested on a Linux test host: every error and word form, the refusal in both directions, filtered
pull,restartandupdate, from the command line and the TUI console panel. Confirmed live on a production host:--no-deps -c update service:-sonarrupdated 28 apps and left Sonarr's container untouched while its long-running job continued; the other Sonarr instances were recreated as intended.