Skip to content

Commit

Permalink
Add source link for rule in docs #2115 (#2453)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Oct 1, 2023
1 parent 66abf29 commit a95fc6d
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@
"VARIANT": "6.0-bullseye-slim"
}
},
"remoteUser": "vscode"
"remoteUser": "vscode",
"forwardPorts": [
8000
]
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Features of PSRule for Azure include:

- [Learn by example][6] - Fix issues quickly, and learn how to improve your Infrastructure as Code..
- [Framework aligned][7] - Apply principals of Azure Well-Architected Framework to your workloads.
- [Start day one][2] - Leverage over 390 pre-built rules to test Azure resources.
- [Start day one][2] - Leverage over 400 pre-built rules to test Azure resources.
- [DevOps integrated][3] - Test Azure infrastructure as code such as Bicep or Azure Resource Manager templates.
- [Cross-platform][4] - Run locally or in the cloud on MacOS, Linux, and Windows.
- [Open community][8] - Open source rules for the Azure community.
Expand Down Expand Up @@ -333,6 +333,7 @@ The following baselines are included within `PSRule.Rules.Azure`.
- [Azure.GA_2022_12](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.GA_2022_12/) - Baseline for GA rules released December 2022 or prior.
- [Azure.GA_2023_03](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.GA_2023_03/) - Baseline for GA rules released March 2023 or prior.
- [Azure.GA_2023_06](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.GA_2023_06/) - Baseline for GA rules released June 2023 or prior.
- [Azure.GA_2023_09](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.GA_2023_09/) - Baseline for GA rules released September 2023 or prior.
- [Azure.Preview](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview/) - Includes rules for Azure GA and preview features.
- [Azure.Preview_2021_09](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview_2021_09/) - Baseline for rules released September 2021 or prior for Azure preview only features.
- [Azure.Preview_2021_12](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview_2021_12/) - Baseline for rules released December 2021 or prior for Azure preview only features.
Expand All @@ -342,6 +343,7 @@ The following baselines are included within `PSRule.Rules.Azure`.
- [Azure.Preview_2022_12](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview_2022_12/) - Baseline for rules released December 2022 or prior for Azure preview only features.
- [Azure.Preview_2023_03](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview_2023_03/) - Baseline for rules released March 2023 or prior for Azure preview only features.
- [Azure.Preview_2023_06](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview_2023_06/) - Baseline for rules released June 2023 or prior for Azure preview only features.
- [Azure.Preview_2023_09](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Preview_2023_09/) - Baseline for rules released September 2023 or prior for Azure preview only features.
- [Azure.MCSB.v1](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.MCSB.v1/) - A baseline aligned to Microsoft Cloud Security Benchmark v1 controls.

