-
Notifications
You must be signed in to change notification settings - Fork 4k
Service Fabric RP PowerShell #3783
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
Conversation
@chingchenmsft, |
Can one of the admins verify this patch? |
@azuresdki add to whitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingchenmsft a few initial comments before reviewing the cmdlets.
Also, in order for your tests to run, you will need to add a reference to your test dll to the following file
@@ -52,6 +52,9 @@ | |||
<Reference Include="Microsoft.Azure.Management.ResourceManager"> | |||
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.2.0-preview\lib\net45\Microsoft.Azure.Management.ResourceManager.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.Azure.Management.ServiceFabric"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingchenmsft why was this reference added? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# ProcessorArchitecture = '' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '2.5.0'; }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingchenmsft this will need to be version 2.8.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project> | ||
<Name>Commands.ResourceManager.Common</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\Profile\Commands.Profile\Commands.Profile.csproj"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingchenmsft why are you adding references to the Profile, Resources, and Tags projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i used a method in resource, and the resource need the other two to compile
In reply to: 111838392 [](ancestors = 111838392)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding references to other cmdlet projects is not allowed. There is a PR in the current stack that removes all of these for existing projects (#3734). Please ensure that you are using one of the common code libraries for accessing common features - this might mean moving some additional items into common code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i checked, Key Vault also referenced the method, can you help to abstract it to common ?
<None Include="ScenarioTests\TestServiceFabric.ps1"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="SessionRecords\Microsoft.Azure.Commands.ServiceFabric.Test.ScenarioTests.TestServiceFabric\TestAddAzureRmServiceFabricClientCertificate.json" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingchenmsft all of session record json files will need to have the <CopyToOutputDirectory>Always</CopyToOutputDirectory>
tag so that they can be copied and found during the build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general comments:
(1) Please regenerate the wxi file following the instructions here:
(2) Please add your test project to azure.powershell.test.targets in the repo root
(3) Please add in the documentation folder and changelog for your module directory, and please fill out the changelog entiry introducing your new cmdlets
(4) As discussed in review, generally you should allow piping between cmdlets by using a parameter set that takes ValueFromPipeline using your own types, rather than using ValueFromPipelineByPropertyName over all the properties. Normally, only ResourceGroupName and Name should be set up for ValueFromPipelineByPropertyName
(5) You need to implement ShouldProcess for all cmdlets that make changes. You can find a discussion of appropriate ShouldProcess implementation here: https://gist.github.com/markcowl/338e16fe5c8bbf195aff9f8af0db585d
# RootModule = '' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '1.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably start with '0.x.0', as I imagine your cmdlet surface area will be changing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to 0.1.0 , is this fine for our first version ?
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = SingleUpdateWithCommonNameSet, | ||
HelpMessage = "Client authentication type")] | ||
[ValidateNotNullOrEmpty()] | ||
public virtual bool IsAdmin { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not use boolean parameters. This should be a switch parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
HelpMessage = "Specify client certificate thumbprint and authentication type")] | ||
[ValidateNotNullOrEmpty()] | ||
[Alias("ThumbprintsAndAuthenticationTypes")] | ||
public Hashtable ThumbprintsAndTypes { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hashtable of thumbbprints and booleans? How about havein a parameter for admincertificatethumbprint that takes an array of certs and a parameter that takes non-admin certificate thumbprints? This hashtable strikes me as difficult to fire out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
|
||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "The sku name")] | ||
[ValidateNotNullOrEmpty()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there not a validateset for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can't be set, it depend on region availability
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "Tier")] | ||
[ValidateNotNullOrEmpty()] | ||
public string Tier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidateSet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can't be set, it depend on region availability
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "Specify Sku name of the node type")] | ||
[ValidateNotNullOrEmpty()] | ||
public string SkuName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, why not just Sku?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
|
||
namespace Microsoft.Azure.Commands.ServiceFabric.Commands | ||
{ | ||
[Cmdlet(VerbsData.Update, CmdletNoun.AzureRmServiceFabricReliability), OutputType(typeof(PSCluster))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SupportsShouldProcess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "VM instance number")] | ||
[ValidateNotNullOrEmpty()] | ||
public ReliabilityLevel ReliabilityLevel { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidateSet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is Enum, still need ValidateSet?
HelpMessage = "The number of nodes to add")] | ||
[ValidateNotNullOrEmpty()] | ||
[Alias("NumberOfNodesToAdd")] | ||
public virtual int Number { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you may want a ValidateRange, not a ValidateNotNullOrEmpty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "Node type name")] | ||
public string NodeTypeName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node Type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@chingchenmsft There are credscan matches causing the build to fail, you can find these summarized here: http://azuresdkci.cloudapp.net/job/powershell/8321/artifact/src/Package/credscan-filtered.tsv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to resolve the credscan issues identified here: http://azuresdkci.cloudapp.net/job/powershell/8321/artifact/src/Package/credscan-filtered.tsv
Also, it looks like you didn't add a changelog.md for your new RP, please add a changelog, and put details on the current release in the 'Current Release' section. The changelog format is as here: https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Cdn/ChangeLog.md, you only need the Current Release section
removed the cred, and add changelog.md |
on demand run here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1493/ signing run here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-sign/993/ LGTM once this passes |
on demand (including new changes): http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1504/ signing (including new changes): http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-sign/996/ |
Talked with Cormac, we agreed the dependencies are acceptabel for now
Description
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
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines