Skip to content

Commit 0295eb0

Browse files
committed
Merge pull request #240 from Azure/clu
Clu
2 parents fda6cdf + 8ae3c77 commit 0295eb0

File tree

69 files changed

+1203
-843
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1203
-843
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ app.config
2121
*.user
2222
*.sln.docstates
2323
*.lock.json
24+
launchSettings.json
2425
.vs/
2526
artifacts/
2627

build.proj

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
3+
44
<!--
55
Available Targets:
66
77
/t:Clean
88
Removes temporary build outputs.
9-
9+
1010
/t:Build
1111
Builds assemblies.
1212
@@ -17,14 +17,14 @@
1717
Code sign binaries, mainly for official release. Default is false.
1818
1919
/p:CodeSign=True;DelaySign=True
20-
Test the code sign workflow locally.
20+
Test the code sign workflow locally.
2121
2222
/p:Scope
2323
'ServiceManagement': service management
2424
'AzureStorage': storage data plane cmdlets
2525
'Subfolder under src\ResourceManager': An individual cmdlet module
2626
By default, it builds all
27-
-->
27+
-->
2828

2929
<!-- Define build properties -->
3030
<PropertyGroup>
@@ -47,13 +47,13 @@
4747
</PropertyGroup>
4848
<ItemGroup>
4949
<CmdletSolutionsToBuild Include=".\src\CLU.sln" Condition=" '$(Scope)' == 'all' "/>
50-
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
50+
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
5151
Condition=" '$(Scope)' != 'all' and '$(Scope)' != 'ServiceManagement' and '$(Scope)' != 'AzureStorage' "/>
5252
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
5353
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
5454
<SetupSln Include=".\setup\azurepowershell.sln" />
5555
</ItemGroup>
56-
56+
5757
<!--
5858
CI build related
5959
-->
@@ -67,10 +67,10 @@
6767
<UsingTask Condition=" $(OnPremiseBuild) " TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
6868
<Import Condition=" $(OnPremiseBuild) " Project="$(CIToolsPath)\Microsoft.WindowsAzure.Build.OnPremise.msbuild" />
6969

70-
<UsingTask
70+
<UsingTask
7171
AssemblyFile="$(MSBuildProjectDirectory)\src\packages\xunit.MSBuild.2.0.0.0\tools\xunit.runner.msbuild.dll"
7272
TaskName="Xunit.Runner.MSBuild.xunit" />
73-
73+
7474
<!-- Clean the build in all configurations -->
7575
<Target Name="Clean">
7676
<Message Importance="high" Text="Cleaning Cmdlets..." ContinueOnError="false" />
@@ -79,7 +79,7 @@
7979
Targets="Clean"
8080
Properties="Configuration=$(Configuration);Platform=Any CPU"
8181
ContinueOnError="false" />
82-
82+
8383
<!-- Delete the publish files -->
8484
<Message Importance="high" Text="Cleaning publish files..." ContinueOnError="false" />
8585
<ItemGroup>
@@ -104,14 +104,14 @@
104104
Directories="$(PackageDirectory)"
105105
ContinueOnError="false" />
106106
</Target>
107-
107+
108108
<PropertyGroup>
109109
<NuGetCommand>$(MSBuildProjectDirectory)\tools\NuGet.exe</NuGetCommand>
110110
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)\restore.config</NuGetRestoreConfigFile>
111111
<NuGetRestoreConfigSwitch>-ConfigFile &quot;$(NuGetRestoreConfigFile)&quot;</NuGetRestoreConfigSwitch>
112112
<PowerShellCommand>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellCommand>
113113
</PropertyGroup>
114-
114+
115115
<!--
116116
Force nuget package restore so that packages that include .targets files
117117
don't need to be checked into source control.
@@ -122,7 +122,7 @@
122122
<NuGetCache Include="$(LOCALAPPDATA)\NuGet\Cache\*.nupkg"/>
123123
</ItemGroup>
124124
<Delete Files="@(NuGetCache)" />-->
125-
125+
126126
<Delete Files="$(NuGetRestoreConfigFile)" />
127127
<WriteLinesToFile
128128
File="$(NuGetRestoreConfigFile)"
@@ -133,12 +133,12 @@
133133
<Exec Command="$(NuGetCommand) sources add -Name LocalFeed -Source &quot;$(MSBuildProjectDirectory)\tools\LocalFeed&quot; $(NuGetRestoreConfigSwitch)"/>
134134

