Integration / Smoke testing from TeamCity

Hi,

We have a scenario where we want to use Octopus to deploy to a CI server but then we would like to use TeamCity to run our Nunit tests.

One stumbling block with this is TC would need knowledge of where OD has installed the packages and details of environment. We have found that we can create an artifact with environment details in OD in PostDeploy but is there a way we can pass this back to TC?

Or are we headed down the wrong path? Our goals is use TC for running tests and use Octopus for deployment and management of infrastructure.

Thanks

Bradley

Hi Bradley,

We’ve done this ourselves, but we normally make an assumption about where things are installed in the subsequent TC step. For example, a build chain might look like:

  1. Build, test, package
  2. Deploy via Octopus to a Test environment
  3. Run tests against the Test environment

Are you unable to make the same kinds of assumptions?

Paul

Hi Paul,

I’m a colleague of Bradley’s and we have been looking at this together.

I guess what we acknowledge is that Team City is a CI tool, and Octopus is a deployment tool.

Our rationale to assess Octopus was to allow the DevOps team to manage the environment configurations and deployment routines from here. Then, from a development point of view, the testing would be handled by developers/ qa’s and the developer teams would use TeamCity as the CI tooling.

Currently, we use Powershell to configure TeamCity processes AND the environment settings. As such, NUnit tests run on a build agent, with details of data sources (SQL, Mongo, SOLR etc) spliced into the app.config so it can’t point at the relevant machine for integration testing.

We managed to generate an Octopus artifact which contained the test SQL server machine details in, but we are struggling to hand this back to TeamCity to use to splice into the app.config.

Ideally, we don’t want two sets of environment settings around as it would become problematic so we’re not comfortable to have assumptions of the test environment configurations being in TeamCity.

Is there any such feature request we can fire in to allow pass-back of artifacts to TeamCity? Or is there an easy API call to retrieve environment configurations based on the environment name? (We haven’t managed to find a call that can do this).

Thanks
Chris :slight_smile:

Hi Chris - sounds like an interesting setup.

It’s hard to offer much specific advice since as an oursider there’s a tonne of context I’m/Paul’s missing, but the first thought that comes to me is that you might look at writing a driver script that integrates with both Octopus and TeamCity through their APIs. There are some starting points for the Octopus API on docs.octopusdeploy.com. Sounds like you’ve already investigated that to an extent.

RE finding variables per environment, retrieving the Project through the API will give you its VariableSetId, which can then be pulled from the API and filtered on scope. However, Octopus will not provide the values of secure variables over the API, so this is limiting here.

Kicking off a build in TC from a script step in Octopus may be another option, passing the required settings as Custom Build Parameters, and then making any necessary config changes on the agent machine via PowerShell.

Hope this helps,
Nick