Skip to content

Commit

Permalink
feat(nx-dev): add videos to CI docs
Browse files Browse the repository at this point in the history
  • Loading branch information
juristr committed Oct 24, 2024
1 parent 7839c80 commit 84aba19
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
2 changes: 2 additions & 0 deletions docs/nx-cloud/recipes/access-tokens.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Nx CLI and CI Access Tokens

{% youtube src="https://youtu.be/vBokLJ_F8qs" title="Configure CI access tokens" /%}

The permissions and membership define what developers can access on nx.app but they don't affect what happens when you run Nx commands in CI. To manage that, you need to provision CI access tokens in your workspace settings, under the `Access Control` tab.

![Access Control Settings Page](/nx-cloud/recipes/access-control-settings.avif)
Expand Down
2 changes: 2 additions & 0 deletions docs/nx-cloud/recipes/personal-access-tokens.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Nx Cloud and Personal Access Tokens

{% youtube src="https://www.youtube.com/watch?v=vX-wgI1zlao" title="Configure your Nx Cloud Personal Access Token" /%}

From Nx 19.7 repositories are connected to Nx Cloud via a property in `nx.json` called `nxCloudId`. By default this value allows anyone who clones the repository `read-write` access to Nx Cloud features for that workspace. These permissions can be updated in the workspace settings. To disallow access to anonymous users or allow `read-write` access to known users it is required that all users provision their own personal access token. To do that they need to use [`npx nx login`](/ci/reference/nx-cloud-cli#npx-nxcloud-login).

{% callout type="warning" title="Personal Access Tokens require the `nxCloudId` field in `nx.json`" %}
Expand Down
2 changes: 2 additions & 0 deletions docs/shared/migration/import-project.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Import an Existing Project into an Nx Workspace

{% youtube src="https://youtu.be/eIec0OudzxE" title="Importing an existing project into your monorepo" /%}

Nx can help with the process of moving an existing project from another repository into an Nx workspace. In order to communicate clearly about this process, we'll call the repository we're moving the project out of the "source repository" and the repository we're moving the project into the "destination repository". Here's an example of what those repositories might look like.

{% side-by-side %}
Expand Down
6 changes: 6 additions & 0 deletions docs/shared/migration/preserving-git-histories.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Preserving Git Histories when Migrating other Projects to your Nx Workspace

{% callout type="note" title="Automatically import with 'nx import'" %}

In Nx 19.8 we introduced `nx import` which helps you import projects into your Nx workspace, including preserving the Git history. [Read more in the according doc](/recipes/adopting-nx/import-project).

{% /callout %}

The nature of a monorepo is to swallow up standalone projects as your organization buys into the benefits of a monorepo workflow.

As your monorepo consumes other projects though, it's important to ensure that git history for those projects is preserved inside of our Nx Workspace.
Expand Down
47 changes: 25 additions & 22 deletions docs/shared/recipes/troubleshoot-cache-misses.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@

Problem: A task is being executed when you expect it to be replayed from the cache.

1. Check if your task is marked as cacheable:

- Check the task has a "Cacheable" label in the Project Details View. You can do so by running `nx show project <project-name> --web` or by checking it in [Nx Console](/recipes/nx-console/console-project-details).
- If you're using a version lower than Nx 17.2.0, check:
- the target configuration in the project's `project.json` file has `"cache": true` set, or
- the target configuration in `nx.json#targetDefaults` has `"cache": true` set, or

1. Check if the output of your task is changing the inputs of your task

- Check the `inputs` and `namedInputs` defined in the project configuration and root `nx.json`. The `inputs` control whether a task will execute or replay from cache.
- Check to see if there is an output file that is not being captured by the `outputs` for the task. The `outputs` property only controls what files are replayed from the cache, it doesn't dictate whether the cache is replayed, but an unaccounted output file could be modifying one of the inputs of the task.
- To check your input glob patterns file-by-file, you can get a list of all the files associated with each project by running `nx graph --file=output.json` or by clicking on a task in the task graph in the `nx graph` visualization.

1. Use the Nx Cloud troubleshooting tools
- Make sure your repo is [connected to Nx Cloud](/ci/features/remote-cache)
- Click on the run details link that is printed in the terminal after you run a task
- Expand a task that had a cache miss
- Click "Check For Near Misses" to see other similar tasks
- Copy one of those similar tasks' run details links (or a run details link from another local run)
- Click the "Compare to Similar Tasks" link in the task details on the run details page
- Paste the other run details link you copied into the form to see exactly why the two tasks were different.
- Note: Nx Cloud does not have access to your actual source code, so it can only tell you which projects were different, not the exact git diff of the source code.
## Check 1: Check if your task is marked as cacheable:

- Check the task has a "Cacheable" label in the Project Details View. You can do so by running `nx show project <project-name> --web` or by checking it in [Nx Console](/recipes/nx-console/console-project-details).
- If you're using a version lower than Nx 17.2.0, check:
- the target configuration in the project's `project.json` file has `"cache": true` set, or
- the target configuration in `nx.json#targetDefaults` has `"cache": true` set, or

## Check 2: Check if the output of your task is changing the inputs of your task

- Check the `inputs` and `namedInputs` defined in the project configuration and root `nx.json`. The `inputs` control whether a task will execute or replay from cache.
- Check to see if there is an output file that is not being captured by the `outputs` for the task. The `outputs` property only controls what files are replayed from the cache, it doesn't dictate whether the cache is replayed, but an unaccounted output file could be modifying one of the inputs of the task.
- To check your input glob patterns file-by-file, you can get a list of all the files associated with each project by running `nx graph --file=output.json` or by clicking on a task in the task graph in the `nx graph` visualization.

## Check 3: Use the Nx Cloud troubleshooting tools

{% youtube src="https://youtu.be/zJmhW1iIxpc" title="Debug remote cache misses with Nx Cloud" /%}

- Make sure your repo is [connected to Nx Cloud](/ci/features/remote-cache)
- Click on the run details link that is printed in the terminal after you run a task
- Expand a task that had a cache miss
- Click "Check For Near Misses" to see other similar tasks
- Copy one of those similar tasks' run details links (or a run details link from another local run)
- Click the "Compare to Similar Tasks" link in the task details on the run details page
- Paste the other run details link you copied into the form to see exactly why the two tasks were different.
- Note: Nx Cloud does not have access to your actual source code, so it can only tell you which projects were different, not the exact git diff of the source code.

0 comments on commit 84aba19

Please sign in to comment.