docs(nx-cloud): add page for nx agents (#20498)

This commit is contained in:
Juri Strumpflohner 2023-11-30 23:52:44 +01:00 committed by GitHub
parent 7e1e0d91a9
commit 77b06a9653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 79 deletions

View File

@ -159,13 +159,13 @@
"tags": ["on-premise"]
},
{
"id": "nx-cloud-workflows",
"name": "Nx Cloud Workflows",
"id": "nx-agents",
"name": "Nx Agents",
"description": "",
"file": "nx-cloud/intro/nx-cloud-workflows",
"file": "nx-cloud/intro/nx-agents",
"itemList": [],
"isExternal": false,
"path": "/ci/features/nx-cloud-workflows",
"path": "/ci/features/nx-agents",
"tags": []
}
],
@ -213,14 +213,14 @@
"path": "/ci/features/on-premise",
"tags": ["on-premise"]
},
"/ci/features/nx-cloud-workflows": {
"id": "nx-cloud-workflows",
"name": "Nx Cloud Workflows",
"/ci/features/nx-agents": {
"id": "nx-agents",
"name": "Nx Agents",
"description": "",
"file": "nx-cloud/intro/nx-cloud-workflows",
"file": "nx-cloud/intro/nx-agents",
"itemList": [],
"isExternal": false,
"path": "/ci/features/nx-cloud-workflows",
"path": "/ci/features/nx-agents",
"tags": []
},
"/ci/concepts": {

View File

@ -5649,9 +5649,9 @@
"disableCollapsible": false
},
{
"name": "Nx Cloud Workflows",
"path": "/ci/features/nx-cloud-workflows",
"id": "nx-cloud-workflows",
"name": "Nx Agents",
"path": "/ci/features/nx-agents",
"id": "nx-agents",
"isExternal": false,
"children": [],
"disableCollapsible": false
@ -5692,9 +5692,9 @@
"disableCollapsible": false
},
{
"name": "Nx Cloud Workflows",
"path": "/ci/features/nx-cloud-workflows",
"id": "nx-cloud-workflows",
"name": "Nx Agents",
"path": "/ci/features/nx-agents",
"id": "nx-agents",
"isExternal": false,
"children": [],
"disableCollapsible": false

View File

@ -1690,9 +1690,9 @@
"file": "nx-cloud/private/nx-enterprise-on-prem"
},
{
"name": "Nx Cloud Workflows",
"id": "nx-cloud-workflows",
"file": "nx-cloud/intro/nx-cloud-workflows"
"name": "Nx Agents",
"id": "nx-agents",
"file": "nx-cloud/intro/nx-agents"
}
]
},

View File

