Skip to content

Support for excluding entire namespaces in addition to individual tasks #2300

Description

@dgroh

Description

Problem Statement

Currently, the excludes feature in Task only allows excluding individual tasks by their full names (e.g., "flight-recorder:start", "flight-recorder:dump"). This becomes cumbersome when you want to exclude all tasks within a specific namespace.

Current Behavior

version: "3"
includes:
  common:
    taskfile: ../common/Taskfile.yml
    excludes:
      - "flight-recorder:start"
      - "flight-recorder:dump"
      # Need to list each task individually

Desired Behavior

Allow excluding entire namespaces to simplify the configuration:

version: "3"
includes:
  common:
    taskfile: ../common/Taskfile.yml
    excludes:
      - "flight-recorder"  # Excludes all tasks in flight-recorder namespace

Use Case

When including a large taskfile with multiple namespaces, it's common to want to exclude entire groups of related tasks rather than listing each one individually.

This is especially useful for:

  • Excluding debugging/monitoring tools (like flight-recorder) from production services
  • Excluding development-only tasks from deployment pipelines
  • Excluding test suites that aren't relevant for certain contexts

Proposed Implementation

The excludes array could support both:

  • Individual task names (current behavior): "namespace:task"
  • Namespace patterns (new feature): "namespace" or "namespace:*"

Related

This builds upon the existing excludes feature introduced in #1859.

Activity

  1. added theissue type on Aug 9, 2025
  2. added
    area: includesChanges related to included taskfiles.
    and removed
    state: needs triageWaiting to be triaged by a maintainer.
    on Aug 9, 2025
  3. trulede commented on May 31, 2026

    @trulede
    Contributor

    @dgroh it could be an idea to support regular expressions in the excludes list. Something like this:

    func MatchTextAuto(input, pattern string) bool {
    	// Characters that indicate a likely regex pattern
    	regexMetaChars := `*+?^$()[]{}|`
    
    	// If the pattern contains any meta-characters, treat it as regex
    	if strings.ContainsAny(pattern, regexMetaChars) {
    		re, err := regexp.Compile(pattern)
    		if err == nil {
    			return re.MatchString(input)
    		}
    	}
    	// Fallback to string matching.
    	return strings.Contains(input, pattern)
    }
    
  4. added
    good first issueIssues that are good for first-time contributors to pick up.
    on May 31, 2026
  5. kjasn commented on Jul 1, 2026

    @kjasn
    Contributor

    @dgroh it could be an idea to support regular expressions in the excludes list. Something like this:

    func MatchTextAuto(input, pattern string) bool {
    	// Characters that indicate a likely regex pattern
    	regexMetaChars := `*+?^$()[]{}|`
    
    	// If the pattern contains any meta-characters, treat it as regex
    	if strings.ContainsAny(pattern, regexMetaChars) {
    		re, err := regexp.Compile(pattern)
    		if err == nil {
    			return re.MatchString(input)
    		}
    	}
    	// Fallback to string matching.
    	return strings.Contains(input, pattern)
    }
    

    I found it support wildcard task names like deploy:*. If there are tasks like deploy:* and deploy:1 in a included task file, and excludes option like this deploy:*. What's the result it should be, excludes all task matched with regex deploy:* or only excludes task deploy:*.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: includesChanges related to included taskfiles.good first issueIssues that are good for first-time contributors to pick up.

    Fields

    No fields configured for feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions