Skip to content

Commit 66488a2

Browse files
rarmateibarbados-clemensgraphite-app[bot]
authored
docs(nx-cloud): document how to set working directory in nx agents (#34033)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # --------- Co-authored-by: Caleb Ukle <caleb@nrwl.io> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
1 parent 2cdaffc commit 66488a2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

astro-docs/src/content/docs/reference/Nx Cloud/launch-templates.mdoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,3 +738,20 @@ launch-templates:
738738
# This is a safer approach to prevent leaking tokens/passwords
739739
echo "SOME_VALUE: $SOME_VALUE"
740740
```
741+
742+
## Nx Workspace in a Subdirectory
743+
744+
If your Nx workspace is in a subdirectory of your repository, set `NX_WORKING_DIRECTORY` in your launch template:
745+
746+
```yaml
747+
launch-templates:
748+
my-template:
749+
resource-class: 'docker_linux_amd64/medium'
750+
image: 'ubuntu22.04-node20.11-v9'
751+
env:
752+
NX_WORKING_DIRECTORY: './client'
753+
init-steps:
754+
# ...
755+
```
756+
757+
The `install-node-modules` step automatically respects this variable (but can be overridden at the step level if your lockfile is hosted at the root). For other steps, set the working directory manually.

astro-docs/src/content/docs/reference/environment-variables.mdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Similar to the Nx CLI, Nx Cloud also used the `NX_VERBOSE_LOGGING` environment v
8686
| `NX_CLOUD_NO_TIMEOUTS` | boolean | Disables the default 10-second timeout for Nx Cloud requests. |
8787
| `NX_NO_CLOUD` | boolean | If set to `true`, prevents Nx Cloud from being used for the current run. No remote cache will be used. Value cannot be set if using [distributed task execution](/docs/features/ci-features/distribute-task-execution) |
8888
| `NX_VERBOSE_LOGGING` | boolean | Outputs debug information about agents communicating with the main job. Useful for debugging cache misses and on-premises setup issues. |
89+
| `NX_WORKING_DIRECTORY` | string | The subdirectory containing your Nx workspace. Set this in your launch template if your Nx workspace is not at the repository root. Only used by Nx Agents. |
8990

9091
### Deprecated Nx Cloud Environment Variables
9192

0 commit comments

Comments
 (0)