Skip to content

Clu #240

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 26 commits into from
Dec 11, 2015
Merged

Clu #240

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5b2b430
Referenced latest version of Resources and Authorization SDK packages.
Dec 8, 2015
bd56433
Changed gitignore to ignore launchSettings.json
Dec 8, 2015
db85975
Fixed 85% of test failures in Resources tests.
Dec 9, 2015
bd93010
Merge branch 'NewMamls' of github.com:hovsepm/azure-powershell into h…
Dec 9, 2015
f556d85
Resolved build errors in Resource Tests
Dec 9, 2015
74dd3c0
Fixed Resource Mocked tests.
Dec 10, 2015
1902b9f
Support aliases for ValueFromPipelineByPropertyName parameters.
johanste Dec 10, 2015
7ec982f
script to setup CLU environment
yugangw-msft Dec 10, 2015
e6ea96a
remove setlocal so environment variable values change can be propagated
yugangw-msft Dec 10, 2015
b6f7bfb
Merge pull request #1461 from johanste/clu
markcowl Dec 10, 2015
1e8635f
Update build drop script to allow specifying which command packages t…
johanste Dec 10, 2015
63b40b8
* Fixed azure account output message
Dec 10, 2015
9788489
Merge pull request #1468 from johanste/clu
yugangw-msft Dec 10, 2015
6bede14
Merge pull request #1470 from hovsepm/clu
yugangw-msft Dec 10, 2015
ef34fa4
merge with johan's change in the latest clu branch
yugangw-msft Dec 10, 2015
5024c50
Fixed last test in Resource.Test
Dec 10, 2015
4050653
Merge branch 'clu' into cluscript
yugangw-msft Dec 10, 2015
e2ffb12
Merge branch 'clu' of github.com:Azure/azure-powershell into hovsep-clu
Dec 10, 2015
1e15710
Removed Resources.Designer.cs from resources.test project
Dec 10, 2015
4108f1f
prepare osx/linux bits which can xcopy and execute
yugangw-msft Dec 10, 2015
9ee382e
Fixed failing tests
Dec 11, 2015
82afd42
Merge pull request #1465 from yugangw-msft/cluscript
yugangw-msft Dec 11, 2015
42fa8a9
Merge pull request #1459 from haocs/hovsep-clu
markcowl Dec 11, 2015
f82a97e
added bash and posh examples for resource group management
stankovski Dec 11, 2015
8582ae1
added a helper script
stankovski Dec 11, 2015
8ae3c77
Merge pull request #1473 from stankovski/clu
stankovski Dec 11, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ app.config
*.user
*.sln.docstates
*.lock.json
launchSettings.json
.vs/
artifacts/

Expand Down
107 changes: 53 additions & 54 deletions build.proj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
Available Targets:

/t:Clean
Removes temporary build outputs.

/t:Build
Builds assemblies.

Expand All @@ -17,14 +17,14 @@
Code sign binaries, mainly for official release. Default is false.

/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally.
Test the code sign workflow locally.

/p:Scope
'ServiceManagement': service management
'AzureStorage': storage data plane cmdlets
'Subfolder under src\ResourceManager': An individual cmdlet module
By default, it builds all
-->
-->

<!-- Define build properties -->
<PropertyGroup>
Expand All @@ -47,13 +47,13 @@
</PropertyGroup>
<ItemGroup>
<CmdletSolutionsToBuild Include=".\src\CLU.sln" Condition=" '$(Scope)' == 'all' "/>
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
Condition=" '$(Scope)' != 'all' and '$(Scope)' != 'ServiceManagement' and '$(Scope)' != 'AzureStorage' "/>
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
<SetupSln Include=".\setup\azurepowershell.sln" />
</ItemGroup>

<!--
CI build related
-->
Expand All @@ -67,10 +67,10 @@
<UsingTask Condition=" $(OnPremiseBuild) " TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
<Import Condition=" $(OnPremiseBuild) " Project="$(CIToolsPath)\Microsoft.WindowsAzure.Build.OnPremise.msbuild" />

