Skip to content

Commit a3dff10

Browse files
authored
Repo tasks add spn (#3211)
* refactoring task modules * missed Refactoring modules * Making modular modules for various tasks * Added cmdlet to create Service Principal. Refactored Repo-Tasks to include multiple modular modules (e.g. Build-Tasks, TestFx-Tasks) * Removing SPN cmdlets
1 parent 3d906ff commit a3dff10

File tree

10 files changed

+545
-248
lines changed

10 files changed

+545
-248
lines changed

tools/Modules/Build-Tasks.psd1

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#
2+
# Module manifest for module 'PSGet_Build-Tasks'
3+
#
4+
# Generated by: abhishah
5+
#
6+
# Generated on: 11/18/2016
7+
#
8+
9+
@{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = 'Build-Tasks.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '1.0'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
19+
20+
# ID used to uniquely identify this module
21+
GUID = 'cda2be3c-14a7-4c83-9393-d5ebad9df7e4'
22+
23+
# Author of this module
24+
Author = 'abhishah'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'Microsoft'
28+
29+
# Copyright statement for this module
30+
Copyright = '(c) 2016 abhishah. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
# Description = ''
34+
35+
# Minimum version of the Windows PowerShell engine required by this module
36+
# PowerShellVersion = ''
37+
38+
# Name of the Windows PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the Windows PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
# DotNetFrameworkVersion = ''
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# CLRVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
# RequiredModules = @()
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
# RequiredAssemblies = @()
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
# FormatsToProcess = @()
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72+
FunctionsToExport = 'Get-BuildScopes', 'Start-Build', 'Invoke-CheckinTests',
73+
'Install-VSProjectTemplates'
74+
75+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
76+
CmdletsToExport = @()
77+
78+
# Variables to export from this module
79+
# VariablesToExport = @()
80+
81+
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
82+
AliasesToExport = @()
83+
84+
# DSC resources to export from this module
85+
# DscResourcesToExport = @()
86+
87+
# List of all modules packaged with this module
88+
# ModuleList = @()
89+
90+
# List of all files packaged with this module
91+
# FileList = @()
92+
93+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
94+
PrivateData = @{
95+
96+
PSData = @{
97+
98+
# Tags applied to this module. These help with module discovery in online galleries.
99+
# Tags = @()
100+
101+
# A URL to the license for this module.
102+
# LicenseUri = ''
103+
104+
# A URL to the main website for this project.
105+
# ProjectUri = ''
106+
107+
# A URL to an icon representing this module.
108+
# IconUri = ''
109+
110+
# ReleaseNotes of this module
111+
# ReleaseNotes = ''
112+
113+
# External dependent modules of this module
114+
# ExternalModuleDependencies = ''
115+
116+
} # End of PSData hashtable
117+
118+
} # End of PrivateData hashtable
119+
120+
# HelpInfo URI of this module
121+
# HelpInfoURI = ''
122+
123+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
124+
# DefaultCommandPrefix = ''
125+
126+
}
127+

tools/Modules/Build-Tasks.psm1

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[CmdletBinding]
2+
Function Get-BuildScopes
3+
{
4+
<#
5+
.SYNOPSIS
6+
You can build a particular package rather than doing a full build by providing Build Scope.
7+
This cmdlet will help to identify existing Scope available
8+
This will enable to execute Start-RepoBuild <scope>
9+
10+
#>
11+
12+
Write-Host "Below are available scopes you can specify for building specific projects"
13+
Write-Host ""
14+
Get-ChildItem -path "$env:repoRoot\src\ResourceManager" -dir | Format-Wide -Column 5 | Format-Table -Property Name
15+
Write-Host "e.g of a scope would be 'ResourceManager\Compute'" -ForegroundColor Yellow
16+
17+
Get-ChildItem -path "$env:repoRoot\src\ServiceManagement" -dir -Exclude "ResourceManager" | Format-Wide -Column 5 | Format-Table -Property Name
18+
Write-Host "e.g of a scope would be 'ServiceManagement\ExpressRoute'" -ForegroundColor Yellow
19+
}
20+
21+
[CmdletBinding]
22+
Function Start-Build
23+
{
24+
<#
25+
.SYNOPSIS
26+
This cmdlet will help to do either with full build or targeted build for specific scopes.
27+
28+
.PARAMETER BuildScope
29+
Use Get-BuildScope cmdLet to get list of existing scopes that can be used to build
30+
#>
31+
param(
32+
[parameter(Mandatory=$false, Position=0, HelpMessage='BuildScope that you would like to use. For list of build scopes, run List-BuildScopes')]
33+
[string]$BuildScope
34+
)
35+
36+
if([string]::IsNullOrEmpty($BuildScope) -eq $true)
37+
{
38+
Write-Host "Starting Full build"
39+
msbuild.exe "$env:repoRoot\build.proj" /t:Build
40+
}
41+
else
42+
{
43+
Write-Host "Building $BuildScope"
44+
msbuild.exe "$env:repoRoot\build.proj" /t:Build /p:Scope=$BuildScope
45+
}
46+
}
47+
48+
[CmdletBinding]
49+
Function Invoke-CheckinTests
50+
{
51+
<#
52+
.SYNOPSIS
53+
Runs all the check in tests
54+
#>
55+
Write-Host "cmdline Args: msbuild.exe $env:repoRoot\build.proj /t:Test"
56+
msbuild.exe "$env:repoRoot\build.proj" /t:Test
57+
}
58+
59+
[cmdletBinding]
60+
Function Install-VSProjectTemplates
61+
{
62+
<#
63+
.SYNOPSIS
64+
65+
Install-VSProjectTemplates will install getting started project templates for
66+
1) Autorest-.NET SDKProject
67+
2) .NET SDK Test projectct
68+
69+
After executing the cmdlet, restart VS (if already open), create new project
70+
Search for the project template as we install the following three project templates
71+
AutoRest-AzureDotNetSDK
72+
AzureDotNetSDK-TestProject
73+
AzurePowerShell-TestProject
74+
#>
75+
if($env:VisualStudioVersion -eq "14.0")
76+
{
77+
if((Test-Path "$env:repoRoot\tools\ProjectTemplates\") -eq $true)
78+
{
79+
Write-Host "Installing VS templates for 'AutoRest as well as Test Project'"
80+
Copy-Item "$env:repoRoot\tools\ProjectTemplates\*.zip" "$env:USERPROFILE\Documents\Visual Studio 2015\Templates\ProjectTemplates\"
81+
Write-Host "Installed VS Test Project Templates for Powershell test projects"
82+
Write-Host ""
83+
Write-Host "Restart VS (if already open), search for 'AzurePowerShell-TestProject'" -ForegroundColor Yellow
84+
}
85+
else
86+
{
87+
Write-Host "Missing templates to install, make sure you have project templates available in the repo under $env:repoRoot\tools\ProjectTemplates\"
88+
}
89+
}
90+
else
91+
{
92+
Write-Host "Unsupported VS Version detected. Visual Studio 2015 is the only supported version for current set of project templates"
93+
}
94+
}
95+
96+
export-modulemember -Function Get-BuildScopes
97+
export-modulemember -Function Start-Build
98+
export-modulemember -Function Invoke-CheckinTests
99+
export-modulemember -Function Install-VSProjectTemplates

tools/Modules/TestFx-Tasks.psd1

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#
2+
# Module manifest for module 'PSGet_TestFx-Tasks'
3+
#
4+
# Generated by: ShahAbhijeet
5+
#
6+
# Generated on: 11/18/2016
7+
#
8+
9+
@{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = 'TestFx-Tasks.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '1.0'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
19+
20+
# ID used to uniquely identify this module
21+
GUID = '676f988a-1745-4263-bb86-5887d6b1f9f3'
22+
23+
# Author of this module
24+
Author = 'ShahAbhijeet'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'Microsoft'
28+
29+
# Copyright statement for this module
30+
Copyright = '(c) 2016 ShahAbhijeet. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
# Description = ''
34+
35+
# Minimum version of the Windows PowerShell engine required by this module
36+
# PowerShellVersion = ''
37+
38+
# Name of the Windows PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the Windows PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
# DotNetFrameworkVersion = ''
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# CLRVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
# RequiredModules = @()
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
# RequiredAssemblies = @()
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
# FormatsToProcess = @()
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72+
FunctionsToExport = 'Set-TestEnvironment', 'Remove-ServicePrincipal', 'New-ServicePrincipal', 'Set-SPNRole'
73+
74+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75+
CmdletsToExport = @()
76+
77+
# Variables to export from this module
78+
# VariablesToExport = @()
79+
80+
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
81+
AliasesToExport = @()
82+
83+
# DSC resources to export from this module
84+
# DscResourcesToExport = @()
85+
86+
# List of all modules packaged with this module
87+
# ModuleList = @()
88+
89+
# List of all files packaged with this module
90+
# FileList = @()
91+
92+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
93+
PrivateData = @{
94+
95+
PSData = @{
96+
97+
# Tags applied to this module. These help with module discovery in online galleries.
98+
# Tags = @()
99+
100+
# A URL to the license for this module.
101+
# LicenseUri = ''
102+
103+
# A URL to the main website for this project.
104+
# ProjectUri = ''
105+
106+
# A URL to an icon representing this module.
107+
# IconUri = ''
108+
109+
# ReleaseNotes of this module
110+
# ReleaseNotes = ''
111+
112+
# External dependent modules of this module
113+
# ExternalModuleDependencies = ''
114+
115+
} # End of PSData hashtable
116+
117+
} # End of PrivateData hashtable
118+
119+
# HelpInfo URI of this module
120+
# HelpInfoURI = ''
121+
122+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
123+
# DefaultCommandPrefix = ''
124+
125+
}
126+

0 commit comments

Comments
 (0)