@ -0,0 +1,53 @@
# Nx Agents: The Next Leap in Distributed Task Execution
Nx Agents represent the next evolution of [Nx Cloud's Distributed Task Execution (DTE)](/ci/features/distribute-task-execution), bringing a new level of efficiency and simplicity to your CI/CD pipelines. Features include dynamic scaling, flaky task re-running, and intelligent task splitting and distribution. Keep reading to learn more.
{% youtube
src="https://youtu.be/KPCMg_Dn0Eo?si=TK-Ky8270ZGNmMUc"
title="Nx Agents in action splitting e2e tests at a file level"
/%}
Currently in private beta, Nx Agents are slated for public release in Q1 2024. Don't miss the opportunity to be among the first to experience this groundbreaking tool. Sign up now for early access.
{% call-to-action title="Sign Up for Early Access" icon="nxcloud" description="Experience Nx Agents for yourself" url="https://cloud.nx.app/workflows-early-access" /%}
## Seamless Integration
Enabling task distribution with Nx Agents can be done in a single line. Simply add the following to your CI pipeline configuration:
```yaml
- name: Start CI run
run: 'npx nx-cloud start-ci-run --distributes-on="8 linux-medium"'
...
```
Continue with your standard CI steps thereafter.
```yaml
...
- run: yarn install --frozen-lockfile
- name: Run verification
run: 'npx nx affected -t build test lint && npx nx affected -t e2e-ci --parallel 1'
```
`linux-medium` 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). You can can also define your own template as can be [seen in the Nx codebase](https://github.com/nrwl/nx/blob/master/.nx/workflows/agents.yaml).
## Intelligent Dynamic Scaling
While [Nx Cloud's DTE](/ci/features/distribute-task-execution) requires static configuration of agents, often necessitating adjustments as your workspace evolves, Nx Agents introduce a dynamic scaling feature. This innovative approach automatically scales your CI resources, spinning up or tearing down agents in response to the specific demands of your pull requests (PRs).
## Revolutionizing Task Splitting
Consider an e2e project utilizing Cypress or Playwright. To leverage [affected](/ci/features/affected), [caching](/ci/features/remote-cache) and [distribution](/ci/features/distribute-task-execution), traditionally, you would need to break down your project into smaller, more manageable units. However, this can lead to a tedious and less efficient developer experience.
Nx Agents, in conjunction with a forthcoming Nx feature, solve this challenge by being able to dividing tasks (like e2e) into smaller, more refined units (e.g., at the file/test level). This enhances distribution across dynamically provisioned Nx Agents and can drastically reduce CI time.
## Flaky Task Re-Running: Enhancing Reliability
Flaky tasks can be a persistent challenge in software development. With Nx Agents, weve developed a reliable method to detect and automatically re-run such tasks. Utilizing cache hash keys to identify tasks and leveraging data from previous runs on Nx Cloud, Nx Agents can re-run flaky tasks on different agents, up to a predetermined maximum number of retries. This process is entirely transparent to the user, ensuring a smooth and reliable CI/CD experience.
---
Sign up now for early access and be one of the first to try Nx Agents.
{% call-to-action title="Sign Up for Early Access" icon="nxcloud" description="Experience Nx Cloud Agents for yourself" url="https://cloud.nx.app/workflows-early-access" /%}

View File

@ -1,58 +0,0 @@
# Nx Cloud Workflows
{% youtube
src="https://www.youtube.com/embed/JG1FWfZFByM"
title="Introducing Nx Cloud Workflows"
width="100%" /%}
{% call-to-action title="Sign Up for Early Access" icon="nxcloud" description="Experience Nx Cloud Workflows for yourself" url="https://cloud.nx.app/workflows-early-access" /%}
## Powerful CI Capabilities Optimized for Nx monorepos
Just like Nx and Nx Cloud, Nx Cloud Workflows enables you to offload tedious technical tasks so that you can focus on more mission-critical tasks. With a traditional CI platform, you are responsible for telling the CI platform exactly what commands to execute in which environments and what to do with the artifacts. Nx Cloud by itself can automate parallelizing tasks and sharing build artifacts across machines, but you still have to create agent machines on your CI platform.
Nx Cloud Workflows applies the insights that Nx provides to the entire CI process - taking Nx Cloud to its logical conclusion by managing the whole process of CI. Nx Cloud Workflows dynamically provisions agents and then automatically parallelizes tasks and shares build artifacts across them. Because Nx Cloud Workflows can integrate directly with Nx, it has the potential to solve problems that a traditional CI platform has no way of addressing.
## Better Distributed Task Execution Experience
Nx Cloud's Distributed Task Execution (DTE) requires you to provision agent processes on your own CI provider and then Nx Cloud takes care of distributing tasks across those agents and then consolidating the results of those tasks afterwards.
![Diagram showing Nx Cloud distributing tasks to multiple agents](/shared/images/dte/distributed-caching-and-task-execution.svg)
When Nx Cloud Workflows is used for DTE, Nx Cloud will dynamically provision the agents needed for each run. This cuts down on the configuration needed and allows your organization to pay one bill to Nx instead of paying both Nx and your CI provider.
![Diagram showing Nx Cloud distributing tasks to multiple Nx Cloud Workflows agents](/shared/images/dte/distributed-task-execution-on-workflows.svg)
## Familiar YAML Syntax
Defining your CI pipeline in Nx Cloud Workflows should feel similar to the way your current CI pipelines are defined.
```yaml {% fileName=".nx/workflows/" %}
parallelism: 8
env:
CI: 'true'
NX_CLOUD_ACCESS_TOKEN: '{{secrets.NX_CLOUD_ACCESS_TOKEN}}'
steps:
- name: Git Clone
script: |
git init .
git remote add origin $GIT_REPOSITORY_URL
git fetch --no-tags --prune --depth=1 origin +{{nxCommitSha}}:{{nxCommitRef}}
git checkout --force -B {{nxBranch}} {{nxCommitRef}}
- name: Npm Install
script: |
npm ci
- name: Run Agent
script: |
npx nx-cloud start-agent
```
## Security
You have the choice between an on-premise setup or using the hosted version of Nx Cloud Workflows. The hosted version of Nx Cloud Workflows uses gVisor to ensure that each container is sandboxed in a virtualized environment so your build system is protected from attackers. gVisor is the same tool that is used to protect Google Cloud Functions.
## Early Access
If you are interested in being one of the first organizations to experience Nx Cloud Workflows, you can [sign up for early access](https://cloud.nx.app/workflows-early-access).

View File

@ -107,7 +107,7 @@ This approach fully optimizes the binning strategy so that tasks are optimally d
### 🎉 Pro: Easy to Scale
If CI is taking too long, simply increase the number of agent jobs being started in your CI system and Nx will recognize the new agent jobs are available and distribute tasks accordingly. With this approach, your worst case CI time is only limited by your longest running individual task. If you want Nx to automatically provision the agents for you, check out [Nx Cloud Workflows](/ci/features/nx-cloud-workflows).
If CI is taking too long, simply increase the number of agent jobs being started in your CI system and Nx will recognize the new agent jobs are available and distribute tasks accordingly. With this approach, your worst case CI time is only limited by your longest running individual task. If you want Nx to automatically provision the agents for you, check out [Nx Agents](/ci/features/nx-agents).
### 🎉 Pro: Build Artifacts

View File

@ -54,7 +54,7 @@ For existing workspaces you would probably want to adjust your configuration by
Distributed task execution can work on any CI provider. You are responsible for launching jobs in your CI system. Nx
Cloud then coordinates the way those jobs work together. There are two different kinds of jobs that you'll need to
create in your CI system. If you would like Nx Cloud to dynamically provision agents for you, check out [Nx Cloud Workflows](/ci/features/nx-cloud-workflows)
create in your CI system. If you would like Nx Cloud to dynamically provision agents for you, check out [Nx Agents](/ci/features/nx-agents)
1. Main job that controls what is going to be executed
2. Multiple agent jobs that actually execute the tasks

View File

@ -273,7 +273,7 @@
- [Run Only Tasks Affected by a PR](/ci/features/affected)
- [Distribute Task Execution](/ci/features/distribute-task-execution)
- [Set up Nx Cloud On-Premise](/ci/features/on-premise)
- [Nx Cloud Workflows](/ci/features/nx-cloud-workflows)
- [Nx Agents](/ci/features/nx-agents)
- [Concepts](/ci/concepts)
- [Reduce Waste in CI](/ci/concepts/reduce-waste)
- [Improve Worst Case CI Times](/ci/concepts/dte)

View File

@ -450,6 +450,7 @@ const nxCloudUrls = {
'/nx-cloud/concepts/scenarios': '/ci/concepts/cache-security',
'/nx-cloud/account/encryption': '/ci/recipes/security/encryption',
'/nx-cloud/concepts/encryption': '/ci/recipes/security/encryption',
'/nx-cloud/features/nx-cloud-workflows': '/ci/concepts/nx-agents',
'/nx-cloud/:path*': '/ci/:path*',
};