Launch Templates

You can find built-in launch templates here.

The easiest way to create a new custom launch template is to modify one of the built-in ones. To do that, create a file in the .nx/workflows folder and copy one of the built-in templates there. You can name the file any way you want (e.g., agents.yaml).

This is an example of a launch template using all built-in features:

1launch-templates: 2 my-linux-medium-js: 3 resourceClass: 'docker_linux_amd64/medium' 4 image: 'ubuntu22.04-node20.9-v3' 5 env: 6 MY_ENV_VAR: shared 7 init-steps: 8 - name: Checkout # using a reusable step 9 uses: 'nrwl/nx-cloud-workflows/v1.1/workflow-steps/checkout/main.yaml' 10 - name: Restore Node Modules Cache 11 uses: 'nrwl/nx-cloud-workflows/v1.1/workflow-steps/cache/main.yaml' 12 env: 13 KEY: 'package-lock.json|yarn.lock|pnpm-lock.yaml' 14 PATHS: 'node_modules' 15 BASE_BRANCH: 'main' 16 - name: Install Node Modules 17 uses: 'nrwl/nx-cloud-workflows/v1.1/workflow-steps/install-node-modules/main.yaml' 18 - name: Run a custom script 19 script: | 20 git config --global user.email test@test.com 21 git config --global user.name "Test Test" 22 - name: Setting env # Redefine PATH for further steps 23 script: echo "PATH=$HOME/my-folder:$PATH" >> $NX_CLOUD_ENV 24 - name: Print path 25 script: echo $PATH # will include my-folder 26 - name: Define env var for a step 27 env: 28 MY_ENV_VAR: 'for-step' 29 script: echo $MY_ENV_VAR # will print for-step 30

Resource Classes

The following resource classes are available:

  • docker_linux_amd64/small
  • docker_linux_amd64/medium
  • docker_linux_amd64/medium+
  • docker_linux_amd64/large
  • docker_linux_amd64/large+
  • docker_linux_amd64/extra_large
  • docker_linux_amd64/extra_large+
  • windows/medium

See their detailed description and pricing at nx.app/pricing.

Image

The following images are available:

  • ubuntu22.04-node20.9-v1
  • ubuntu22.04-node20.9-withDind-v1
  • ubuntu22.04-node20.9-v2
  • ubuntu22.04-node20.9-withDind-v2
  • ubuntu22.04-node20.9-v3
  • ubuntu22.04-node20.9-withDind-v3
  • windows-2022

Note: Windows-based images can only run on Windows-based resource classes.

Enterprise accounts can use custom images.

Pass Environment Variables to Agents

If you need to send environment variables to agents, you can use the --with-env-vars flag on the nx-cloud start-ci-run command. You can pass a specific list of environment variables like this:

1nx-cloud start-ci-run --distribute-on="8 linux-medium-js" --with-env-vars="VAR1,VAR2" 2

Or pass all the environment variables except OS-specific ones with this --with-env-vars="auto":

1nx-cloud start-ci-run --distribute-on="8 linux-medium-js" --with-env-vars="auto" 2

Reusable Steps

You can find the list of reusable steps here.