135135
<!-- Restore packages -->
136-
<Exec Command="$(NuGetCommand) restore %(CmdletSolutionsToBuild.FullPath) $(NuGetRestoreConfigSwitch)"
136+
<Exec Command="$(NuGetCommand) restore %(CmdletSolutionsToBuild.FullPath) $(NuGetRestoreConfigSwitch)"
137137
ContinueOnError="false" />
138138

139139
<!--Restore the xunit runner needed to run unit tests-->
140140
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\packages.config -PackagesDirectory $(MSBuildProjectDirectory)\packages" />
141-
141+
142142
<Delete Files="$(NuGetRestoreConfigFile)" />
143143
</Target>
144144

@@ -153,45 +153,45 @@
153153
<_CLUProjects Include="$(CLURootDir)\**\project.json"
154154
Exclude="$(CLURootDir)\*.Test\project.json"></_CLUProjects>
155155
</ItemGroup>
156-
<Exec Command="dnu build" WorkingDirectory="%(_CLUProjects.RootDir)%(_CLUProjects.Directory)" />
157-
156+
<Exec Command="dnu build" WorkingDirectory="%(_CLUProjects.RootDir)%(_CLUProjects.Directory)" />
157+
158158
<!--<Message Importance="high" Text="Building Cmdlets..." />
159159
<MSBuild
160160
Projects="@(CmdletSolutionsToBuild)"
161161
Targets="Build"
162162
Properties="Configuration=$(Configuration);Platform=Any CPU"
163-
BuildInParallel="$(BuildInParallel)"
163+
BuildInParallel="$(BuildInParallel)"
164164
ContinueOnError="false" />
165-
165+
166166
<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />
167-
167+
168168
<Message Importance="high" Text="Building Setup..." />-->
169-
169+
170170
<!--<MSBuild
171171
Projects="@(SetupSln)"
172172
Targets="Build"
173173
Properties="Configuration=$(Configuration);Platform=Any CPU"
174-
ContinueOnError="false"
174+
ContinueOnError="false"
175175
Condition=" '$(Scope)' == 'all' "/>
176-
177-
<CallTarget Targets="CodeSignInstaller"
176+
177+
<CallTarget Targets="CodeSignInstaller"
178178
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" /> -->
179179
</Target>
180-
181-
<!--TODO: once CLU stablizes, see whether we need invoke 'clean' target.
180+
181+
<!--TODO: once CLU stablizes, see whether we need invoke 'clean' target.
182182
Dnx uses dynamic compilation, 'clean' is unnecessary -->
183183
<Target
184184
Name="Full"
185185
DependsOnTargets="Build;Test" />
186-
186+
187187
<Target Name="BuildMsBuildTask" DependsOnTargets="RestoreNugetPackages">
188188
<MSBuild Projects="$(LibraryToolsFolder)\BuildPackagesTask\Microsoft.Azure.Build.Tasks.csproj"
189189
Targets="Build" Properties="Configuration=Debug;Platform=AnyCPU" />
190190
</Target>
191-
191+
192192
<UsingTask TaskName="ValidateStrongNameSignatureTask" AssemblyFile="$(LibraryToolsFolder)\Microsoft.Azure.Build.Tasks.dll" />
193-
<UsingTask TaskName="FilterOutAutoRestLibraries" AssemblyFile="$(LibraryToolsFolder)\Microsoft.Azure.Build.Tasks.dll" />
194-
193+
<UsingTask TaskName="FilterOutAutoRestLibraries" AssemblyFile="$(LibraryToolsFolder)\Microsoft.Azure.Build.Tasks.dll" />
194+
195195
<Target Name="CodeSignBinaries">
196196
<PropertyGroup>
197197
<!--public token associated with MSSharedLibKey.snk-->
@@ -202,28 +202,28 @@
202202
</GetFrameworkSdkPath>
203203