<UsingTask
<UsingTask
AssemblyFile="$(MSBuildProjectDirectory)\src\packages\xunit.MSBuild.2.0.0.0\tools\xunit.runner.msbuild.dll"
TaskName="Xunit.Runner.MSBuild.xunit" />

<!-- Clean the build in all configurations -->
<Target Name="Clean">
<Message Importance="high" Text="Cleaning Cmdlets..." ContinueOnError="false" />
Expand All @@ -79,7 +79,7 @@
Targets="Clean"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />

<!-- Delete the publish files -->
<Message Importance="high" Text="Cleaning publish files..." ContinueOnError="false" />
<ItemGroup>
Expand All @@ -104,14 +104,14 @@
Directories="$(PackageDirectory)"
ContinueOnError="false" />
</Target>

<PropertyGroup>
<NuGetCommand>$(MSBuildProjectDirectory)\tools\NuGet.exe</NuGetCommand>
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)\restore.config</NuGetRestoreConfigFile>
<NuGetRestoreConfigSwitch>-ConfigFile &quot;$(NuGetRestoreConfigFile)&quot;</NuGetRestoreConfigSwitch>
<PowerShellCommand>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellCommand>
</PropertyGroup>

<!--
Force nuget package restore so that packages that include .targets files
don't need to be checked into source control.
Expand All @@ -122,7 +122,7 @@
<NuGetCache Include="$(LOCALAPPDATA)\NuGet\Cache\*.nupkg"/>
</ItemGroup>
<Delete Files="@(NuGetCache)" />-->

<Delete Files="$(NuGetRestoreConfigFile)" />
<WriteLinesToFile
File="$(NuGetRestoreConfigFile)"
Expand All @@ -133,12 +133,12 @@
<Exec Command="$(NuGetCommand) sources add -Name LocalFeed -Source &quot;$(MSBuildProjectDirectory)\tools\LocalFeed&quot; $(NuGetRestoreConfigSwitch)"/>

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

<!--Restore the xunit runner needed to run unit tests-->
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\packages.config -PackagesDirectory $(MSBuildProjectDirectory)\packages" />

<Delete Files="$(NuGetRestoreConfigFile)" />
</Target>

Expand All @@ -153,45 +153,45 @@
<_CLUProjects Include="$(CLURootDir)\**\project.json"
Exclude="$(CLURootDir)\*.Test\project.json"></_CLUProjects>
</ItemGroup>
<Exec Command="dnu build" WorkingDirectory="%(_CLUProjects.RootDir)%(_CLUProjects.Directory)" />
<Exec Command="dnu build" WorkingDirectory="%(_CLUProjects.RootDir)%(_CLUProjects.Directory)" />

<!--<Message Importance="high" Text="Building Cmdlets..." />
<MSBuild
Projects="@(CmdletSolutionsToBuild)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
BuildInParallel="$(BuildInParallel)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />

<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />

<Message Importance="high" Text="Building Setup..." />-->

<!--<MSBuild
Projects="@(SetupSln)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false"
ContinueOnError="false"
Condition=" '$(Scope)' == 'all' "/>
<CallTarget Targets="CodeSignInstaller"

<CallTarget Targets="CodeSignInstaller"
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" /> -->
</Target>
<!--TODO: once CLU stablizes, see whether we need invoke 'clean' target.

<!--TODO: once CLU stablizes, see whether we need invoke 'clean' target.
Dnx uses dynamic compilation, 'clean' is unnecessary -->
<Target
Name="Full"
DependsOnTargets="Build;Test" />

<Target Name="BuildMsBuildTask" DependsOnTargets="RestoreNugetPackages">
<MSBuild Projects="$(LibraryToolsFolder)\BuildPackagesTask\Microsoft.Azure.Build.Tasks.csproj"
Targets="Build" Properties="Configuration=Debug;Platform=AnyCPU" />
</Target>

