From 685548f777bfd732ddc32c4c6973509b38f1ebdf Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Tue, 17 Feb 2026 17:15:27 +1000 Subject: [PATCH] wip for azure flex consumption plan --- .../ArchivePackagProvider/ZipPackageProvider.cs | 2 +- .../Behaviors/AzureAppServiceZipDeployBehaviour.cs | 9 +++++---- .../Calamari.AzureAppService.csproj | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/Calamari.AzureAppService/ArchivePackagProvider/ZipPackageProvider.cs b/source/Calamari.AzureAppService/ArchivePackagProvider/ZipPackageProvider.cs index dacd9a33d3..946db69a26 100644 --- a/source/Calamari.AzureAppService/ArchivePackagProvider/ZipPackageProvider.cs +++ b/source/Calamari.AzureAppService/ArchivePackagProvider/ZipPackageProvider.cs @@ -8,7 +8,7 @@ namespace Calamari.AzureAppService { public class ZipPackageProvider : IPackageProvider { - public string UploadUrlPath => @"/api/zipdeploy"; + public string UploadUrlPath => @"/api/publish"; public bool SupportsAsynchronousDeployment => true; public async Task PackageArchive(string sourceDirectory, string targetDirectory) diff --git a/source/Calamari.AzureAppService/Behaviors/AzureAppServiceZipDeployBehaviour.cs b/source/Calamari.AzureAppService/Behaviors/AzureAppServiceZipDeployBehaviour.cs index 865f90b66f..35198ed054 100644 --- a/source/Calamari.AzureAppService/Behaviors/AzureAppServiceZipDeployBehaviour.cs +++ b/source/Calamari.AzureAppService/Behaviors/AzureAppServiceZipDeployBehaviour.cs @@ -24,6 +24,7 @@ using Calamari.Common.Plumbing.Logging; using Calamari.Common.Plumbing.Pipeline; using Calamari.Common.Plumbing.Variables; +using Newtonsoft.Json; using Octopus.CoreUtilities.Extensions; using Polly; using Polly.Timeout; @@ -150,7 +151,7 @@ public async Task Execute(RunningDeployment context) Log.Verbose($"Retrieving publishing profile for App Service to determine correct deployment endpoint."); using var publishingProfileXmlStream = await armClient.GetPublishingProfileXmlWithSecrets(targetSite); var publishingProfile = await PublishingProfile.ParseXml(publishingProfileXmlStream); - + Log.Verbose($"Using deployment endpoint '{publishingProfile.PublishUrl}' from publishing profile."); Log.Info($"Uploading package to {targetSite.SiteAndSlot}"); @@ -233,7 +234,7 @@ private async Task UploadZipAsync(IAzureAccount azureAccount, { await using var fileStream = new FileStream(uploadZipPath, FileMode.Open, FileAccess.Read, FileShare.Read); using var streamContent = new StreamContent(fileStream); - streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/zip"); //we have to create a new request message each time var request = new HttpRequestMessage(HttpMethod.Post, zipUploadUrl) @@ -287,7 +288,7 @@ private async Task UploadZipAndPollAsync(IAzureAccount azureAccount, if (!new FileInfo(uploadZipPath).Exists) throw new FileNotFoundException(uploadZipPath); - var zipUploadUrl = $"{publishingProfile.PublishUrl}{packageProvider.UploadUrlPath}?isAsync=true"; + var zipUploadUrl = $"{publishingProfile.PublishUrl}{packageProvider.UploadUrlPath}?remoteBuild=false&deployer=Octopus"; Log.Verbose($"Publishing {uploadZipPath} to {zipUploadUrl} and checking for deployment"); using var httpClient = new HttpClient(new HttpClientHandler @@ -311,7 +312,7 @@ private async Task UploadZipAndPollAsync(IAzureAccount azureAccount, //we have to create a new request message each time await using var fileStream = new FileStream(uploadZipPath, FileMode.Open, FileAccess.Read, FileShare.Read); using var streamContent = new StreamContent(fileStream); - streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/zip"); var uploadRequest = new HttpRequestMessage(HttpMethod.Post, zipUploadUrl) { diff --git a/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj b/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj index 581439b233..91d09b315b 100644 --- a/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj +++ b/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj @@ -12,8 +12,8 @@ true - - + + all