Azure Mobile Service deployment with Team City part 5. Configuring Mobile in TeamCity

Tags: .NET, Azure, CI, TeamCity

In the previous post we finished to create all the PowerShell scripts. The build and deployment run locally. Now it’s time to create a TeamCity configuration for it.

Open the TeamCity web page and click on the arrow on the right hand side of User Management Project page and then Edit Settings from the menu.

p51

Click on the Create build configuration.

p52

Give it a name – I use Mobile Service and click Create.

p53

It opens the Version Control Settings page where I will attach the VCS root previously created.

p56

Next step is to create the build configuration. Click on the Build Steps and Add build step.

Select PowerShell Runner Type, specify the step name and select the PowerShell mode.

Click the Show advanced options link at the bottom of the page if you don’t see all the settings.

Select error value in Error Output drop down.

Enter MobileService/Scripts in Working directory

Enter the script file MobileService/Scripts/run-build.ps1

Make sure Execute .ps1 from external file is selected in Script execution mode.

Click Expand on the Script arguments and enter:

-version %build.number%

-contentPath "contentPath"

-computerName "computerName"

-userName "userName"

-password "password"

Replace all the necessary values as described in Azure Mobile Service deployment with Team City part 4. Deploying Azure Mobile Services.

p57

Click Save.

We need to configure a few more settings.

Click on the General Settings and enter the Build number format. I use Major.Minor.Build.Revision pattern: 0.0.2.%build.counter%.

In the Artifact paths enter

MobileService\Artifacts=>Package

In our script at the build step we copy the package which we need to deploy in the Artifacts folder. Now we tell TeamCity to use that folder to create a build Artifact. You’ll see later how we use it do deploy to other environments.

p58

Open the Failure Conditions from the left hand site and select “an error message is logged by build runner”. In some cases when the PowerShell returns an error, like failed to deploy the mobile service TeamCity will mark the build as green – success. When you select this option it will fail the build.

Now when you run this build it will execute all the PowerShell steps and will deploy the Azure Mobile Service.

In the next post we’ll configure SpecFlow to integrate with TeamCity.

< Previous

Comments

comments powered by Disqus