Skip to content

Commit

Permalink
Added updates #353 #314 (#354)
Browse files Browse the repository at this point in the history
* Added updates #353 #314

* Skip tests

* Fixes for pipeline
  • Loading branch information
BernieWhite authored Apr 4, 2022
1 parent 2bb8b6c commit a1e04c8
Show file tree
Hide file tree
Showing 15 changed files with 368 additions and 232 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"**/.azure-pipelines/**/*.yaml": "azure-pipelines"
},
"cSpell.words": [
"cmdlets"
"cmdlets",
"Sarif"
]
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "test",
"type": "shell",
"command": "Invoke-Build Rules -AssertStyle Client",
"command": "Invoke-Build Test",
"group": {
"kind": "test",
"isDefault": true
Expand Down
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers

What's changed since v1.5.0:

- General improvements:
- Expose more rule error output in CI. [#308](https://github.com/microsoft/PSRule-pipelines/issues/308)
- New features:
- Added support for PSRule v2. [#312](https://github.com/microsoft/PSRule-pipelines/issues/312)
- Added `ps-rule-assert@2` task for PSRule v2.
- Added `ps-rule-install@2` task for PSRule v2.
- Added support for outputting analysis results as SARIF. [#315](https://github.com/microsoft/PSRule-pipelines/issues/315)
- To use the SARIF output format set the `outputFormat` parameter to `Sarif`.
- Currently a pre-release version of PSRule must be used.
- Engineering:
- Preparing for PSRule v2 support. [#312](https://github.com/microsoft/PSRule-pipelines/issues/312)
- Added `ps-rule-assert@2` task for PSRule v2.
- Added `ps-rule-install@2` task for PSRule v2.
- Added the ability to use a specific version of PSRule. [#314](https://github.com/microsoft/PSRule-pipelines/issues/314)
- To install a specific version set the version parameter.
- By default, the latest stable version of PSRule is used.
- Added the ability to use an alternative PowerShell repository. [#353](https://github.com/microsoft/PSRule-pipelines/issues/353)
- Register and authenticate to the repository in PowerShell if required.
- Configure repository to install modules from the named repository.
- General improvements:
- Expose more rule error output in CI. [#308](https://github.com/microsoft/PSRule-pipelines/issues/308)

## v1.5.0

Expand Down
67 changes: 44 additions & 23 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ steps:
module: string # Required. The name of a rule module to install.
latest: boolean # Optional. Determine if the installed module is updated to the latest version.
prerelease: boolean # Optional. Determine if a pre-release module version is installed.
repository: string # Optional. The name of the PowerShell repository where PSRule modules are installed from.
```
- **module**: The name of a rule module to install.
The module will be installed from the PowerShell Gallery.
For example: _PSRule.Rules.Azure_
- **latest**: Determine if the installed module is updated to the latest version.
- **prerelease**: Determine if a pre-release module version is installed.
- **repository**: The name of the PowerShell repository where PSRule modules are installed from.
By default this is the PowerShell Gallery.
When configured, PowerShell modules are installed from this repository.
Before calling the `ps-rule-install`, register and authenticate to the repository if required.

### Example: Installing a rule module

Expand Down Expand Up @@ -57,38 +62,54 @@ steps:
outputFormat: None, Yaml, Json, Markdown, NUnit3, Csv # Optional. The format to use when writing results to disk.
outputPath: string # Optional. The file path to write results to.
path: string # Optional. The working directory PSRule is run from.
prerelease: boolean # Optional. Determine if a pre-release module version is installed.
repository: string # Optional. The name of the PowerShell repository where PSRule modules are installed from.
version: string # Optional. The specific version of PSRule to use.
```

- **inputType**: Determines the type of input to use for PSRule.
Either `repository` or `inputPath`.
When `inputType: inputPath` is used, supported file formats within `inputPath` will be read as objects.
When `inputType: repository` is used, the structure of the repository will be analyzed instead.
Either `repository` or `inputPath`.
The default is `repository`.
When `inputType: inputPath` is used, supported file formats within `inputPath` will be read as objects.
When `inputType: repository` is used, the structure of the repository will be analyzed instead.
- **inputPath**: Set the `inputPath` to determine where PSRule will look for input files.
When `inputType: inputPath` this is binds to the [-InputPath](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-inputpath) parameter.
When `inputType: repository` this will be the repository root that PSRule analyzes.
When `inputType: inputPath` this is binds to the [-InputPath](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-inputpath) parameter.
When `inputType: repository` this will be the repository root that PSRule analyzes.
- **modules**: A comma separated list of modules to use for analysis.
Install PSRule modules using the `ps-rule-install` task.
If the modules have not been installed,
the latest stable version will be installed from the PowerShell Gallery automatically.
For example: _PSRule.Rules.Azure,PSRule.Rules.Kubernetes_
Install PSRule modules using the `ps-rule-install` task.
If the modules have not been installed,
the latest stable version will be installed from the PowerShell Gallery automatically.
For example: _PSRule.Rules.Azure,PSRule.Rules.Kubernetes_
- **baseline**: The name of a PSRule baseline to use.
Baselines can be used from modules or specified in a separate file.
To use a baseline included in a module use `modules:` with `baseline:`.
To use a baseline specified in a separate file use `source:` with `baseline:`.
Baselines can be used from modules or specified in a separate file.
To use a baseline included in a module use `modules:` with `baseline:`.
To use a baseline specified in a separate file use `source:` with `baseline:`.
- **conventions**: A comma separated list of conventions to use.
Conventions can be used from modules or specified in a separate file.
For example: _Monitor.LogAnalytics.Import_
Conventions can be used from modules or specified in a separate file.
For example: _Monitor.LogAnalytics.Import_
- **source**: An path containing rules to use for analysis.
Use this option to include rules not installed as a PowerShell module.
This binds to the [-Path](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-path) parameter.
Use this option to include rules not installed as a PowerShell module.
This binds to the [-Path](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-path) parameter.
- **outputFormat**: Output results can be written to disk in addition to the default output.
Use this option to determine the format to write results.
By default, results are not written to disk.
This binds to the [-OutputFormat](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-outputformat) parameter.
Use this option to determine the format to write results.
By default, results are not written to disk.
This binds to the [-OutputFormat](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-outputformat) parameter.
- **outputPath**: The file path to write results to.
This binds to the [-OutputPath](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-outputpath) parameter.
This binds to the [-OutputPath](https://microsoft.github.io/PSRule/commands/PSRule/en-US/Assert-PSRule.html#-outputpath) parameter.
- **path**: The working directory PSRule is run from.
Options specified in `ps-rule.yaml` from this directory will be used unless overridden by inputs.
Options specified in `ps-rule.yaml` from this directory will be used unless overridden by inputs.
- **prerelease**: Determine if a pre-release module versions are installed.
When set to true the latest pre-release or stable module version is installed.
If this input is not configured, invalid, or set to false only stable module versions will be installed.
- **repository**: The name of the PowerShell repository where PSRule modules are installed from.
By default this is the PowerShell Gallery.
When configured, PowerShell modules are installed from this repository.
Before calling the `ps-rule-assert`, register and authenticate to the repository if required.
- **version**: The specific version of PSRule to use.
By default, the latest stable version of PSRule will be used. When set:
- The specific version of PSRule will be installed and imported for use.
- If a pre-release version is specified, `prerelease: true` must also be specified.
- If the version is not found, an error will be thrown.

### Example: Run analysis from input files

Expand Down Expand Up @@ -122,7 +143,7 @@ steps:

### Example: Run analysis using an included baseline

Run analysis of files within `out/` and all subdirectories using the named baseline `Azure.GA_2021_06`.
Run analysis of files within `out/` and all subdirectories using the named baseline `Azure.GA_2021_12`.

```yaml
steps:
Expand All @@ -131,6 +152,6 @@ steps:
inputType: inputPath
inputPath: 'out/' # Read objects from files in 'out/'.
modules: 'PSRule.Rules.Azure' # Analyze objects using the rules within the PSRule.Rules.Azure PowerShell module.
baseline: 'Azure.GA_2021_06' # Use the 'Azure.GA_2021_06' baseline included within PSRule.Rules.Azure.
baseline: 'Azure.GA_2021_12' # Use the 'Azure.GA_2021_12' baseline included within PSRule.Rules.Azure.
source: '.ps-rule/' # Additionally, analyze object using custom rules from '.ps-rule/'.
```
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"PSRule": {
"version": "1.11.1"
"version": "2.0.0"
},
"VstsTaskSdk": {
"version": "0.11.0"
Expand Down
96 changes: 48 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a1e04c8

Please sign in to comment.