204204
<!-- Copying shortcut to be signed -->
205-
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
205+
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
206206
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
207-
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
207+
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
208208
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
209-
209+
210210
<ItemGroup>
211211
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft*Azure*Commands*.dll" />
212212
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft.Azure.Common.Extensions.dll" />
213213
<ScriptsToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\*.ps1" />
214214
<ScriptsToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\*.psm1" />
215215
<ScriptsToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\*.ps1xml" />
216216
</ItemGroup>
217-
218-
<Message Importance="high" Text="$(LibrarySourceFolder)\Package\$(Configuration) does not contains any files to sign. Code sign will skip."
217+
218+
<Message Importance="high" Text="$(LibrarySourceFolder)\Package\$(Configuration) does not contains any files to sign. Code sign will skip."
219219
Condition="'@(DelaySignedAssembliesToSign)' == ''" />
220-
220+
221221
<ValidateStrongNameSignatureTask
222222
WindowsSdkPath="$(WindowsSdkPath)"
223223
Assembly="%(DelaySignedAssembliesToSign.Identity)"
224224
ExpectedTokenSignature="$(StrongNameToken)"
225225
ExpectedDelaySigned="true"
226-
ContinueOnError="false"
226+
ContinueOnError="false"
227227
Condition="'@(DelaySignedAssembliesToSign)' != ''"/>
228228

229229
<CodeSigningTask
@@ -236,7 +236,7 @@
236236
SigningLogPath="$(LibraryRoot)\signing.log"
237237
ToolsPath="$(CIToolsPath)"
238238
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
239-
239+
240240
<CodeSigningTask
241241
Description="Microsoft Azure PowerShell"
242242
Keywords="Microsoft Azure PowerShell"
@@ -246,23 +246,23 @@
246246
Certificates="10006"
247247
SigningLogPath="$(LibraryRoot)\signing-scripts.log"
248248
ToolsPath="$(CIToolsPath)"
249-
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>
249+
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>
250250

251251
<ValidateStrongNameSignatureTask
252252
WindowsSdkPath="$(WindowsSdkPath)"
253253
Assembly="%(DelaySignedAssembliesToSign.Identity)"
254254
ExpectedTokenSignature="$(StrongNameToken)"
255255
ExpectedDelaySigned="false"
256-
ContinueOnError="false"
256+
ContinueOnError="false"
257257
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
258-
258+
259259
<!-- Copying signed shortcut back -->
260-
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
260+
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
261261
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
262-
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
262+
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
263263
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
264264
</Target>
265-
265+
266266
<Target Name="CodeSignInstaller">
267267
<PropertyGroup>
268268
<!--public token associated with MSSharedLibKey.snk-->
@@ -275,8 +275,8 @@
275275
<ItemGroup>
276276
<InstallersToSign Include="$(LibraryRoot)\setup*\build\**\*.msi" />
277277
</ItemGroup>
278-
279-
<Message Importance="high" Text="$(LibraryRoot)\setup does not contains any installers to sign. Code sign will skip."
278+
279+
<Message Importance="high" Text="$(LibraryRoot)\setup does not contains any installers to sign. Code sign will skip."
280280
Condition="'@(InstallersToSign)' == ''" />
281281

