Validate infrastructure as code (IaC) and DevOps repositories using Azure Pipelines.
Перейти к файлу
Bernie White 229ec9285e
Added support for conventions #211 (#212)
2021-08-19 15:35:31 +10:00
.azure-pipelines Update change log (#166) 2021-06-07 13:23:18 +10:00
.github Bump PSRule dependency to v1.5.0 #184 (#185) 2021-07-19 00:30:20 +10:00
.vscode Added support for using baselines #46 (#111) 2021-02-04 12:39:55 +10:00
docs Added support for conventions #211 (#212) 2021-08-19 15:35:31 +10:00
images Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
tasks Added support for conventions #211 (#212) 2021-08-19 15:35:31 +10:00
tests Apply OSS guidelines #14 (#16) 2020-04-16 14:50:20 +10:00
.gitignore Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
.markdownlint.json Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
CHANGELOG.md Added support for conventions #211 (#212) 2021-08-19 15:35:31 +10:00
CODE_OF_CONDUCT.md Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
CONTRIBUTING.md Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
LICENSE Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
README.md Bump PSRule dependency to v1.6.0 #200 (#201) 2021-08-11 13:43:19 +10:00
SECURITY.md Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
SUPPORT.md Added SUPPORT.md (#152) 2021-05-01 23:34:39 +10:00
extension.md Bump PSRule dependency to v1.6.0 #200 (#201) 2021-08-11 13:43:19 +10:00
package-lock.json Bump @types/node from 16.6.1 to 16.6.2 (#210) 2021-08-19 11:23:33 +10:00
package.json Bump @types/node from 16.6.1 to 16.6.2 (#210) 2021-08-19 11:23:33 +10:00
pipeline.build.ps1 Bump PSRule dependency to v1.6.0 #200 (#201) 2021-08-11 13:43:19 +10:00
ps-project.yaml Bump PSRule dependency to v1.6.0 #200 (#201) 2021-08-11 13:43:19 +10:00
ps-rule.yaml Use repository validation from PSRule.Rules.MSFT.OSS (#112) 2021-02-04 12:52:42 +10:00
tsconfig.json Add extension and CI pipeline (#1) 2020-04-05 17:19:45 +10:00
vss-extension.json Apply OSS guidelines #14 (#16) 2020-04-16 14:50:20 +10:00

README.md

PSRule extension for Azure Pipelines

An Azure DevOps extension for using PSRule within Azure Pipelines.

ci-badge extension-version

Support

This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates.

  • For new issues, file your bug or feature request as a new issue.
  • For help, discussion, and support questions about using this project, join or start a discussion.

Support for this project/ product is limited to the resources listed above.

Getting started

The PSRule extension includes the following tasks for Azure Pipelines:

Name Friendly name Description Reference
ps-rule-assert PSRule analysis Run analysis with PSRule. reference
ps-rule-install Install PSRule module Install a PowerShell module containing rules. reference

To add these tasks, use the name for YAML pipelines or friendly name of classic pipelines.

Installing PSRule extension

To use PSRule within Azure DevOps Services, install the extension from the Visual Studio Marketplace. For detailed instructions see Install extensions.

If you don't have permissions to install extensions within your Azure DevOps organization, you can request it to be installed by an admin instead.

Using within YAML pipelines

To use these tasks within YAML pipelines:

  • Install rule modules with the ps-rule-install task (optional).
  • Run analysis one or more times with the ps-rule-assert task.
  • Publish analysis results with the Publish Test Results builtin task.

For example:

steps:

# Install PSRule.Rules.Azure from the PowerShell Gallery
- task: ps-rule-install@0
  inputs:
    module: PSRule.Rules.Azure   # Install PSRule.Rules.Azure from the PowerShell Gallery.
    latest: false                # Only install the module if not already installed.
    prerelease: false            # Install stable versions only.

# Run analysis from JSON files using the `PSRule.Rules.Azure` module and custom rules from `.ps-rule/`.
- task: ps-rule-assert@0
  inputs:
    inputType: inputPath
    inputPath: 'out/*.json'                  # Read objects from JSON files in 'out/'.
    modules: 'PSRule.Rules.Azure'            # Analyze objects using the rules within the PSRule.Rules.Azure PowerShell module.
    source: '.ps-rule/'                      # Additionally, analyze object using custom rules from '.ps-rule/'.
    outputFormat: NUnit3                     # Save results to an NUnit report.
    outputPath: reports/ps-rule-results.xml  # Write NUnit report to 'reports/ps-rule-results.xml'.

# Publish NUnit report as test results
- task: PublishTestResults@2
  displayName: 'Publish PSRule results'
  inputs:
    testRunTitle: 'PSRule'                          # The title to use for the test run.
    testRunner: NUnit                               # Import report using the NUnit format.
    testResultsFiles: 'reports/ps-rule-results.xml' # The previously saved NUnit report.

Changes and versioning

Extensions and tasks in this repository uses semantic versioning to declare breaking changes. For a list of module changes please see the change log.

Contributing

This project welcomes contributions and suggestions. If you are ready to contribute, please visit the contribution guide.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Maintainers

License

This project is licensed under the MIT License.