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

Need clarification on how affected with tags works? #16976

Closed
3 tasks
ahernd2 opened this issue May 12, 2023 · 3 comments · Fixed by #16986
Closed
3 tasks

Need clarification on how affected with tags works? #16976

ahernd2 opened this issue May 12, 2023 · 3 comments · Fixed by #16986
Assignees
Labels

Comments

@ahernd2
Copy link

ahernd2 commented May 12, 2023

Documentation issue

  • Reporting a typo
  • Reporting a documentation bug
  • Documentation improvement
  • [x ] Documentation feedback

Is there a specific documentation page you are reporting?

Enter the URL or documentation section here.

Additional context or description

The documentation says to use tags with the affected command we should use the command below

nx affected -t build --tag=$NX_TASK_TARGET_PROJECT:latest

I tried this but it just runs every project.

Can you please clarify what is "latest"? is that referring to the tag to be used?

For example we have projects that run either cypress or playwright. We have added a cypress and playwright tags to the relevant projects. However when I do this command I would expect only cypress affected projects to run, but it seems to be running every project

nx affected --target=e2e --tag=$NX_TASK_TARGET_PROJECT:cypress

and it outputs

  With additional flags:
           --tag=:cypress

Im also curious is $NX_TASK_TARGET_PROJECT meant to put in the project name as it looks like that is not working either.

NOTE I am referring to this tags feature that was recently merged - #10085

   Node   : 16.20.0
   OS     : linux x64
   pnpm   : 8.5.0
   Hasher : Native
   
   nx                 : 16.1.3
   @nx/js             : 16.1.3
   @nx/jest           : 16.1.3
   @nx/linter         : 16.1.3
   @nx/workspace      : 16.1.3
   @nx/angular        : 16.1.3
   @nx/cypress        : 16.1.3
   @nx/devkit         : 16.1.3
   @nx/esbuild        : 16.1.3
   @nx/eslint-plugin  : 16.1.3
   @nx/express        : 16.1.3
   @nx/node           : 16.1.3
   @nx/plugin         : 16.1.3
   @nx/storybook      : 16.1.3
   @nrwl/tao          : 16.1.3
   @nx/web            : 16.1.3
   @nx/webpack        : 16.1.3
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @mands/nx-playwright : 0.4.0
   @ngrx/effects        : 15.3.0
   @ngrx/router-store   : 15.3.0
   @ngrx/store          : 15.3.0
   @ngrx/store-devtools : 15.3.0
   @storybook/angular   : 7.0.9
   ngx-build-plus       : 13.0.1
   ---------------------------------------
   Local workspace plugins:
         workspace-plugin
```
@AgentEnder
Copy link
Member

--tags doesn't work as described in the beginning of that PR. Instead, any where that takes --projects or --exclude can use tokens like:

  • --projects tag:mytag
  • --exclude tag:mytag

For affected, we don't have a projects arg. But we do have an exclude arg. If you wanted to run affected for one specific tag, you could do something like:

  • nx affected -t build --exclude '*,!tag:mytag'

This would run build for all projects with mytag that are currently affected

@AgentEnder
Copy link
Member

The last example there is a bit confusing, --tag is a property passed on to the target in that case, not an argument for affected

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

2 participants