diff --git a/arm/.global/global.module.tests.ps1 b/arm/.global/global.module.tests.ps1 index 03b11009d5..afde7ffbc2 100644 --- a/arm/.global/global.module.tests.ps1 +++ b/arm/.global/global.module.tests.ps1 @@ -37,6 +37,37 @@ Describe 'File/folder tests' -Tag Modules { $moduleFolderTestCases += @{ moduleFolderName = $moduleFolderPath.Replace('\', '/').Split('/arm/')[1] moduleFolderPath = $moduleFolderPath + isTopLevelModule = $moduleFolderPath.Replace('\', '/').Split('/arm/')[1].Split('/').Count -eq 2 # / + } + } + + if (Test-Path (Join-Path $repoRoot '.github')) { + It '[] Module should have a GitHub workflow' -TestCases ($moduleFolderTestCases | Where-Object { $_.isTopLevelModule }) { + + param( + [string] $moduleFolderName, + [string] $moduleFolderPath + ) + + $workflowsFolderName = Join-Path $RepoRoot '.github' 'workflows' + $workflowFileName = '{0}.yml' -f $moduleFolderName.Replace('\', '/').Replace('/', '.').Replace('Microsoft', 'ms').ToLower() + + Test-Path (Join-Path $workflowsFolderName $workflowFileName) | Should -Be $true + } + } + + if (Test-Path (Join-Path $repoRoot '.azuredevops')) { + It '[] Module should have an Azure DevOps pipeline' -TestCases ($moduleFolderTestCases | Where-Object { $_.isTopLevelModule }) { + + param( + [string] $moduleFolderName, + [string] $moduleFolderPath + ) + + $pipelinesFolderName = Join-Path $RepoRoot '.azuredevops' 'modulePipelines' + $pipelineFileName = '{0}.yml' -f $moduleFolderName.Replace('\', '/').Replace('/', '.').Replace('Microsoft', 'ms').ToLower() + + Test-Path (Join-Path $pipelinesFolderName $pipelineFileName) | Should -Be $true } } @@ -53,13 +84,9 @@ Describe 'File/folder tests' -Tag Modules { (Test-Path (Join-Path -Path $moduleFolderPath 'readme.md')) | Should -Be $true } - It '[] Module should contain a [.parameters] folder' -TestCases $moduleFolderTestCases { + It '[] Module should contain a [.parameters] folder' -TestCases ($moduleFolderTestCases | Where-Object { $_.isTopLevelModule }) { param( [string] $moduleFolderPath ) - if ((Split-Path (Split-Path $moduleFolderPath -Parent) -Leaf) -like 'Microsoft.*') { - (Test-Path (Join-Path -Path $moduleFolderPath '.parameters')) | Should -Be $true - } else { - $true | Should -Be $true - } + Test-Path (Join-Path -Path $moduleFolderPath '.parameters') | Should -Be $true } It '[] Module should contain a [version.json] file' -TestCases $moduleFolderTestCases { diff --git a/docs/wiki/Getting started - Scenario 1 Onboard module library and CI environment.md b/docs/wiki/Getting started - Scenario 1 Onboard module library and CI environment.md index c5117269b6..6238aec25a 100644 --- a/docs/wiki/Getting started - Scenario 1 Onboard module library and CI environment.md +++ b/docs/wiki/Getting started - Scenario 1 Onboard module library and CI environment.md @@ -205,7 +205,6 @@ The primary pipeline variable file `global.variables.yml` hosts the fundamental ### 3.2.3 Enable actions - Finally, 'GitHub Actions' are disabled by default and must be enabled for execution. To do so, perform the following steps: @@ -229,6 +228,7 @@ For _Azure DevOps_, you have to perform the following environment-specific steps - [3.2.3 Setup variables file](#323-setup-variables-file) - [3.2.4 Register pipelines](#324-register-pipelines) - [3.2.5 Azure Artifacts Universal Packages](#325-azure-artifacts-universal-packages) + ### 3.2.1 Setup service connection The service connection must be set up in the project's settings under _Pipelines: Service connections_ (a step by step guide can be found [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml)). @@ -329,7 +329,7 @@ This section will explain what is required to publish the modules to [Azure Arti 1. If you chose the feed to be project-scoped, you will need the Project Build Service account to have `Contributor` access to publish to the Azure Artifacts feed. To set this, follow the [Pipeline permission](https://docs.microsoft.com/en-us/azure/devops/artifacts/feeds/feed-permissions?view=azure-devops#pipelines-permissions) steps. #### Implementation Guidance -Each `./azuredevops/modulePipelines` yaml pipeline already calls `/.azuredevops/pipelineTemplates/jobs.publishModule.yml`. This yaml template contains a method to `Publish module to artifacts feed` via `utilities\pipelines\resourcePublish\Publish-ModuleToUniversalArtifactFeed.ps1`. +Each `./azuredevops/modulePipelines` yaml pipeline already calls `/.azuredevops/pipelineTemplates/jobs.publishModule.yml`. This YAML template contains a method to `Publish module to artifacts feed` via `utilities\pipelines\resourcePublish\Publish-ModuleToUniversalArtifactFeed.ps1`. diff --git a/utilities/tools/Set-ModuleReadMe.ps1 b/utilities/tools/Set-ModuleReadMe.ps1 index 0afd5f532a..9f1608ef72 100644 --- a/utilities/tools/Set-ModuleReadMe.ps1 +++ b/utilities/tools/Set-ModuleReadMe.ps1 @@ -95,7 +95,6 @@ function Set-ResourceTypesSection { $_.type -notin $ResourceTypesToExclude -and $_ } | Select-Object 'Type', 'ApiVersion' -Unique | Sort-Object Type -Culture en-US - $TextInfo = (Get-Culture).TextInfo foreach ($resourceTypeObject in $RelevantResourceTypeObjects) { $ProviderNamespace, $ResourceType = $resourceTypeObject.Type -split '/', 2 # Validate if Reference URL Is working