Deploy Web Job using Appveyor

ricardo.polo's Avatar

ricardo.polo

30 Oct, 2014 06:31 PM

I have a web site create for Azure and an Azure WebJob (an console program that uses a queue to be triggered that is running in background.)

I deploy this project from Github to Azure and works, it deploy the Azure WebJob with the Azure Website.
Now I want to deploy to Azure using Appveyor. It works for the website, but when I added a Web Job to the solution, the Deployment Fails

This is what I see. Do you support web deploy to Azure including Web Jobs?

Build FAILED.
645
646"C:\projects\signtul\Tulpep.Signtul.Website\Tulpep.Signtul.Website.csproj" (default target) (1) ->
647"C:\projects\signtul\Tulpep.Signtul.DeployToOffice365Job\Tulpep.Signtul.DeployToOffice365Job.csproj" (default target) (6) ->
648(ValidatePublishProfileSettings target) ->
649 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4346,5): error : The value for PublishProfile is set to 'appveyor', expected to find the file at 'C:\projects\signtul\Tulpep.Signtul.DeployToOffice365Job\Properties\PublishProfiles\appveyor.pubxml' but it could not be found. [C:\projects\signtul\Tulpep.Signtul.DeployToOffice365Job\Tulpep.Signtul.DeployToOffice365Job.csproj]
650 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4353,4): error : PublishProfile(appveyor) is set. But the $(WebPublishMethod) does not have a valid value. Current Value is "". [C:\projects\signtul\Tulpep.Signtul.DeployToOffice365Job\Tulpep.Signtul.DeployToOffice365Job.csproj]
651 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4360,5): error : Target ValidatePublishProfileSettings Failed [C:\projects\signtul\Tulpep.Signtul.DeployToOffice365Job\Tulpep.Signtul.DeployToOffice365Job.csproj]
652
653 0 Warning(s)
654 3 Error(s)
655
656Time Elapsed 00:00:51.74
657Command exited with code 1

Regards and thank you!

