From a95fc6d0ba4c52ff3b824b8033c8d60aef55c55a Mon Sep 17 00:00:00 2001 From: Bernie White Date: Sun, 1 Oct 2023 13:26:33 +1000 Subject: [PATCH] Add source link for rule in docs #2115 (#2453) --- .devcontainer/devcontainer.json | 5 ++++- README.md | 4 +++- docs/CHANGELOG-v1.md | 3 +++ docs/about.md | 2 +- docs/features.md | 2 +- docs/hooks.py | 7 +++++++ docs/working-with-baselines.md | 2 +- overrides/home.html | 2 +- pipeline.build.ps1 | 2 ++ 9 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 70e304d945a..9650de7652f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -39,5 +39,8 @@ "VARIANT": "6.0-bullseye-slim" } }, - "remoteUser": "vscode" + "remoteUser": "vscode", + "forwardPorts": [ + 8000 + ] } diff --git a/README.md b/README.md index 407d929cee2..1c0832cddf0 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. @@ -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 diff --git a/docs/CHANGELOG-v1.md b/docs/CHANGELOG-v1.md index 42fb2d19be1..c02d8dfb0db 100644 --- a/docs/CHANGELOG-v1.md +++ b/docs/CHANGELOG-v1.md @@ -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) diff --git a/docs/about.md b/docs/about.md index c2258323ee3..d00296c3feb 100644 --- a/docs/about.md +++ b/docs/about.md @@ -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. diff --git a/docs/features.md b/docs/features.md index 84092c2ec7d..57eaa6ef6de 100644 --- a/docs/features.md +++ b/docs/features.md @@ -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. diff --git a/docs/hooks.py b/docs/hooks.py index ee06b59f540..e821d9042e2 100644 --- a/docs/hooks.py +++ b/docs/hooks.py @@ -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("", " · [:octicons-container-24: " + page.meta['resource'] + "](resource.md#" + page.meta['resource'].lower().replace(" ", "-") + ")\r") + if page.meta.get('source', 'None') != 'None': + markdown = markdown.replace("", " · [:octicons-file-code-24: Rule](" + page.meta['source'] + ")\r") + if page.meta.get('release', 'None') == 'preview': markdown = markdown.replace("", " · :octicons-beaker-24: Preview\r") @@ -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 diff --git a/docs/working-with-baselines.md b/docs/working-with-baselines.md index 2ff1d9f381a..0357ddb0beb 100644 --- a/docs/working-with-baselines.md +++ b/docs/working-with-baselines.md @@ -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. diff --git a/overrides/home.html b/overrides/home.html index 828f6418fd4..e679f8019ea 100644 --- a/overrides/home.html +++ b/overrides/home.html @@ -335,7 +335,7 @@

Framework aligned

{% include ".icons/octicons/rocket-24.svg" %}

Start day one

-

Leverage over 390 pre-built rules to test Azure resources.

+

Leverage over 400 pre-built rules to test Azure resources.

diff --git a/pipeline.build.ps1 b/pipeline.build.ps1 index a68aa781c3f..8b4b3e86e03 100644 --- a/pipeline.build.ps1 +++ b/pipeline.build.ps1 @@ -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; @@ -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;