By Jaws Deploy team · Updated

Integrating Jaws Deploy with TeamCity

Keep TeamCity focused on building and testing. Let Jaws Deploy handle release creation and environment promotion.

Search guides... Ctrl K

TeamCity builds and tests. A build step at the end of the build configuration creates a Jaws Deploy release, and Jaws Deploy promotes it from Development to Production.

Two integration paths

Use the plugin for a build step configured through form fields, or the PowerShell SDK when you want the logic in a script.

// Path A

The TeamCity plugin

Install the Jaws Deploy plugin in TeamCity and add a Jaws Deploy build step. Create & Deploy creates a release and deploys it. Promote moves an existing release to the next environments. The step writes the deployment log into the build log and fails the build if the deployment fails.

// Path B

PowerShell SDK

Add a PowerShell build step that imports the PowerShell SDK and calls New-JawsRelease. No plugin is needed, and the script can live in your repository next to the rest of the build.

Plugin step settings

SettingWhat to enter
API Base URLhttps://app.jawsdeploy.net, or your own server for Jaws Deploy Stack
LoginThe service account ID
API KeyThe service account's API key. The field is stored as a TeamCity password.
OperationCreate & Deploy, or Promote
Project IDThe Jaws Deploy project
VersionThe release version. Defaults to %build.number%. For Promote, leave it empty to promote the latest release.
Channel NameOptional. Defaults to the project's default channel.
Phase Name or EnvironmentsWhere to deploy: a lifecycle phase, or a comma-separated list of environments
Release notesOptional text. TeamCity parameters such as %build.vcs.number% are filled in.
Exclude step namesOptional comma-separated list of steps to skip in this deployment

The plugin does not upload packages and does not pin package versions. A release it creates uses the newest package versions the channel allows, so upload the package before this step.

// PowerShell step in TeamCity

Drop this into a final "Create release" build step

Define env.JAWS_API_LOGIN (the service account ID) and env.JAWS_API_PASSWORD (the API key, password type) as TeamCity parameters, and pass the build number as the release version.

Import-Module ./JawsDeploySdk.psm1   # github.com/JawsDeploy/powershell-sdk

# JAWS_API_LOGIN and JAWS_API_PASSWORD come from the env.* parameters
New-JawsRelease `
    -projectId       "<project id>" `
    -version         "%build.number%" `
    -packageVersions @{ "Checkout.Web" = "%build.number%" } `
    -notes           (Get-Content ./CHANGELOG.md -Raw)

Where the package comes from

Two common setups:

  • Push to Jaws Deploy's built-in feed. Add a step before release creation that uploads the package with the REST API (POST /api/packagestore/package). The release then uses the version you just pushed.
  • Use TeamCity's NuGet feed. Add TeamCity's NuGet feed to Jaws Deploy as an external NuGet feed. Pin the package version to the build number in the SDK call, or let the release take the newest version the channel allows.

Storing the API key

Keep the API key in a password-type TeamCity parameter, not as a literal in the build configuration. TeamCity masks it in build logs. One service account key can serve every build configuration that creates releases.