Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websites: Updating websites module to use the latest released .NET SDK version of websites #7127

Merged

Conversation

panchagnula
Copy link
Contributor

Description

Checklist

@panchagnula
Copy link
Contributor Author

CC: @Nking92 as well

@maddieclayton
Copy link
Contributor

maddieclayton commented Sep 4, 2018

@panchagnula If you are bumping the API version, you will need to rerecord all the tests.

Edit: see here for the two you need to rerecord: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/7143/artifact/src/Publish/TestResults/FailingTests/Microsoft.Azure.Commands.Websites.Test.dll.html

</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these new references as they are found in the common targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maddieclayton - we had to include this because during our SDK generation we found a bug with provisioning code polling code & we were asked to update the Microsoft.Rest.ClientRuntime version you can see the details here Azure/azure-sdk-for-net#4688

I am going to be adding this back since the common targets version is lower & is causing our Set AppServicePlan, test case to fail.

<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.7-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.12" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these two references

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Management.Storage" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Websites" version="1.7.1-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Websites" version="2.0.0" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.12" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the new references

@@ -55,7 +55,6 @@ public PSSite(Site other)
possibleOutboundIpAddresses: other.PossibleOutboundIpAddresses,
dailyMemoryTimeQuota: other.DailyMemoryTimeQuota,
suspendedTill:other.SuspendedTill,
snapshotInfo: other.SnapshotInfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being removed? Should the property be deprecated?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was defined in our APIs but never used for anything. It was removed in the newest API version. There's almost no chance that a customer had a dependency on this property, but we can deprecate it in whatever way is needed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing this further I think the real issue is this PSSite wrapper class is extending the SDK model. We could rewrite this class so it no longer extends the SDK model but still exposes all the same properties. We could also keep the SnapshotInfo property that way, although it'd always be empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maddieclayton wanted to make sure you agree with our plan to change the PSSite.cs wrapper to not extend the Site SDK model, we believe this will also fix our breaking changes comment you had raised as well. Let me know if you have other suggestions here.

Copy link
Contributor

@maddieclayton maddieclayton Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! You could also extend the SDK model but simply add back in the removed properties. Up to you.

Edit: Add back the removed properties as properties of specifically PSSite.

@@ -48,23 +48,23 @@ public class RestoreAzureWebAppSnapshot : WebAppOptionalSlotBaseCmdlet
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
Site targetApp = WebsitesClient.GetWebApp(ResourceGroupName, Name, Slot);
SnapshotRecoveryTarget target = new SnapshotRecoveryTarget()
Site sourceApp = WebsitesClient.GetWebApp(InputObject.ResourceGroupName, InputObject.Name, InputObject.Slot);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing these to InputObject.<>? Shouldn't this be using the parameters for retrieving the web app rather than the snapshot?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the API is different now. In previous API versions you would make a recovery request to the app where the snapshot was taken (the source app) and specify which app to restore the snapshot to (the target app) in the request body. The semantics have been switched around. Now you send a RestoreSnapshot request to the target app, and specify the source app inside the request body. The API was changed to fix some scenarios in ARM.

InputObject is the source snapshot, and the *Name parameters are for the target site name. I swapped the code around so the cmdlet will still work the same way it used to, but internally the API flow will be fixed. I hope this won't be considered a breaking change since as far as the end user is concerned, the cmdlet works the same way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me, thanks for the clarification. That will not be considered a breaking change.

<Reference Include="Microsoft.Azure.Management.Websites, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Websites.2.0.0\lib\net452\Microsoft.Azure.Management.Websites.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove new references, they will be found in common targets.

@maddieclayton
Copy link
Contributor

You also have a lot of breaking changes here: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/7143/artifact/src/Package/BreakingChangeIssues.csv/*view*/. You will need to mitigate that in PowerShell. You can do this by adding a PowerShell model wrapper that has all the original properties, and copies over the properties from the returned SDK type. You should add a deprecation message to any of these properties that you want to remove at the breaking change release in November.

@panchagnula
Copy link
Contributor Author

@maddieclayton regarding the breaking changes looking at our commandlets none of these properties are actually being used or referenced anywhere i tried to add the SnapshotInfo property to PSSite.cs, & also added PSAppServicePlan.cs for the AppServicePlanName, however these are not referenced anywhere. I think we can safely supress all these, however, i will defer to your folks judgement, though

@panchagnula panchagnula force-pushed the sisirap-previewSDK branch 2 times, most recently from aee0caf to a47c558 Compare September 8, 2018 00:14
@maddieclayton maddieclayton mentioned this pull request Sep 10, 2018
8 tasks
@cormacpayne
Copy link
Member