282282
<CodeSigningTask
@@ -287,12 +287,12 @@
287287
SigningLogPath="$(LibraryRoot)\msi-signing.log"
288288
Certificates="10006"
289289
ToolsPath="$(CIToolsPath)"
290-
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>
291-
290+
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>
291+
292292
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
293293
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
294294
</Target>
295-
295+
296296
<!-- Publish all packages -->
297297
<Target Name="Publish">
298298
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
@@ -304,29 +304,28 @@
304304
<RunTestLive Condition="'$(RunTestLive)' == ''">false</RunTestLive>
305305
<XUnitIncludedTrait Condition="!$(RunTestLive)">AcceptanceType=CheckIn</XUnitIncludedTrait>
306306
</PropertyGroup>
307-
307+
308308
<!-- Note: all testing related target should go to 'AzurePowershell.test.targets' file except the one used by CI run -->
309309
<Import Project="$(MSBuildThisFileDirectory)AzurePowershell.test.targets"/>
310-
310+
311311
<!-- Run checkin tests for each pull request -->
312312
<Target Name="Test" DependsOnTargets="BeforeRunTests">
313313
<Message Importance="high" Text="Running check in tests..." />
314314
<ItemGroup>
315315
<!--Exclude 1 test projects still in progress with build failures-->
316-
<_CLUTestProjects Include="$(CLURootDir)\*.Test\project.json"
317-
Exclude="$(CLURootDir)\Microsoft.Azure.Commands.Resources.Test\project.json">
316+
<_CLUTestProjects Include="$(CLURootDir)\*.Test\project.json">
318317
</_CLUTestProjects>
319318
</ItemGroup>
320319
<Exec Command="dnu build" WorkingDirectory="%(_CLUTestProjects.RootDir)%(_CLUTestProjects.Directory)" />
321320
<Exec Command="dnx test" WorkingDirectory="%(_CLUTestProjects.RootDir)%(_CLUTestProjects.Directory)" />
322321
<!--<CallTarget Targets="InvokeXUnit"/>-->
323322
</Target>
324-
323+
325324
<!-- Run Full switch with scenario tests -->
326325
<Target
327326
Name="FullWithScenarioTests"
328327
DependsOnTargets="Clean;Build;Test;RunOneSDKCIT" />
329-
328+
330329
<!-- Run live tests and record mocks -->
331330
<Target
332331
Name="RunLiveTests"

examples/lib/helper.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
randomName() {
2+
echo "$1$RANDOM"
3+
}
4+
5+
export -f randomName

examples/lib/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Login
4+
echo "Executing Login..."
5+
export CmdletSessionId=1010
6+
azure account add --username $azureuser --password $azurepassword

examples/lib/testrunner.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
. setup.sh
3+
. helper.sh
4+
export resourceGroupName=`randomName testrg`
5+
export resourceGroupLocation="westus"
6+
7+
for d in $( ls .. --ignore=lib ); do
8+
for f in $( ls ../$d/*.sh ); do
9+
echo "running: $f"
10+
. $f
11+
done
12+
done
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Param(
2+
[string]$resourceGroupName,
3+
[string]$resourceGroupLocation
4+
)
5+
6+
Write-Host "=== Managing Resource Groups in Azure ==="
7+
8+
Write-Host "1. Create a new resource group"
9+
New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
10+
11+
Write-Host "2. Update group tags"
12+
Set-AzureRmResourceGroup -Name $resourceGroupName -Tags @{Name = "testtag"; Value = "testval"}
13+
14+
Write-Host "3. Get information about resource group"
15+
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName
16+
Write-Host $resourceGroup
17+
18+
Write-Host "4. List all resource groups in the subscription"
19+
Get-AzureRmResourceGroup
20+
21+
Write-Host "5. Remove resource group"
22+
Remove-AzureRmResourceGroup -Name $resourceGroupName -Force
23+
24+
Write-Host "6. Validations"
25+
Assert-AreEqual $resourceGroup.ResourceGroupName $resourceGroupName
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
printf "\n=== Managing Resource Groups in Azure ===\n"
4+
5+
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$resourceGroupName" "$resourceGroupLocation"
6+
azure resource group new --name "$resourceGroupName" --location "$resourceGroupLocation"
7+
8+
printf "\n2. Updating the group %s with tags.\n" "$resourceGroupName"
9+
azure resource group set --name "$resourceGroupName" --tags "[{\"Value\":\"testval\",\"Name\":\"testtag\"}]"
10+
11+
printf "\n3. Get information about resource group : %s.\n" "$resourceGroupName"
12+
resourceGroupInfo=`azure resource group get --name $resourceGroupName`
13+
printf "\nThe resource group info is: \n %s\n" "$resourceGroupInfo"
14+
15+
printf "\n4. Listing all resource groups in the subscription.\n"
16+
azure resource group get
17+
18+
printf "\n5. Removing resource group: %s.\n" "$resourceGroupName"
19+
azure resource group remove --name "$resourceGroupName" --force

src/CLU/Commands.Common.Authentication/Properties/launchSettings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)