Skip to content

Compliance module fix #552

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 11 commits into from
Feb 16, 2021
Merged
4 changes: 2 additions & 2 deletions .azure-pipelines/common-templates/download-openapi-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
# Calculate meta-module version
$MetaModule = Find-Module "Microsoft.Graph" -Repository PSGallery
$MetaModuleVersion = [System.Version]($MetaModule.Version)
$NewMetaModuleVersion = "$($MetaModuleVersion.Major).$($MetaModuleVersion.Minor + 1).$($MetaModuleVersion.Build)"
$NewMetaModuleVersion = "$($MetaModuleVersion.Major).$($MetaModuleVersion.Minor).$($MetaModuleVersion.Build + 1)"
# Bump meta-module minor version
Write-Host "Bumping Microsoft.Graph to $NewMetaModuleVersion."
& "$(System.DefaultWorkingDirectory)\tools\SetMetaModuleVersion.ps1" -VersionNumber $NewMetaModuleVersion
Expand All @@ -102,7 +102,7 @@ jobs:
try {
$Module = Find-Module "Microsoft.Graph.$_" -Repository PSGallery -ErrorAction Stop
$ModuleVersion = [System.Version]($Module.Version)
$NewModuleVersion = "$($ModuleVersion.Major).$($ModuleVersion.Minor + 1).$($ModuleVersion.Build)"
$NewModuleVersion = "$($ModuleVersion.Major).$($ModuleVersion.Minor).$($ModuleVersion.Build + 1)"
Write-Host "Bumping $_ to $NewModuleVersion."
. "$(System.DefaultWorkingDirectory)\tools\SetServiceModuleVersion.ps1" -VersionNumber $NewModuleVersion -Modules $_
} catch {
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/install-tools-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ steps:
displayName: 'Install AutoRest'
inputs:
command: 'custom'
customCommand: 'install -g autorest@beta'
customCommand: 'install -g autorest@latest'

- task: PowerShell@2
displayName: 'Register PS Repository'
Expand Down
14 changes: 14 additions & 0 deletions src/Compliance/Compliance/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ require:
title: $(service-name)
subject-prefix: ''
```

### Directives

> see https://github.com/Azure/autorest/blob/master/docs/powershell/directives.md

``` yaml
directive:
# Remove undocumented cmdlets
- where:
subject: (^ComplianceEdiscoveryCaseNoncustodialDataSource$)
variant: ^Get1$|^GetViaIdentity1$|^Update1$|^UpdateExpanded1$|^UpdateViaIdentity1$|^UpdateViaIdentityExpanded1$|^Delete1$|^DeleteViaIdentity1$
remove: true
```

### Versioning

``` yaml
Expand Down
2 changes: 1 addition & 1 deletion src/Users.Actions/Users.Actions/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ directive:
- where:
verb: Clear
subject: ^UserManagedAppRegistration$
variant: ^Wipe1$|^WipeExpanded1$|^WipeViaIdentity1$|^WipeViaIdentityExpanded1$
variant: ^Wipe(1|2)$|^WipeExpanded(1|2)$|^WipeViaIdentity(1|2)$|^WipeViaIdentityExpanded(1|2)$
remove: true
- where:
verb: Get
Expand Down
2 changes: 2 additions & 0 deletions src/readme.graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ directive:
- microsoft.graph.governanceRoleDefinition
- microsoft.graph.workbookOperationError
- microsoft.graph.parentLabelDetails
- microsoft.graph.ediscovery.tag
- microsoft.graph.ediscovery.sourceCollection

# Set parameter alias
- where:
Expand Down
24 changes: 17 additions & 7 deletions tools/GenerateModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ enum VersionState {
EqualToFeed
NotOnFeed
}
$Error.Clear()
$ErrorActionPreference = 'Continue'
if ($PSEdition -ne 'Core') {
Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.'
}
# Module import.
Import-Module PowerShellGet

# Install Powershell-yaml
if (!(Get-Module -Name powershell-yaml -ListAvailable)) {
Install-Module powershell-yaml -Force
}

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

Expand Down Expand Up @@ -192,10 +199,6 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $ModulesToGenerate.Count -Par
}
$updatedLine
} | Set-Content $InternalModulePsm1

if ($LASTEXITCODE) {
Write-Error "Failed to build '$ModuleName' module."
}
}

if ($Using:Test) {
Expand All @@ -206,14 +209,21 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $ModulesToGenerate.Count -Par
# Pack generated module.
. $Using:PackModulePS1 -Module $ModuleName -ArtifactsLocation $Using:ArtifactsLocation
}

Write-Host -ForeGroundColor Green "Generating $ModuleName Completed"
}
catch {
throw $_
Write-Error $_
}
Write-Host -ForeGroundColor Green "Generating $ModuleName Completed"
}
}

if ($Error.Count -ge 1) {
# Write generation errors to pipeline.
$Error
Write-Error "The SDK failed to build due to $($Error.Count) errors listed above." -ErrorAction "Stop"
}

if ($Publish) {
# Publish generated modules.
& $PublishModulePS1 -Modules $ModuleMapping.Keys -ModulePrefix $ModulePrefix -ArtifactsLocation $ArtifactsLocation -RepositoryName $RepositoryName -RepositoryApiKey $RepositoryApiKey
Expand Down
5 changes: 5 additions & 0 deletions tools/ValidateUpdatedModuleVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ enum VersionState {
EqualToFeed
NotOnFeed
}

# Module import.
Import-Module PackageManagement
Import-Module PowerShellGet

$AllowPreRelease = $true
if($ModulePreviewNumber -eq -1) {
$AllowPreRelease = $false
Expand Down