Skip to content

Commit 8a83f3d

Browse files
authored
Merge pull request #552 from microsoftgraph/bugfixes/ComplianceModuleDirectiveUpdate
Compliance module fix
2 parents 1664d81 + 31532b0 commit 8a83f3d

File tree

7 files changed

+42
-11
lines changed

7 files changed

+42
-11
lines changed

.azure-pipelines/common-templates/download-openapi-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
# Calculate meta-module version
9393
$MetaModule = Find-Module "Microsoft.Graph" -Repository PSGallery
9494
$MetaModuleVersion = [System.Version]($MetaModule.Version)
95-
$NewMetaModuleVersion = "$($MetaModuleVersion.Major).$($MetaModuleVersion.Minor + 1).$($MetaModuleVersion.Build)"
95+
$NewMetaModuleVersion = "$($MetaModuleVersion.Major).$($MetaModuleVersion.Minor).$($MetaModuleVersion.Build + 1)"
9696
# Bump meta-module minor version
9797
Write-Host "Bumping Microsoft.Graph to $NewMetaModuleVersion."
9898
& "$(System.DefaultWorkingDirectory)\tools\SetMetaModuleVersion.ps1" -VersionNumber $NewMetaModuleVersion
@@ -102,7 +102,7 @@ jobs:
102102
try {
103103
$Module = Find-Module "Microsoft.Graph.$_" -Repository PSGallery -ErrorAction Stop
104104
$ModuleVersion = [System.Version]($Module.Version)
105-
$NewModuleVersion = "$($ModuleVersion.Major).$($ModuleVersion.Minor + 1).$($ModuleVersion.Build)"
105+
$NewModuleVersion = "$($ModuleVersion.Major).$($ModuleVersion.Minor).$($ModuleVersion.Build + 1)"
106106
Write-Host "Bumping $_ to $NewModuleVersion."
107107
. "$(System.DefaultWorkingDirectory)\tools\SetServiceModuleVersion.ps1" -VersionNumber $NewModuleVersion -Modules $_
108108
} catch {

.azure-pipelines/install-tools-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ steps:
5050
displayName: 'Install AutoRest'
5151
inputs:
5252
command: 'custom'
53-
customCommand: 'install -g autorest@beta'
53+
customCommand: 'install -g autorest@latest'
5454

5555
- task: PowerShell@2
5656
displayName: 'Register PS Repository'

src/Compliance/Compliance/readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ require:
3131
title: $(service-name)
3232
subject-prefix: ''
3333
```
34+
35+
### Directives
36+
37+
> see https://github.com/Azure/autorest/blob/master/docs/powershell/directives.md
38+
39+
``` yaml
40+
directive:
41+
# Remove undocumented cmdlets
42+
- where:
43+
subject: (^ComplianceEdiscoveryCaseNoncustodialDataSource$)
44+
variant: ^Get1$|^GetViaIdentity1$|^Update1$|^UpdateExpanded1$|^UpdateViaIdentity1$|^UpdateViaIdentityExpanded1$|^Delete1$|^DeleteViaIdentity1$
45+
remove: true
46+
```
47+
3448
### Versioning
3549
3650
``` yaml

src/Users.Actions/Users.Actions/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ directive:
4545
- where:
4646
verb: Clear
4747
subject: ^UserManagedAppRegistration$
48-
variant: ^Wipe1$|^WipeExpanded1$|^WipeViaIdentity1$|^WipeViaIdentityExpanded1$
48+
variant: ^Wipe(1|2)$|^WipeExpanded(1|2)$|^WipeViaIdentity(1|2)$|^WipeViaIdentityExpanded(1|2)$
4949
remove: true
5050
- where:
5151
verb: Get

src/readme.graph.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ directive:
8686
- microsoft.graph.governanceRoleDefinition
8787
- microsoft.graph.workbookOperationError
8888
- microsoft.graph.parentLabelDetails
89+
- microsoft.graph.ediscovery.tag
90+
- microsoft.graph.ediscovery.sourceCollection
8991

9092
# Set parameter alias
9193
- where:

tools/GenerateModules.ps1

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@ enum VersionState {
2020
EqualToFeed
2121
NotOnFeed
2222
}
23+
$Error.Clear()
2324
$ErrorActionPreference = 'Continue'
2425
if ($PSEdition -ne 'Core') {
2526
Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.'
2627
}
28+
# Module import.
29+
Import-Module PowerShellGet
30+
2731
# Install Powershell-yaml
2832
if (!(Get-Module -Name powershell-yaml -ListAvailable)) {
2933
Install-Module powershell-yaml -Force
3034
}
3135

36+
# Set NODE max memory to 8 Gb.
37+
$ENV:NODE_OPTIONS='--max-old-space-size=8192'
3238
$ModulePrefix = "Microsoft.Graph"
3339
$ScriptRoot = $PSScriptRoot
3440
$ModulesOutputDir = Join-Path $ScriptRoot "..\src\"
@@ -130,7 +136,8 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $ModulesToGenerate.Count -Par
130136
# Generate PowerShell modules.
131137
& autorest --module-version:$ModuleVersion --service-name:$ModuleName $ModuleLevelReadMePath --version:"3.0.6306" --verbose
132138
if ($LASTEXITCODE) {
133-
Write-Error "Failed to generate '$ModuleName' module."
139+
Write-Error "AutoREST failed to generate '$ModuleName' module."
140+
break;
134141
}
135142
Write-Host -ForegroundColor Green "AutoRest generated '$FullyQualifiedModuleName' successfully."
136143

@@ -192,10 +199,6 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $ModulesToGenerate.Count -Par
192199
}
193200
$updatedLine
194201
} | Set-Content $InternalModulePsm1
195-
196-
if ($LASTEXITCODE) {
197-
Write-Error "Failed to build '$ModuleName' module."
198-
}
199202
}
200203

201204
if ($Using:Test) {
@@ -206,14 +209,21 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $ModulesToGenerate.Count -Par
206209
# Pack generated module.
207210
. $Using:PackModulePS1 -Module $ModuleName -ArtifactsLocation $Using:ArtifactsLocation
208211
}
212+
213+
Write-Host -ForeGroundColor Green "Generating $ModuleName Completed"
209214
}
210215
catch {
211-
throw $_
216+
Write-Error $_
212217
}
213-
Write-Host -ForeGroundColor Green "Generating $ModuleName Completed"
214218
}
215219
}
216220

221+
if ($Error.Count -ge 1) {
222+
# Write generation errors to pipeline.
223+
$Error
224+
Write-Error "The SDK failed to build due to $($Error.Count) errors listed above." -ErrorAction "Stop"
225+
}
226+
217227
if ($Publish) {
218228
# Publish generated modules.
219229
& $PublishModulePS1 -Modules $ModuleMapping.Keys -ModulePrefix $ModulePrefix -ArtifactsLocation $ArtifactsLocation -RepositoryName $RepositoryName -RepositoryApiKey $RepositoryApiKey

tools/ValidateUpdatedModuleVersion.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ enum VersionState {
1313
EqualToFeed
1414
NotOnFeed
1515
}
16+
17+
# Module import.
18+
Import-Module PackageManagement
19+
Import-Module PowerShellGet
20+
1621
$AllowPreRelease = $true
1722
if($ModulePreviewNumber -eq -1) {
1823
$AllowPreRelease = $false

0 commit comments

Comments
 (0)