0
votes

Is it possible to deploy a Single Page App project build using grunt to IIS using MSDeploy from TeamCity? The project is not any kind of Visual Studio solution and doesn't get built using MSBuild.

My Command parameters which are not working are:

-source:package='%teamcity.build.checkoutDir%\Dist.%build.number%.zip' -dest:auto,computerName="%system.MsDeployServiceUrl%",userName="%system.UserName%",password="%system.Password%",authtype="basic",includeAcls="False" -verb:sync -setParamFile:"%teamcity.build.checkoutDir%\Dist.%build.number%.zip.SetParameters.xml" -AllowUntrusted -setParam:"IIS Web Application Name"="%system.WebSiteName%" -verbose

The error I am getting is:

[11:47:31][Step 3/3] Error Code: ERROR_EXCEPTION_WHILE_CREATING_OBJECT [11:47:31][Step 3/3] More Information: Object of type 'package' and path 'D:\TeamCity\buildAgent\work\e2b0015b49d87e90\Dist.30.zip' cannot be created. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT. [11:47:31][Step 3/3] Error: The Zip package 'D:\TeamCity\buildAgent\work\e2b0015b49d87e90\Dist.30.zip' could not be loaded. [11:47:31][Step 3/3] Error: Could not find file 'D:\TeamCity\buildAgent\work\e2b0015b49d87e90\Dist.30.zip'. [11:47:31][Step 3/3] Error count: 1. [11:47:31][Step 3/3] Process exited with code -1 [11:47:31][Step 3/3] Step Deploy (Command Line) failed

My build process is working as I end up with the correct artefacts, I just don't seem to be able to deploy my generated artefacts using MSDeploy

This is a screenshot of my artefacts: artefacts

2

2 Answers

0
votes

I managed to get this working by changing my parameters to the following:

-source:iisapp='%teamcity.build.checkoutDir%\dist' -dest:iisapp='C:\www\xxxx-website',computerName="%system.MsDeployServiceUrl%",userName="%system.UserName%",password="%system.Password%",authtype="basic",includeAcls="False" -verb:sync -AllowUntrusted -verbose

And changing my user to an admin user rather than an IIS user. Note use of iisapp - the key was to read the MSDeploy api using msdeploy -help

FYI - a good test is to use the intended command against msdeploy.exe in console and check output errors then push command into teamcity when it's working.

0
votes

I created a grunt and gulp plugin to do just what you are looking to do. gulp-mswebdeploy-package and grunt-mswebdeploy-package will create a ms webdeploy package from any folder and do not require your build to be running on windows. https://www.npmjs.com/package/gulp-mswebdeploy-package https://www.npmjs.com/package/grunt-mswebdeploy-package