Showing page 2 out of 2. View the first page

  1. 31 Posted by kevin on 14 Sep, 2015 09:37 PM

    kevin's Avatar

    I am hopeful. If my understanding is correct, it looks like a simple PUT request that will (may) create
    the schedule.job file with the contents from the request’s body: {“schedule": “0 */2 * * * *”}.

    The API supporting the following 6 fields: (second, minute, hour, day, month, day of the week).

    I have the cmdlet roughed in BUT No cron validation, nor have I tested it. I currently don’t have a triggered job deployed to test against at this time.

    I’ll commit the new additions later today

    The cmdlet will works as follows:
    Set-KuduTriggeredSchedule -Website {siteName} -UserName {userName} -Password {password} -JobName {jobName} -Schedule “0 */2 * * * *”

    Cheers.

    Added Start-KuduContiniousJob, Stop-KuduContiniousJob, Get-KuduContiniousJob as well.

  2. 32 Posted by kevin on 14 Sep, 2015 11:27 PM

    kevin's Avatar

    My initial assumptions was wrong, I ended up needing to create the file schedule.job and then up load it using
    the same API Endpoint (PUT /api/triggeredwebjobs/{job name}/settings)

    under the hood of the cmdlet is just

    Invoke-RestMethod -Uri $url -Headers $headers -InFile $file -Method Put -ContentType "application/json";

    it is working, I have lightly tested it. note the API has no return on success.

    Any input is welcome, especially on error handling and validation on quartz cron.

  3. Support Staff 33 Posted by Feodor Fitsner on 15 Sep, 2015 11:47 PM

    Feodor Fitsner's Avatar

    Nice! Now we have all missing pieces to make Web Jobs deployment. Thank you very much for putting this together!

    I've added a link to this discussion to the issue: https://github.com/appveyor/ci/issues/277

  4. 34 Posted by Øyvind Valland on 12 Oct, 2015 02:55 PM

    Øyvind Valland's Avatar

    Hello!

    Do you guys have an ETA on your support for this?

  5. 35 Posted by Øyvind Valland on 25 Nov, 2015 05:10 PM

    Øyvind Valland's Avatar

    Any news on support for this? It would be nice to get an update, even if it is to say "not yet."

  6. 36 Posted by kevin on 25 Nov, 2015 06:09 PM

    kevin's Avatar

    Oyvind,

    I have created a powershell module PsKudu which might help. It is still a work in progress. We use it in our deployments.

    Publish-KuduWebjob `
        -WebsiteName $env:webdeploy_site `
        -Username $env:webdeploy_username `
        -Password $env:webdeploy_Pwd `
        -FilePath "$env:APPVEYOR_BUILD_FOLDER\Worker.zip" `
        -JobName "AwebJobWorker" `
        -RunCommand "Worker.exe";
    

    website, Username, password at the ones in your azure PublishProfileSettings files.

  7. 37 Posted by Michael Siers on 10 Dec, 2015 09:30 PM

    Michael Siers's Avatar

    I am seeing the appveyor.pubxml file not found error when trying to build a solution that includes a web api and web job project. Is this still an active open issue?

    What is the current/best work around to get a build environment working? I am trying to get the web api to be built as an artifact so it can be used to deploy both the web api and web job using web deploy.

  8. 38 Posted by kevin on 10 Dec, 2015 10:18 PM

    kevin's Avatar

    Micheal,

    Sounds like you are using the deploy provider WebDeploy for webjobs. It been awhile since I used that method but I vaguely recall needing to create an appveyor.pubxml in the projects properties folder. I think I created mine to match the provider settings just in case.

    The WebDeploy provider did not work for us in the end for webjobs.

    Currently we package each project in a zip file and then deploy them with MsDeploy (API and SPA) and PsKudu (KuduAPI) for webjobs, but previously, we use WebDeploy provider to deploy our API and SPA then after_deploy webjobs were deployed with Invoke-MSBuild (MsBuild powershell wrapper ):

    Invoke-MSBuild -projectsToBuild "C:\Development\project\Server.Worker\Server.Worker.csproj" 
              -visualStudioVersion 12.0
              -DeployOnBuild $true 
              -properties @{'_DestinationType'='AzureWebSite'}
              -publishProfile "C:\Development\project\Server.Worker\Properties\PublishProfiles\azure.pubxml" `
              -password "$env:mpCicdPwd"
    
    my azure.pubxml
    <?xml version="1.0" encoding="utf-8"?>
    <!--
    This file is used by the publish/package process of your Web project. You can customize the behavior of this process
    by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
    -->
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <WebPublishMethod>MSDeploy</WebPublishMethod>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish>https://{your azure site}.azurewebsites.net</SiteUrlToLaunchAfterPublish>
        <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
        <MSDeployServiceURL>{publishSettings site}.scm.azurewebsites.net:443</MSDeployServiceURL>
        <DeployIisAppPath>{publishSettings sitename}</DeployIisAppPath>
        <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
        <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
        <UserName>{publishSettings UserName}</UserName>
        <_SavePWD>True</_SavePWD>
        <_DestinationType>AzureWebSite</_DestinationType>
        <PublishDatabaseSettings>
          {your app settings}
        </PublishDatabaseSettings>
      </PropertyGroup>
      <ItemGroup>
        <MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String">
          <ParameterValue>{some params}</ParameterValue>
        </MSDeployParameterValue>
      </ItemGroup>
      <ItemGroup>
        <_ConnectionStringsToInsert Include="DefaultConnection" />
      </ItemGroup>
    </Project>
    

    Hope this somewhat helpful.

  9. Support Staff 39 Posted by Feodor Fitsner on 10 Dec, 2015 11:03 PM

    Feodor Fitsner's Avatar

    Thanks, Kevin!

    Just to add that in order to use AppVeyor's automatic packaging you can add appveyor.pubxml publishing profile to Web Job project with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <WebPublishMethod>FileSystem</WebPublishMethod>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish />
        <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
        <ExcludeApp_Data>False</ExcludeApp_Data>
        <publishUrl>$(APPVEYOR_BUILD_FOLDER)\MyWebJob</publishUrl>
        <DeleteExistingFiles>False</DeleteExistingFiles>
      </PropertyGroup>
    </Project>
    

    You can specify a path where job will be published in publishUrl.

  10. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:02 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