<UsingTask TaskName="ValidateStrongNameSignatureTask" AssemblyFile="$(LibraryToolsFolder)\Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="FilterOutAutoRestLibraries" AssemblyFile="$(LibraryToolsFolder)\Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="FilterOutAutoRestLibraries" AssemblyFile="$(LibraryToolsFolder)\Microsoft.Azure.Build.Tasks.dll" />

<Target Name="CodeSignBinaries">
<PropertyGroup>
<!--public token associated with MSSharedLibKey.snk-->
Expand All @@ -202,28 +202,28 @@
</GetFrameworkSdkPath>

<!-- Copying shortcut to be signed -->
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />

<ItemGroup>
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft*Azure*Commands*.dll" />
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft.Azure.Common.Extensions.dll" />
<ScriptsToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\*.ps1" />
<ScriptsToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\*.psm1" />
<ScriptsToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\*.ps1xml" />
</ItemGroup>
<Message Importance="high" Text="$(LibrarySourceFolder)\Package\$(Configuration) does not contains any files to sign. Code sign will skip."

<Message Importance="high" Text="$(LibrarySourceFolder)\Package\$(Configuration) does not contains any files to sign. Code sign will skip."
Condition="'@(DelaySignedAssembliesToSign)' == ''" />

<ValidateStrongNameSignatureTask
WindowsSdkPath="$(WindowsSdkPath)"
Assembly="%(DelaySignedAssembliesToSign.Identity)"
ExpectedTokenSignature="$(StrongNameToken)"
ExpectedDelaySigned="true"
ContinueOnError="false"
ContinueOnError="false"
Condition="'@(DelaySignedAssembliesToSign)' != ''"/>

<CodeSigningTask
Expand All @@ -236,7 +236,7 @@
SigningLogPath="$(LibraryRoot)\signing.log"
ToolsPath="$(CIToolsPath)"
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>

<CodeSigningTask
Description="Microsoft Azure PowerShell"
Keywords="Microsoft Azure PowerShell"
Expand All @@ -246,23 +246,23 @@
Certificates="10006"
SigningLogPath="$(LibraryRoot)\signing-scripts.log"
ToolsPath="$(CIToolsPath)"
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>

<ValidateStrongNameSignatureTask
WindowsSdkPath="$(WindowsSdkPath)"
Assembly="%(DelaySignedAssembliesToSign.Identity)"
ExpectedTokenSignature="$(StrongNameToken)"
ExpectedDelaySigned="false"
ContinueOnError="false"
ContinueOnError="false"
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>

<!-- Copying signed shortcut back -->
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
</Target>

<Target Name="CodeSignInstaller">
<PropertyGroup>
<!--public token associated with MSSharedLibKey.snk-->
Expand All @@ -275,8 +275,8 @@
<ItemGroup>
<InstallersToSign Include="$(LibraryRoot)\setup*\build\**\*.msi" />
</ItemGroup>
<Message Importance="high" Text="$(LibraryRoot)\setup does not contains any installers to sign. Code sign will skip."

<Message Importance="high" Text="$(LibraryRoot)\setup does not contains any installers to sign. Code sign will skip."
Condition="'@(InstallersToSign)' == ''" />

<CodeSigningTask
Expand All @@ -287,12 +287,12 @@
SigningLogPath="$(LibraryRoot)\msi-signing.log"
Certificates="10006"
ToolsPath="$(CIToolsPath)"
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>

<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
</Target>

<!-- Publish all packages -->
<Target Name="Publish">
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
Expand All @@ -304,29 +304,28 @@
<RunTestLive Condition="'$(RunTestLive)' == ''">false</RunTestLive>
<XUnitIncludedTrait Condition="!$(RunTestLive)">AcceptanceType=CheckIn</XUnitIncludedTrait>
</PropertyGroup>

