Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targets to match one tag out of multiple #85

Closed
mlabbe opened this issue Sep 3, 2024 · 1 comment
Closed

Targets to match one tag out of multiple #85

mlabbe opened this issue Sep 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mlabbe
Copy link

mlabbe commented Sep 3, 2024

Is your feature request related to a problem? Please describe

I have a project with tag 'a' and a second project with tag 'b'. Is it possible to create a target with tags where if either 'a' OR 'b' is matched, then the task runs?

projects:
  proj_a:
    tags: [a]

  proj_b:
    tags: [b]

targets:
  a_or_b:
    tags: [a, b]

tasks:
  some_task:
    target:
      tags: [a, b]  

In this situation, mani run some_task says "no targets". This is because the projects only have one of the two tags.

Describe the solution you'd like

Possible solution would be to list multiple targets on a task, and if one is a match, then the task is ran.

Additional context

Thanks for your time and consideration!

@mlabbe mlabbe added the enhancement New feature or request label Sep 3, 2024
@alajmo
Copy link
Owner

alajmo commented Dec 25, 2024

This should now be possible with 0.30.0 release:

Tag expressions allow filtering projects using boolean operations on their tags. The expression is evaluated for each project's tags to determine if the project should be included.

Operators (in precedence order):

(): Parentheses for grouping
!: NOT operator (logical negation)
&&: AND operator (logical conjunction)
||: OR operator (logical disjunction)
For example, the expression:

(main && (dev || prod)) && !test
requires the projects to pass these conditions:

Must have "main" tag
Must have either "dev" OR "prod" tag
Must NOT have "test" tag

So either specify it using --tags-expr 'a || b' or specify it via a target.

@alajmo alajmo closed this as completed Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants