-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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): add an option to run-many by tags #4557
Conversation
Nx Cloud ReportCI ran the following commands for commit d6e0efe. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch Sent with 💌 from NxCloud. |
a6d133b
to
ba94562
Compare
Related: #3812 |
love (and need!) this ❤️ |
Any thoughts on this? Would be quite useful to simplify deployments in our case. |
@FrozenPandaz any plans to review this PR? This would be a huge improvement to our developer experience. |
.check(({ all, projects, tags }) => { | ||
if ( | ||
(all && projects) || | ||
(projects && tags) || | ||
(all && tags) || | ||
(!all && !projects && !tags) | ||
) | ||
throw new Error( | ||
'You must provide either --all or --projects or --tags' | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to:
const suppliedArgs = !!all + !!projects + !!tags;
if (suppliedArgs === 1) {
return true;
} else {
// throw error
}
Optionally you may remove the redundant else here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ updated and rebased
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and fixed lint, green on CI again
`nx run-many --target=deploy --tags=foo` runs the given target for all projects that have a tag `foo` configured in nx.json. Closes nrwl#2675.
Any change for this getting merged at all near-term? If not I'll close this and figure out another way for us internally. |
Sorry @Schibum I don't think we will be merging this soon. @vsavkin and I have been discussing using Having worked in many workspaces large and small, we have yet to see a clear case where this feature would be part of a dev's workflow. It might be a good idea to allow a dev to focus on an area in some cases. But I think in many cases, it may be short-sighted to focus on an area without being concerned about everything that is affected. For working on higher-level features, For working on shared or core code, Perhaps some workspaces are tagged with a different strategy than what we've seen and this feature makes sense there. We've discussed some possible use cases but still aren't clear on when this is ideal. If you'd like to have this functionality in your workflow, you can explore using Again, before this is implemented, I think the discussion should continue to clarify use cases of this feature. Would it be alright to close this PR for now? |
Hi, thank you for clarifying in such a detailed manner. In our case, we'd like to group deployment of multiple projects typically deployed together (using a 'deploy' configured within nx). E.g. we'd be deploying a frontend + backend using a tag such as |
Hi, @FrozenPandaz it would be super cool to have this feature though. I have come across the problem when one team doesn't want to use |
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. |
nx run-many --target=deploy --tags=foo
runs the given target for allprojects that have a tag
foo
configured in nx.json.Closes #2675.
Current Behavior
and
are supported with
nx run-many
.Expected Behavior
Add a --tags option (mutually exclusive with --all and --projects) that allows to target projects by tags as configured in nx.json. E.g.:
Would run
build
for any project tagged with tag1 or tag2.