-
Notifications
You must be signed in to change notification settings - Fork 4k
Apply azure container instance SDK 2017-10-01 #5020
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
@azuresdkci test this please |
@yolo3301 would you mind resolving the merge conflicts? |
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.
@@ -12,7 +12,7 @@ | |||
# RootModule = '' | |||
|
|||
# Version number of this module. | |||
ModuleVersion = '0.1.0' | |||
ModuleVersion = '0.1.1' |
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.
@yolo3301 you can revert any change made to versions in this PR. We will handle the versioning before publishing the module
@@ -19,6 +19,12 @@ | |||
--> | |||
## Current Release | |||
|
|||
## Version 0.1.1 |
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.
@yolo3301 please remove the ## Version 0.1.1
header and move the below content to be under ## Current Release
@@ -32,5 +32,5 @@ | |||
// You can specify all the values or you can default the Build and Revision Numbers | |||
// by using the '*' as shown below: | |||
// [assembly: AssemblyVersion("1.0.*")] | |||
[assembly: AssemblyVersion("0.1.0")] | |||
[assembly: AssemblyFileVersion("0.1.0")] | |||
[assembly: AssemblyVersion("0.1.1")] |
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.
@yolo3301 please revert the changes made in this file
[ValidateNotNullOrEmpty] | ||
public int? Port { get; set; } | ||
public int[] Ports { 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.
@yolo3301 why was this change made?
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.
We support multiple ports. In Azure CLI we have already made a similar change.
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.
@yolo3301 from PowerShell's Strongly Encouraged Development Guidelines (the snippet can be found here), parameter names should be singular unless there is validation for the parameter preventing the user from passing only one object. If a user can pass just one port, then this parameter should be public int[] Port
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.
Good to know. Updated.
@@ -32,5 +32,5 @@ | |||
// You can specify all the values or you can default the Build and Revision Numbers | |||
// by using the '*' as shown below: | |||
// [assembly: AssemblyVersion("1.0.*")] | |||
[assembly: AssemblyVersion("0.1.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.
@yolo3301 please revert the changes made in this file
## PARAMETERS | ||
|
||
### -AzureFileVolumeAccountKey | ||
The storage account key of the Azure File share to mount.```yaml |
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.
@yolo3301 please make sure that the trailing ```yaml
string is moved to a line by itself. This applies to all markdown files that have been edited in this file. This is caused from a bug in the platyPS
module.
tools/AzureRM/AzureRM.psd1
Outdated
@@ -65,7 +65,7 @@ RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; RequiredVersion = '4.0.0'; | |||
@{ModuleName = 'AzureRM.CognitiveServices'; RequiredVersion = '0.9.0'; }, | |||
@{ModuleName = 'AzureRM.Compute'; RequiredVersion = '4.0.1'; }, | |||
@{ModuleName = 'AzureRM.Consumption'; RequiredVersion = '0.3.0'; }, | |||
@{ModuleName = 'AzureRM.ContainerInstance'; RequiredVersion = '0.1.0'; }, | |||
@{ModuleName = 'AzureRM.ContainerInstance'; RequiredVersion = '0.1.1'; }, |
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.
@yolo3301 please revert the change made in this file
@cormacpayne Created a simple review page |
Page for cmdlet review can now be found here: https://github.com/Azure/azure-powershell-pr/wiki/Apply-azure-container-instance-SDK-2017-10-01 |
@azuresdkci test this please |
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 initial comments
@@ -23,17 +23,22 @@ function Test-AzureRmContainerGroup | |||
$location = Get-ProviderLocation "Microsoft.ContainerInstance/ContainerGroups" | |||
$image = "nginx" | |||
$osType = "Linux" |
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.
Please add a test for the new parameter 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.
Will the session recording expose storage account key used for volume?
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.
Yes - Can you create a test storage account and delete it at the end of the test? This should prevent any security issues caused by exposing the account key.
@@ -46,6 +47,12 @@ public class NewAzureContainerGroupCommand : ContainerInstanceCmdletBase | |||
ParameterSetName = CreateContainerGroupWithRegistryParamSet, | |||
ValueFromPipelineByPropertyName = true, | |||
HelpMessage = "The resource group name.")] | |||
[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.
If a parameter is in all sets, and Mandatory and in the same position, you don't need to have a separate attribute for each parameter set. Please erase all parameter attributes and put in:
[Parameter(
Mandatory = true,
Position = 0,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name.")]
Apply this all other parameters also. Especially if you plan to add more parameter sets in the future, there is no need to create a new attribute each time.
@@ -149,6 +177,34 @@ public class NewAzureContainerGroupCommand : ContainerInstanceCmdletBase | |||
[ValidateNotNullOrEmpty] | |||
public PSCredential RegistryCredential { get; set; } | |||
|
|||
[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.
Quick recommendation: move these parameters above all of the non-mandatory parameters so that the users will see them more quickly when scanning help.
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.
But these are only mandatory for this parameter set. Should I still do the same?
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.
Yes, they are not in the other parameter sets, so it won't affect those other parameter sets.
ParameterSetName = CreateContainerGroupWithAzureFileVolumeParamSet, | ||
HelpMessage = "The storage account key of the Azure File share to mount.")] | ||
[ValidateNotNullOrEmpty] | ||
public PSCredential AzureFileVolumeAccountKey { 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.
Is account key the correct name for this parameter? I wouldn't usually consider a PSCredential to be a "key". Please correct me if I am wrong.
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.
That's what I would consider a PSCredential to be - it requires both a username and password, so "key" seems like the wrong name.
@@ -62,7 +62,12 @@ public class PSContainer | |||
/// <summary> | |||
/// Gets or sets the events. | |||
/// </summary> | |||
public IList<PSContainerEvent> Events { 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.
Is the change from PSContainerEvent to PSEvent an unrelated change? Just want to make sure I understand the scope of the changes.
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.
Previously an event belongs to a container. Now an event can also belong to the container group. Simply keep up with sdk.
/// <summary> | ||
/// Gets or sets the state of the container group. | ||
/// </summary> | ||
public string State { 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 here. Is this just to keep up to date with the current SDK?
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.
Yes.
``` | ||
|
||
This commands creates a container group using a custom image from a custom container image registry. | ||
|
||
### Example 6: Creates a container group that mounts Azure File volume |
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.
Awesome examples! Thanks 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.
Two more small things.
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="SessionRecords\Microsoft.Azure.Commands.ContainerInstance.Test.ScenarioTests.ContainerInstanceTests\TestContainerInstanceLog.json"> | ||
<None Include="SessionRecords\Microsoft.Azure.Commands.ContainerInstance.Test.ScenarioTests.ContainerInstanceTests\*"> |
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.
Can you add these tests separately? We generally like to stay away from using *
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.
Sure. Just curious why?
Position = 2, | ||
HelpMessage = "The container image.")] | ||
[ValidateNotNullOrEmpty] | ||
public string Image { 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.
Image previously was not a named parameter - was this addition intentional? If so, that is okay, I just want to ensure that the change was intended.
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.
Yes.
@azuresdkci test this please |
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