Migrating from Octopus Deploy to AppVeyor Deployment Agent

andrew's Avatar

andrew

08 Feb, 2016 08:58 AM

Hi all,

Just looking at AppVeyor and have been looking at migrating from using Octopus Deploy to the AppVeyor deployment agent. I have a couple of questions as follows:

- Currently we have a GitHub repo with several projects in it. The projects are for different parts of the full solution, so that would include a web project, a console application (which is ran as a Windows service), a database project etc. I currently use OctoPack to split these packages into different NuGet packages that are consumed by Octopus. Am I right in thinking that with AppVeyor, it would make more sense to split out the solution into different repos, so that each one can get a specific AppVeyor configuration assigned? When I build currently, it seems difficult to split the projects into their own solutions and then deal with them for deployment.

- I currently use the feature in Octopus to transform configuration files for non web projects. Is this feature available in AppVeyor deployment agent? I want to transform the configuration files for some console projects.

- I have some custom scripts which modify deployment configuration in some .js files which are built using Node.js. I use the environment variables in Octopus to map the configuration items to the right values during deployment, and I was wondering if the deployment agent has a similar way of working, where I can run for example a PowerShell script that gets data from environment specific variables in AppVeyor?

Thanks for any help offered,
Andrew.

  1. Support Staff 1 Posted by Feodor Fitsner on 09 Feb, 2016 01:06 AM

    Feodor Fitsner's Avatar

    Hi Andrew,

    Thanks for trying out AppVeyor!

    I don't think it's necessary to split your solution to multiple repositories. You can just build solution as a whole and then produce and upload artifacts. Your goal is having a build producing 3 artifacts: package for web app (Web Deploy, or just zip), package for console app (.zip) and database project (.dacpac?). Web app can be packaged automatically (http://www.appveyor.com/docs/deployment/web-deploy#creating-web-dep...), other packages can be created using 7z.exe: http://www.appveyor.com/docs/packaging-artifacts

    There is no built-in transform for config files, however you can update configs in deploy.ps1 script coming with app package: http://www.appveyor.com/docs/deployment/agent#running-powershell-sc...

    Yes, you can define environment variables on either environment settings screen or set these variables during the build - they will be passed to agent if deployment is called during the build. Environment variables are available in deploy.ps1.

    Let me know if you have any questions.

  2. 2 Posted by andrew on 10 Feb, 2016 06:00 PM

    andrew's Avatar

    Hi,

    Thanks for the informative post. I need to clear some things up if possible:

    For the console apps, I have packaged them up using a script to zip the files up and push to artefacts in AppVeyor. When the deployment agent extracts those scripts, they get put into a C:\Projects directory. Is this possible to change anywhere, or is the approach to use deploy.ps1 to move the files out of there? Also, when deploying via zip files, will the files get merged with what is already in the system, or does it clean the directory before extracting the new files?

    I can't see where .config transforms are run when dealing with web projects, and how those relate to environment settings. Is there a walkthrough on this or any further documentation? I want to transform two kind of configuration parameters, a simple set where we transform connection strings and application settings, in which I used Octopus's "replace app settings and connection strings in config files." I also have to transform sections of the configuration file with endpoint addresses etc. for WCF connection endpoints. I typically transform this to a token, then substitute the token in the Octopus replace variables inside text files with strings feature.

    Any suggestions gratefully received.
    Thanks.
    Andrew.

  3. Support Staff 3 Posted by Feodor Fitsner on 10 Feb, 2016 06:58 PM

    Feodor Fitsner's Avatar

    Hi Andrew,

    Yes, you can specify custom path on target server by specifying path setting: http://www.appveyor.com/docs/deployment/agent#deploying-artifact-pa... Regarding files clean-up - if you set remove_files to true Agent will be doing full sync, i.e. removing old files.

    Agent doesn't have built-in mechanism for updating .config files for either web or console apps. You should write config update/transform logic in deploy.ps1 (kind of open config file as XML file, update connection string, save XML). You can take the information about app being deployed from environment variables: http://www.appveyor.com/docs/deployment/agent#running-powershell-sc...

    Just a simple PowerShell example of how this can be done in deploy.ps1:

    $xml = New-Object XML
    if (Test-Path ($filename))
    {
        $xml.Load($filename)
    
        $appSettings = $xml.configuration.appSettings
    
        $appNameSetting = $xml.CreateElement("add")
        $appNameSetting.SetAttribute("key", "NewRelic.AppName")
        $appNameSetting.SetAttribute("value", $appName)
        $appSettings.AppendChild($appNameSetting);
    
        $xml.Save($filename)
    }
    

    where $filename is path to your .config file made of APPLICATION_PATH env variable.

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:04 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac