From d5e1451634d120947859172a8822e796cf8ad392 Mon Sep 17 00:00:00 2001 From: Isaac Mann Date: Wed, 14 Feb 2024 15:15:18 -0500 Subject: [PATCH] docs(core): expand nx agents feature (#21804) --- .../features/distribute-task-execution.md | 42 ++++++------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/docs/shared/features/distribute-task-execution.md b/docs/shared/features/distribute-task-execution.md index 4245467a5a7fa..0c68c35dd47a1 100644 --- a/docs/shared/features/distribute-task-execution.md +++ b/docs/shared/features/distribute-task-execution.md @@ -1,11 +1,15 @@ # Distribute Task Execution (Nx Agents) {% youtube -src="https://youtu.be/XLOUFZeqRpM" -title="Nx Agents in action splitting e2e tests at a file level" +src="https://youtu.be/XS-exYYP_Gg" +title="Nx Agents Walkthrough" /%} -**Nx Agents** let you distribute your CI across many machines with minimal configuration. It comes with features such as dynamically allocating agents based on the size of the PR, flaky task re-running, and intelligent task splitting and distribution. Keep reading to learn more. +**Nx Agents** let you distribute your CI across many machines with minimal configuration. It also comes with the following features: + +- [Dynamically allocate the number and size of agents](/ci/features/dynamic-agents) based on the size of the PR +- [Re-run flaky tasks](/ci/features/flaky-tasks) automatically whenever they fail in CI +- Automatically [split large e2e tasks](/ci/features/split-e2e-tasks) into smaller tasks that can be distributed more efficiently ## Making a Distributed CI Pipeline Is Hard @@ -41,42 +45,22 @@ Add the `start-ci-run` command to your CI pipeline configuration after checking ```yaml {% fileName=".github/workflows/main.yaml" %} # After checkout repository - name: Start CI run - run: 'npx nx-cloud start-ci-run --distribute-on="8 linux-medium-js" --stop-agents-after="e2e-ci"' + run: 'npx nx-cloud start-ci-run --distribute-on="8 linux-medium-js"' # Before install node_modules # Run any nx commands as if running on a single machine ``` -The `--distribute-on` flag instructs Nx Cloud to distribute tasks across 8 agents of type `linux-medium-js`. `linux-medium-js` is the name of the launch template that will be used to provision the agent. The default launch templates [can be found here](https://github.com/nrwl/nx-cloud-workflows/blob/main/launch-templates/linux.yaml) - -## Launch Templates - -You can also define your own "launch templates" (here's an [example from the Nx repo](https://github.com/nrwl/nx/blob/master/.nx/workflows/agents.yaml)): +The `--distribute-on` flag instructs Nx Cloud to distribute tasks across 8 agents of type `linux-medium-js`. `linux-medium-js` is the name of the launch template that will be used to provision the agent. Use on of the [default launch templates](https://github.com/nrwl/nx-cloud-workflows/blob/main/launch-templates/linux.yaml) or create your own [custom launch template](/ci/reference/launch-templates). -```yaml {% fileName=".nx/workflows/agents.yaml" %} -launch-templates: - linux-medium: - resource-class: 'docker_linux_amd64/medium+' - init-steps: - - name: Pnpm Install - script: | - pnpm install --frozen-lockfile - - - name: Install Cypress - script: pnpm exec cypress install - - - name: Install Rust - - ... -``` - -Here are the [available resource classes](https://nx.app/pricing#resource-classes). - -## Related Features +## Nx Agents Features {% cards %} +{% card title="Create Custom Launch Templates" description="Define your own launch templates to set up agents in the exact right way" type="documentation" url="/ci/reference/launch-templates" /%} + {% card title="Dynamically Allocate Agents" description="Assign a different number of agents to a pipeline based on the size of the PR" type="documentation" url="/ci/features/dynamic-agents" /%} -{% card title="Automatically Split E2E Tasks" description="Split large e2e tasks into separate tasks for each spec file" type="documentation" url="/ci/features/split-e2e-tasks" /%} +{% card title="Automatically Split E2E Tasks" description="Split large e2e tasks into a separate task for each spec file" type="documentation" url="/ci/features/split-e2e-tasks" /%} {% card title="Identify and Re-run Flaky Tasks" description="Re-run flaky tasks in CI whenever they fail" url="/ci/features/flaky-tasks" /%}