# TeamCity

> Send VisualCI builds from TeamCity, passing the commit, branch and pull request from TeamCity's parameters.

Source: https://visualci.com/docs/ci/teamcity/
All of VisualCI's documentation: https://visualci.com/llms.txt

The CLI doesn't read TeamCity's parameters by itself: pass them as environment variables. Add a password parameter `env.VISUALCI_TOKEN` with a project token, and these to the build configuration:

| Parameter | Value |
| --- | --- |
| `env.VISUALCI_COMMIT` | `%build.vcs.number%` |
| `env.VISUALCI_BRANCH` | `%teamcity.build.branch%` |
| `env.VISUALCI_PR` | `%teamcity.pullRequest.number%` (with the Pull Requests build feature) |

Then a command-line step:

```sh
curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.5 VISUALCI_INSTALL_DIR="$PWD/bin" sh
export PATH="$PWD/bin:$PATH"
export VISUALCI_BUILD_ID=$(visualci build create)
npm test -- -u   # write snapshots instead of failing; see the snapshot guides
visualci upload --from auto src tests
visualci build finalize
```

Without the Pull Requests build feature, set `env.VISUALCI_PR` to `false`.

See [Other CI providers](https://visualci.com/docs/ci/other.md) for the environment variables and how shards work.