@panchagnula Hey Sisira, the build is failing after CredScan flagged a few files for containing potential passwords, secrets, keys, etc. You can find the results here: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/7363/artifact/src/Package/CredentialScannerOutput/CredScanIssues.csv

Would you mind taking a look at the files that were flagged and ensure that these are values that anyone else can use? (i.e., they are dummy values or have been deleted since the recording) If it turns out this is the case, we can suppress these exceptions (using the method outlined here).

@panchagnula
Copy link
Contributor Author

@Nking92 the cred scan alerts are from the backup & snapshot tests recordings - can you take a look & answer the question Cormac has here "Would you mind taking a look at the files that were flagged and ensure that these are values that anyone else can use? (i.e., they are dummy values or have been deleted since the recording) If it turns out this is the case, we can suppress these exceptions"

if these can be safely added to the list of exceptions to supress - please let me know & i can take care of it. If you cannot get to it today?

@maddieclayton
Copy link
Contributor

Marking as do not merge until the client runtime is bumped in preview. Will take a look at the PR soon.

exc3eed pushed a commit to exc3eed/azure-powershell that referenced this pull request Sep 12, 2018
@@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
/// this commandlet will let you get existing web app certificates using ARM APIs
/// </summary>
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppCertificate")]
[OutputType(typeof(Certificate))]
[OutputType(typeof(PSCertificate))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you didn't change the output below - unless CmdletHelpers.GetCertificates now returns a PSCertificate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots
/// this commandlet will let you get a new Azure Web app slot using ARM APIs
/// </summary>
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppSlot")]
[OutputType(typeof(Site))]
[OutputType(typeof(PSSite))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you didn't change the actual output here either - WebsitesClient.ListWebApps and WebsitesClient.GetWebApp should be wrapped in PSSite

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

using System.Management.Automation;

namespace Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots
{
/// <summary>
/// this commandlet will let you Start an Azure Web app slot
/// </summary>
[Cmdlet("Start", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppSlot"), OutputType(typeof(Site))]
[Cmdlet("Start", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppSlot"), OutputType(typeof(PSSite))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment on actual output

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -44,7 +44,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
/// <summary>
/// this commandlet will let you create a new Azure Web app using ARM APIs
/// </summary>
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebApp", DefaultParameterSetName = SimpleParameterSet, SupportsShouldProcess = true), OutputType(typeof(Site))]
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebApp", DefaultParameterSetName = SimpleParameterSet, SupportsShouldProcess = true), OutputType(typeof(PSSite))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about actual output

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


**Get-AzureRmAppServicePlan**
- Output type changed from ServerFarmWithRichSku to AppServicePlan
The following cmdlets were affected by this release:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you didn't add the upcoming breaking changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the recommendation here? Give we added the upcoming breaking change attribute to the property do we add the same list here as well? Or do we specify changing the return type to PSSite etc..?


**Set-AzureRmAppServicePlan**
- Output type changed from ServerFarmWithRichSku to AppServicePlan
## Release 6.0.0 - May 2018

**New-AzureRmAppServicePlan**
- Output type changed from ServerFarmWithRichSku to AppServicePlan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove changes to tools/AzureRM/AzureRM/psm1 below.

@maddieclayton
Copy link
Contributor

@panchagnula Looks good! I'll let you know when the clientruntime has been merged. Looks like all that needs to be done is to reenable the skipped test.

@maddieclayton
Copy link
Contributor

@panchagnula ClientRuntime PR has been merged! Please unskip the test now and fix the merge conflict.

Nicholas King and others added 6 commits September 13, 2018 13:52
…uild errors from breaking changes. Re-record backup tests.

Recording tests with the new SDK

Updating ChangeLog

Updating reference to latest websites version

Updating WebsitesClientExtension errors, when build using .NetCore

Adding recording for 2 missed tests & removing unneeded references as per PR feedback

Adding recording of test

FW: Adding recording, updating PSSite & adding some breaking changes to the list of supressed changes

Re-adding test recording

Adding client Runtime back so that the latest version is always used

Adding wrapper Models & adding support to handle breaking changes with new SDK

Adding the new packages to the package.config to get all tests to pass

Bug fixes, updating the return to match the output type, failing tests re-recorded

Adding DRTEndpoint parameter to PublishingProfile Commandlet

Updating to use the new Breaking change Attribute

Disabling one test for the time-being until common targets are updated to use the required client Runtime

Fixing all breaking changes & updating the CSV

Updating help for the newly added Switch Parameter to PublishingProfile commandlets

Fixing Singnature Issues

Help update

Supressing legitimate test recording cred scan issues for backup&restore tests
@maddieclayton maddieclayton changed the base branch from preview to release-2018-09-17 September 13, 2018 21:37
@maddieclayton maddieclayton merged commit 1f07dbd into Azure:release-2018-09-17 Sep 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants