Skip to content

Support soft-delete feature in storge dataplane cmdlet #5457

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

Merged
merged 1 commit into from
Mar 5, 2018

Conversation

blueww
Copy link
Member

@blueww blueww commented Feb 6, 2018

Description

To support Soft-delete feature. Design has been reviewed in https://github.com/Azure/azure-powershell-pr/wiki/Azure-Storage-Blob-Soft-Delete

The PR is used to add softdelete feature.

Since I will be OOF from 2/7-2/12 and 2/15-2/21. Please help to review and give comments before 2/12, so I can fix the issues and upgrade to official package in 2/13-14, to make the change in next release which has code complete in 2/16.
And @markcowl has agreed to fix the upgrade issue of "Newtonsoft.Json" 10.0 before 2/12, or the PR won't pass check.


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@blueww blueww force-pushed the softdelete branch 2 times, most recently from a3df663 to 0658761 Compare February 6, 2018 11:50
@blueww blueww changed the title [Do not merge] Support soft-delete feature in storge dataplane cmdlet Support soft-delete feature in storge dataplane cmdlet Feb 13, 2018
@blueww
Copy link
Member Author

blueww commented Feb 13, 2018

/// </summary>
[Cmdlet(VerbsLifecycle.Disable, StorageNouns.ServiceDeleteRetentionPolicy, SupportsShouldProcess = true),
OutputType(typeof(PSDeleteRetentionPolicy))]
public class DisableAzureStorageServiceDeleteRetentionPolicyCommand : StorageCloudBlobCmdletBase
Copy link
Member

Choose a reason for hiding this comment

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

I think the comm and name should be shorter: Disable-AzureStorageSoftDelete

Copy link
Member Author

Choose a reason for hiding this comment

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

@markcowl
The name of the cmdlets Enable/Disable-AzureStorageServiceDeleteRetentionPolicy are reviewed and raised from your team, and feature team also agreed for that.
The current name is aligned with the rest and XSCL API, so customer who have looked into rest doc might can find it more easily.

Do you really want to change it?

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed with Mark, the alias for the cmdlets is added: Disable-AzureStorageSoftDelete

/// </summary>
[Cmdlet(VerbsLifecycle.Enable, StorageNouns.ServiceDeleteRetentionPolicy, SupportsShouldProcess = true),
OutputType(typeof(PSDeleteRetentionPolicy))]
public class EnableAzureStorageServiceDeleteRetentionPolicyCommand : StorageCloudBlobCmdletBase
Copy link
Member

Choose a reason for hiding this comment

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

Enable-AzureStorageSoftDelete

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed with Mark, the alias for the cmdlets is added: Enable-AzureStorageSoftDelete

</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

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

This will have to wait until our runtime change is in. ETA is next week, which means this will likely not make it in for this release.

Copy link
Member Author

Choose a reason for hiding this comment

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

See, waiting for your fix.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's fixed

<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.7.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Storage.DataMovement.0.7.1\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

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

Same comment

Copy link
Member Author

Choose a reason for hiding this comment

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

See, waiting for your fix.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's fixed

@cormacpayne
Copy link
Member

@@ -280,6 +280,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Copy link
Member Author

Choose a reason for hiding this comment

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

Need remove this line, or build will fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will raise a commit to remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Add it back since the app.config already check in.

Copy link
Member Author

Choose a reason for hiding this comment

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

The fix is merged, please help to review and merge this PR.

@blueww
Copy link
Member Author

blueww commented Feb 14, 2018

@markcowl , @cormacpayne
[resolved] The build also fail since test case in Microsoft.WindowsAzure.Management.Storage.Test.Common.Cmdlet.StorageContextDisconnectedTests failed with following error.
It's caused by the 'Newtonsoft.Json‘ version conflict between Commands.Storage.Test and Commands.Common.Authentication. Please help to resolve it. Thanks!

Result Message: System.IO.FileLoadException : Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

@cormacpayne
Copy link
Member

@blueww Hey Wei, is there a reason why you removed the app.config file? The build was passing before it was removed, and it is necessary for your test project so the tests use the 10.0.3 version of Newtonsoft.Json instead of 6.0.8 (or any other version in between).

@blueww
Copy link
Member Author

blueww commented Feb 23, 2018

@cormacpayne
The app.config file will not be check in before, so need to remove it in csproj file to avoid build fail. Just notice you have checked in the app.config file, so it's OK to add it. I have reverted my change of removing it.

@blueww
Copy link
Member Author

blueww commented Feb 23, 2018

@blueww
Copy link
Member Author

blueww commented Mar 1, 2018

@blueww
Copy link
Member Author

blueww commented Mar 1, 2018

@markcowl , @cormacpayne
As the #5599 is merged for 'Newtonsoft.Json‘ upgrade issue , I have rebased the softdelete PR on latest code.
I have also relaunch the on-demand test.

If no other comments, please help to merge the PR when the test passed.

@@ -27,4 +27,4 @@
if (Test-Path "$PSScriptRoot\..\NewAssemblies")
{
Copy link
Member

Choose a reason for hiding this comment

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

Please revert any change to this file

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -3,4 +3,4 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="7.1.0-preview" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="8.1.1" targetFramework="net452" />
</packages>
Copy link
Member

Choose a reason for hiding this comment

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

revert

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -3,4 +3,4 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="7.1.0-preview" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="8.1.1" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

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

You will need to update the version here as well

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -14,14 +15,14 @@ Lists blobs in a container.

### BlobName (Default)
```
Get-AzureStorageBlob [[-Blob] <String>] [-Container] <String> [-MaxCount <Int32>]
Get-AzureStorageBlob [[-Blob] <String>] [-Container] <String> [-IncludeDeleted] [-MaxCount <Int32>]
Copy link
Member

Choose a reason for hiding this comment

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

Please include output in the examples (the updated output)

Copy link
Member Author

Choose a reason for hiding this comment

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

The output added to example. Please check.

@markcowl markcowl assigned blueww and unassigned cormacpayne Mar 2, 2018
@blueww blueww assigned markcowl and cormacpayne and unassigned blueww Mar 2, 2018
@blueww blueww force-pushed the softdelete branch 3 times, most recently from 5688c9b to ebdf43c Compare March 2, 2018 06:56
@blueww
Copy link
Member Author

blueww commented Mar 2, 2018

@markcowl

I have resolved all your comments. Since there are some revert fix, I merged the commits into 1 commit.
The on-demand on latest code can be found in : https://azuresdkci.westus2.cloudapp.azure.com/job/powershell-demand/537

@blueww blueww force-pushed the softdelete branch 2 times, most recently from 8348515 to fe8b7c9 Compare March 2, 2018 08:49
@cormacpayne
Copy link
Member

@cormacpayne
Copy link
Member

Tested the signed bits and confirmed that

  • both Newtonsoft.Json 6.0.8 and 10.0.3 are loaded
  • AzureRM.Storage and Azure.Storage cmdlets can be used in the same sessions

@cormacpayne cormacpayne merged commit a186cdc into Azure:preview Mar 5, 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