Skip to content

Commit

Permalink
[release/9.0.1xx] WebSdk: new 'OneDeploy' publish method (#44038)
Browse files Browse the repository at this point in the history
  • Loading branch information
anvillan authored Oct 10, 2024
2 parents d05642e + c6b02fe commit dcde96a
Show file tree
Hide file tree
Showing 50 changed files with 3,322 additions and 224 deletions.
3 changes: 3 additions & 0 deletions sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PublishProfiles", "PublishP
src\WebSdk\Publish\Targets\PublishProfiles\DefaultMSDeploy.pubxml = src\WebSdk\Publish\Targets\PublishProfiles\DefaultMSDeploy.pubxml
src\WebSdk\Publish\Targets\PublishProfiles\DefaultMSDeployPackage.pubxml = src\WebSdk\Publish\Targets\PublishProfiles\DefaultMSDeployPackage.pubxml
src\WebSdk\Publish\Targets\PublishProfiles\DefaultZipDeploy.pubxml = src\WebSdk\Publish\Targets\PublishProfiles\DefaultZipDeploy.pubxml
src\WebSdk\Publish\Targets\PublishProfiles\DefaultOneDeploy.pubxml = src\WebSdk\Publish\Targets\PublishProfiles\DefaultOneDeploy.pubxml
src\WebSdk\Publish\Targets\PublishProfiles\DefaultWebJobOneDeploy.pubxml = src\WebSdk\Publish\Targets\PublishProfiles\DefaultWebJobOneDeploy.pubxml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PublishTargets", "PublishTargets", "{40E6E4B1-286B-4542-B814-2A3DA29510D1}"
Expand All @@ -221,6 +223,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PublishTargets", "PublishTa
src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets = src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets
src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets = src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets
src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.ZipDeploy.targets = src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.ZipDeploy.targets
src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.OneDeploy.targets = src\WebSdk\Publish\Targets\PublishTargets\Microsoft.NET.Sdk.Publish.OneDeploy.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TransformTargets", "TransformTargets", "{DFA91CC3-D6E4-45B7-AF6F-4385288886E4}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<Target Name="_PrepareForWebJobPublish">
<PropertyGroup>
<PublishDir>$(PublishIntermediateOutputPath)\app_data\Jobs\$(WebJobType)\$(WebJobName)\</PublishDir>
<PublishDir Condition="'$(WebPublishMethod)' == 'OneDeploy'">$(PublishIntermediateOutputPath)\</PublishDir>
<Configuration>$(PublishConfiguration)</Configuration>
</PropertyGroup>
</Target>
Expand Down
13 changes: 13 additions & 0 deletions src/WebSdk/Publish/Targets/PublishProfiles/DefaultOneDeploy.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>OneDeploy</WebPublishMethod>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishUrl></PublishUrl>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>OneDeploy</WebPublishMethod>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishUrl></PublishUrl>
<WebJobType></WebJobType>
<WebJobName></WebJobName>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!--
***********************************************************************************************
Microsoft.NET.Sdk.Publish.OneDeploy.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="OneDeploy" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />
<UsingTask TaskName="CreatePackageFile" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />
<UsingTask TaskName="GetPassword" AssemblyFile="$(_PublishTaskAssemblyFullPath)" />

<PropertyGroup>
<_DotNetPublishFiles>
OneDeploy;
</_DotNetPublishFiles>
</PropertyGroup>

<!--
***********************************************************************************************
TARGET : CreatePackageFile
***********************************************************************************************
-->

<Target Name="CreatePackageFile">
<MakeDir Directories="$(PublishIntermediateTempPath)"
Condition="!Exists('$(PublishIntermediateTempPath)')" />

<CreatePackageFile
ContentToPackage="$(PublishIntermediateOutputPath)"
ProjectName="$(MSBuildProjectName)"
IntermediateTempPath="$(PublishIntermediateTempPath)">
<Output TaskParameter="CreatedPackageFilePath" PropertyName="PackagedPublishContentsPath"/>
</CreatePackageFile>
</Target>

<!--
***********************************************************************************************
TARGET : OneDeploy
***********************************************************************************************
-->

<Target Name="OneDeploy" DependsOnTargets="CreatePackageFile">
<PropertyGroup>
<OneDeployUserAgent Condition="'$(VisualStudioVersion)' == ''">WebSdk</OneDeployUserAgent>
<OneDeployUserAgent Condition="'$(VisualStudioVersion)' != ''">WebSdk_VisualStudio_$(VisualStudioVersion)</OneDeployUserAgent>
</PropertyGroup>

<GetPassword
EncryptedPassword ="$(EncryptedPassword)"
Condition="'$(Password)' == '' And '$(IsGetPasswordEnabled)' == 'true'">
<Output TaskParameter="ClearPassword" PropertyName="Password"/>
</GetPassword>

<OneDeploy
FileToPublishPath="$(PackagedPublishContentsPath)"
PublishUrl="$(PublishUrl)"
Username="$(UserName)"
Password="$(Password)"
UserAgentVersion="$(OneDeployUserAgent)"
WebJobName="$(WebJobName)"
WebJobType="$(WebJobType)" />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,15 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<_UseAppHost Condition=" '$(_UseAppHost)' == '' Or '$(RuntimeIdentifier)' == '' ">false</_UseAppHost>
<_ExecutableExtension Condition=" '$(_ExecutableExtension)' == '' And $(RuntimeIdentifier.StartsWith('win')) ">.exe</_ExecutableExtension>
<_IsLinux Condition=" '$(IsLinux)' == 'True'">true</_IsLinux>
<_WebJobsDirectory>$(PublishIntermediateOutputPath)\app_data\Jobs\$(WebJobType)\$(WebJobName)\</_WebJobsDirectory>
<_WebJobsDirectory Condition="'$(WebPublishMethod)' == 'OneDeploy'">$(PublishIntermediateOutputPath)\</_WebJobsDirectory>
</PropertyGroup>

<GenerateRunCommandFile
Condition="'$(_IsWebJobProject)' == 'true' And '$(IsGenerateRunCommandFileDisabled)' != 'true'"
ProjectDirectory="$(MSBuildProjectDirectory)"
TargetPath="$(TargetPath)"
WebJobsDirectory="$(PublishIntermediateOutputPath)\app_data\Jobs\$(WebJobType)\$(WebJobName)\"
WebJobsDirectory="$(_WebJobsDirectory)"
UseAppHost="$(_UseAppHost)"
ExecutableExtension="$(_ExecutableExtension)"
IsLinux="$(_IsLinux)" />
Expand Down
8 changes: 8 additions & 0 deletions src/WebSdk/Publish/Tasks/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;

// Test assemblies
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: InternalsVisibleTo("Microsoft.NET.Sdk.Publish.Tasks.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
117 changes: 117 additions & 0 deletions src/WebSdk/Publish/Tasks/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions src/WebSdk/Publish/Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1203,4 +1203,53 @@ For more information on this deploy script visit: https://go.microsoft.com/fwlin
<value>The attempt to publish the ZIP file through '{0}' failed with HTTP status code '{1}'.</value>
<comment>{0} - URL to deploy zip, {1} - HTTP response code</comment>
</data>
<data name="ONEDEPLOY_FailedToRetrieveCredentials" xml:space="preserve">
<value>Failed to retrieve publish credentials.</value>
</data>
<data name="ONEDEPLOY_FileToPublish_NotFound" xml:space="preserve">
<value>File to publish &apos;{0}&apos; was not found or is not accessible.</value>
<comment>{0} - file to publish</comment>
</data>
<data name="ONEDEPLOY_InvalidPublishUrl" xml:space="preserve">
<value>PublishUrl &apos;{0}&apos; is missing or has an invalid value.</value>
<comment>{0} - publish URL</comment>
</data>
<data name="ONEDEPLOY_PublishingOneDeploy" xml:space="preserve">
<value>Publishing &apos;{0}&apos; to &apos;{1}&apos;...</value>
<comment>{0} - file to publish, {1} - publish URL</comment>
</data>
<data name="ONEDEPLOY_FailedDeployRequest" xml:space="preserve">
<value>OneDeploy attempt to publish file through &apos;{0}&apos; failed with HTTP status code &apos;{1}&apos;.</value>
<comment>{0} - publish URL, {1} - HTTP response status code</comment>
</data>
<data name="ONEDEPLOY_FailedDeployRequest_With_ResponseText" xml:space="preserve">
<value>OneDeploy attempt to publish file through &apos;{0}&apos; failed with HTTP status code &apos;{1}&apos;: {2}.</value>
<comment>{0} - publish URL, {1} - HTTP response status code, {2} - response body as text</comment>
</data>
<data name="ONEDEPLOY_Uploaded" xml:space="preserve">
<value>File &apos;{0}&apos; uploaded to target instance.</value>
<comment>{0} - file to publish.</comment>
</data>
<data name="ONEDEPLOY_Success" xml:space="preserve">
<value>OneDeploy deployment succeeded.</value>
</data>
<data name="ONEDEPLOY_FailedWithLogs" xml:space="preserve">
<value>OneDeploy attempt to publish file &apos;{0}&apos; through &apos;{1}&apos; failed with status code &apos;{2}&apos;. See the logs at &apos;{3}&apos;.</value>
<comment>{0} - file to publish, {1} - publish URL, {2} - deployment response status code, {3} - deployment logs URL</comment>
</data>
<data name="DeploymentStatus_Polling" xml:space="preserve">
<value>Polling for deployment status...</value>
</data>
<data name="DeploymentStatus_InvalidPollingUrl" xml:space="preserve">
<value>Deployment status URL &apos;{0}&apos; is missing or invalid</value>
<comment>{0} - deployment polling URL</comment>
</data>
<data name="DeploymentStatus" xml:space="preserve">
<value>Deployment status is &apos;{0}&apos;.</value>
<comment>{0} - deployment status name</comment>
</data>
<data name="DeploymentStatusWithText" xml:space="preserve">
<value>Deployment status is &apos;{0}&apos;: {1}</value>
<comment>{0} - deployment status name, {1} - deployment status text</comment>
</data>
</root>
Loading

0 comments on commit dcde96a

Please sign in to comment.