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

feat(core): filter affected projects by glob pattern on tags #8364

Closed

Conversation

yharaskrik
Copy link
Contributor

@yharaskrik yharaskrik commented Jan 4, 2022

ISSUES CLOSED: #2675

Current Behavior

When running affected command you only get all affected projects that have the target running affected for

Expected Behavior

Can filter affected projects by glob patterns so that you can run a target for all affected projects who have a tag scope* (for example)

Example:

There are two apps in the project client and api they are configured like so:

client:
  tags: ["frontend", "scope:app"]

api:
  tags: ["backend", "scope:server"]

Let's say they share a lib dtos, if we make a change in dtos and then run nx affected:apps it should print out client and api (currently).

What if we have two different CI machines, one does everything for servers and one does everything for apps. With this PR we could do:

CI Machine 1
yarn nx affected:* --tags frontend

CI Machine 2
yarn nx affected:* --tags backend

A more complex example and what spurred this is, we have the need for some of our docker containers to be built on ARM resources and some to be built on x86 resources (there are definitely different ways to do this but this is just the situation that spurred this). Each of our servers could be tagged with arm or x86 then we could do

ARM Machine
yarn nx affected:dockerize --tags arm

x86 Machine
yarn nx affected:dockerize --tags x86

The tags flag accepts a glob pattern so you could so something like --tags "scope:*" to run a target on all affected projects that have a scope tag as well.

Currently the CLI will accept --tags=tag1,tag2,scope* and then AND them together so a project is required to have a tag that matches all of the glob tags passed in. Not sure if this would be better as an OR or have it as an exclude with AND or OR. Open to ideas here.

Related Issue(s)

Fixes #2675

@nx-cloud
Copy link

nx-cloud bot commented Jan 4, 2022

@vercel
Copy link

vercel bot commented Jan 4, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/DeWDjQKthTYNcxLRDgRejKyL35m5
✅ Preview: https://nx-dev-git-fork-yharaskrik-jaybell-filter-affected-by-tags-nrwl.vercel.app

[Deployment for 8680f60 canceled]

@AgentEnder
Copy link
Member

Going to close this one out in favor of eventually moving forward with #10085

@AgentEnder AgentEnder closed this May 31, 2022
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] run-many --tags=tag1,tag2
3 participants