## Language reference
Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGELOG-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ What's changed since pre-release v1.30.0-B0080:
- Updated `Azure.AKS.Version` to use latest stable version `1.26.6` by @BernieWhite.
[#2404](https://github.com/Azure/PSRule.Rules.Azure/issues/2404)
- Use `AZURE_AKS_CLUSTER_MINIMUM_VERSION` to configure the minimum version of the cluster.
- General improvements:
- Add source link for rule in docs by @BernieWhite.
[#2115](https://github.com/Azure/PSRule.Rules.Azure/issues/2115)
- Engineering:
- Updated resource providers and policy aliases.
[#2442](https://github.com/Azure/PSRule.Rules.Azure/pull/2442)
Expand Down
2 changes: 1 addition & 1 deletion docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PSRule for Azure uses the principles of the Azure Well-Architected Framework (WA
Examples are provided in Azure Bicep and ARM templates syntax.

If you want to write your own tests, you can do that too in your choice of YAML, JSON, or PowerShell.
However with over 390 tests already built, you can identify and fix issues day one.
However with over 400 tests already built, you can identify and fix issues day one.

!!! Learn "Get started with a sample repository"
To get started with a sample repository, see [PSRule for Azure Quick Start][1] on GitHub.
Expand Down
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This allows you to explore and learn the context of each WAF principle.

## Start day one

PSRule for Azure includes over 390 rules for validating resources against configuration recommendations.
PSRule for Azure includes over 400 rules for validating resources against configuration recommendations.
Rules automatically detect and analyze resources from Azure IaC artifacts.
This allows you to quickly light up unit testing of Azure resources from templates and Bicep deployments.

Expand Down
7 changes: 7 additions & 0 deletions docs/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def replace_maml(markdown: str, page: mkdocs.structure.nav.Page, config: mkdocs.
if page.meta.get("resource", "None") != "None":
markdown = markdown.replace("<!-- TAGS -->", " · [:octicons-container-24: " + page.meta['resource'] + "](resource.md#" + page.meta['resource'].lower().replace(" ", "-") + ")\r<!-- TAGS -->")

if page.meta.get('source', 'None') != 'None':
markdown = markdown.replace("<!-- TAGS -->", " · [:octicons-file-code-24: Rule](" + page.meta['source'] + ")\r<!-- TAGS -->")

if page.meta.get('release', 'None') == 'preview':
markdown = markdown.replace("<!-- TAGS -->", " · :octicons-beaker-24: Preview\r<!-- TAGS -->")

Expand Down Expand Up @@ -128,6 +131,10 @@ def read_metadata(page: mkdocs.structure.nav.Page):
description = data[name]['Synopsis']
page.meta['description'] = description

if page.meta.get('rule', '') != '' and data.get(name, None) != None and data[name].get('Source', None) != None:
page.meta['source'] = data[name]['Source']


page.meta['tags'] = tags


Expand Down
2 changes: 1 addition & 1 deletion docs/working-with-baselines.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ In additional to quarterly baselines, some additional baselines exist:
- `Azure.Default` - Includes rules for GA Azure features.
This is the default baseline that is used when no baseline is specified.
Rules for Azure features that are within the scope of a public or private preview are not included.
- `Azure.Preview` - Includes rules for GA and preview Azure features.
- `Azure.Preview` - Includes all rules for GA and preview Azure features.
- `Azure.All` - Includes all Azure rules shipped with PSRule for Azure.
This is functionally the same as `Azure.Preview` however intended for internal use only.
- `Azure.MCSB.v1` - Includes rules related to Microsoft cloud security benchmark (MCSB) controls.
Expand Down
2 changes: 1 addition & 1 deletion overrides/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ <h3 class="h4 text-brand font-weight-600 mb-3">Framework aligned</h3>
<div>
{% include ".icons/octicons/rocket-24.svg" %}
<h3 class="h4 text-brand font-weight-600 mb-3">Start day one</h3>
<p>Leverage over 390 pre-built rules to test Azure resources.</p>
<p>Leverage over 400 pre-built rules to test Azure resources.</p>
</div>
</a>
<a class="tile" href="features/#devops-integrated" target="_self" rel="noopener">
Expand Down
2 changes: 2 additions & 0 deletions pipeline.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ task BuildRuleDocs Build, Dependencies, {
Recommendation = $_.Info.Recommendation
Pillar = $_.Tag.'Azure.WAF/pillar'
Control = $_.Tag.'Azure.MCSB.v1/control'
Source = "https://github.com/Azure/PSRule.Rules.Azure/blob/main/src/PSRule.Rules.Azure/rules/$(($_.Source.Path -split '/')[-1])"
}
}
$metadata | ConvertTo-Json -Depth 5 | Set-Content -Path ./docs/en/rules/metadata.json -Force;
Expand All @@ -407,6 +408,7 @@ task BuildRuleDocs Build, Dependencies, {
Recommendation = $_.Info.Recommendation
Pillar = $_.Tag.'Azure.WAF/pillar'
Control = $_.Tag.'Azure.MCSB.v1/control'
Source = "https://github.com/Azure/PSRule.Rules.Azure/blob/main/src/PSRule.Rules.Azure/rules/$(($_.Source.Path -split '/')[-1])"
}
}
$metadata | ConvertTo-Json -Depth 5 | Set-Content -Path ./docs/es/rules/metadata.json -Force;
Expand Down

0 comments on commit a95fc6d

Please sign in to comment.