<!-- Note: all testing related target should go to 'AzurePowershell.test.targets' file except the one used by CI run -->
<Import Project="$(MSBuildThisFileDirectory)AzurePowershell.test.targets"/>

<!-- Run checkin tests for each pull request -->
<Target Name="Test" DependsOnTargets="BeforeRunTests">
<Message Importance="high" Text="Running check in tests..." />
<ItemGroup>
<!--Exclude 1 test projects still in progress with build failures-->
<_CLUTestProjects Include="$(CLURootDir)\*.Test\project.json"
Exclude="$(CLURootDir)\Microsoft.Azure.Commands.Resources.Test\project.json">
<_CLUTestProjects Include="$(CLURootDir)\*.Test\project.json">
</_CLUTestProjects>
</ItemGroup>
<Exec Command="dnu build" WorkingDirectory="%(_CLUTestProjects.RootDir)%(_CLUTestProjects.Directory)" />
<Exec Command="dnx test" WorkingDirectory="%(_CLUTestProjects.RootDir)%(_CLUTestProjects.Directory)" />
<!--<CallTarget Targets="InvokeXUnit"/>-->
</Target>

<!-- Run Full switch with scenario tests -->
<Target
Name="FullWithScenarioTests"
DependsOnTargets="Clean;Build;Test;RunOneSDKCIT" />

<!-- Run live tests and record mocks -->
<Target
Name="RunLiveTests"
Expand Down
5 changes: 5 additions & 0 deletions examples/lib/helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
randomName() {
echo "$1$RANDOM"
}

export -f randomName
6 changes: 6 additions & 0 deletions examples/lib/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# Login
echo "Executing Login..."
export CmdletSessionId=1010
azure account add --username $azureuser --password $azurepassword
12 changes: 12 additions & 0 deletions examples/lib/testrunner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
. setup.sh
. helper.sh
export resourceGroupName=`randomName testrg`
export resourceGroupLocation="westus"

for d in $( ls .. --ignore=lib ); do
for f in $( ls ../$d/*.sh ); do
echo "running: $f"
. $f
done
done
25 changes: 25 additions & 0 deletions examples/resource-management/01-ResourceGroups.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Param(
[string]$resourceGroupName,
[string]$resourceGroupLocation
)

Write-Host "=== Managing Resource Groups in Azure ==="

Write-Host "1. Create a new resource group"
New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation

Write-Host "2. Update group tags"
Set-AzureRmResourceGroup -Name $resourceGroupName -Tags @{Name = "testtag"; Value = "testval"}

Write-Host "3. Get information about resource group"
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName
Write-Host $resourceGroup

Write-Host "4. List all resource groups in the subscription"
Get-AzureRmResourceGroup

Write-Host "5. Remove resource group"
Remove-AzureRmResourceGroup -Name $resourceGroupName -Force

Write-Host "6. Validations"
Assert-AreEqual $resourceGroup.ResourceGroupName $resourceGroupName
19 changes: 19 additions & 0 deletions examples/resource-management/01-ResourceGroups.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

printf "\n=== Managing Resource Groups in Azure ===\n"

printf "\n1. Creating a new resource group: %s and location: %s.\n" "$resourceGroupName" "$resourceGroupLocation"
azure resource group new --name "$resourceGroupName" --location "$resourceGroupLocation"

printf "\n2. Updating the group %s with tags.\n" "$resourceGroupName"
azure resource group set --name "$resourceGroupName" --tags "[{\"Value\":\"testval\",\"Name\":\"testtag\"}]"

printf "\n3. Get information about resource group : %s.\n" "$resourceGroupName"
resourceGroupInfo=`azure resource group get --name $resourceGroupName`
printf "\nThe resource group info is: \n %s\n" "$resourceGroupInfo"

printf "\n4. Listing all resource groups in the subscription.\n"
azure resource group get

printf "\n5. Removing resource group: %s.\n" "$resourceGroupName"
azure resource group remove --name "$resourceGroupName" --force

This file was deleted.

Loading