From 5f5b1ad57e1ea8b27e5fda1a7b96b920c6bf3e4b Mon Sep 17 00:00:00 2001 From: Bernie White Date: Sat, 3 Jun 2023 17:02:45 +1000 Subject: [PATCH] Additional updates to codespaces (#2259) --- .devcontainer/devcontainer.json | 18 ++- .vscode/extensions.json | 20 +-- .vscode/launch.json | 56 +++---- .vscode/markdown.code-snippets | 248 +++++++++++++++---------------- .vscode/powershell.code-snippets | 22 +-- .vscode/yaml.code-snippets | 42 +++--- 6 files changed, 206 insertions(+), 200 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6def01e3b8..08e3803acb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json", - "name": "PSRule for Azure dev", + "name": "PSRule for Azure Developer Codespace", "customizations": { "vscode": { "settings": { @@ -13,15 +12,22 @@ }, "extensions": [ "ms-dotnettools.csharp", - "bewhite.psrule-vscode-preview", "msazurermtools.azurerm-vscode-tools", - "ms-azuretools.vscode-bicep" + "ms-vscode.powershell", + "ms-azuretools.vscode-bicep", + "bewhite.psrule-vscode-preview", + "GitHub.vscode-pull-request-github", + "github.vscode-github-actions" ] } }, "features": { - "github-cli": "latest", - "powershell": "latest" + "ghcr.io/devcontainers/features/github-cli": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/powershell": { + "version": "latest" + } }, "onCreateCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-build.ps1", "postStartCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-start.ps1", diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 103491ba19..bcb7077a32 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,12 +1,12 @@ { - "recommendations": [ - "ms-azure-devops.azure-pipelines", - "github.vscode-pull-request-github", - "davidanson.vscode-markdownlint", - "bewhite.psrule-vscode-preview", - "streetsidesoftware.code-spell-checker", - "ms-azuretools.vscode-bicep", - "msazurermtools.azurerm-vscode-tools", - "ms-dotnettools.csharp" - ] + "recommendations": [ + "ms-dotnettools.csharp", + "ms-azure-devops.azure-pipelines", + "github.vscode-pull-request-github", + "davidanson.vscode-markdownlint", + "streetsidesoftware.code-spell-checker", + "ms-azuretools.vscode-bicep", + "msazurermtools.azurerm-vscode-tools", + "bewhite.psrule-vscode-preview", + ] } diff --git a/.vscode/launch.json b/.vscode/launch.json index 705267fee7..31f769b683 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,30 +1,30 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "PowerShell: Interactive Session", - "type": "PowerShell", - "request": "launch", - "cwd": "${workspaceRoot}" - }, - { - "name": "Debug PSRule.Rules.Azure Cmdlets", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - "program": "pwsh", - "args": [ - "-NoExit", - "-NoProfile", - "-Command", - "Import-Module ${workspaceFolder}/out/modules/PSRule.Rules.Azure/PSRule.Rules.Azure.psd1", - ], - "cwd": "${workspaceFolder}", - "stopAtEntry": false, - "console": "integratedTerminal" - } - ] + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "PowerShell: Interactive Session", + "type": "PowerShell", + "request": "launch", + "cwd": "${workspaceRoot}" + }, + { + "name": "Debug PSRule.Rules.Azure Cmdlets", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "pwsh", + "args": [ + "-NoExit", + "-NoProfile", + "-Command", + "Import-Module ${workspaceFolder}/out/modules/PSRule.Rules.Azure/PSRule.Rules.Azure.psd1", + ], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "console": "integratedTerminal" + } + ] } diff --git a/.vscode/markdown.code-snippets b/.vscode/markdown.code-snippets index eeb737cb5a..363a78e371 100644 --- a/.vscode/markdown.code-snippets +++ b/.vscode/markdown.code-snippets @@ -1,126 +1,126 @@ { - "Azure rule documentation": { - "scope": "markdown", - "prefix": "rule-azure", - "description": "Azure rule documentation", - "body": [ - "---", - "reviewed: 2022-mm-dd", - "severity: ${4:severity}", - "pillar: ${5:pillar}", - "category: ${6:category}", - "resource: ${3:resource}", - "online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/${2:Name}/", - "---", - "", - "# ${1:Name of rule}", - "", - "## SYNOPSIS", - "", - "{{ A brief summary of the rule }}", - "", - "## DESCRIPTION", - "", - "{{ A detailed description of the rule }}", - "", - "## RECOMMENDATION", - "", - "{{ A detailed explanation of the steps required to pass the rule }}", - "", - "## EXAMPLES", - "", - "### Configure with Azure template", - "", - "To deploy ${3:resource} that pass this rule:", - "", - "- steps", - "", - "For example:", - "", - "```json", - "", - "```", - "", - "### Configure with Bicep", - "", - "To deploy ${3:resource} that pass this rule:", - "", - "- steps", - "", - "For example:", - "", - "```bicep", - "", - "```", - "", - "## NOTES", - "", - "{{ Additional information or configuration options }}", - "", - "## LINKS", - "", - "{{ Links to external references }}", - "" - ] - }, - "rule-azure-example-arm": { - "scope": "markdown", - "prefix": "rule-azure-example-arm", - "description": "Example for Azure template", - "body": [ - "### Configure with Azure template", - "", - "To deploy ${1:resource} that pass this rule:", - "", - "- ${2:steps}", - "", - "For example:", - "", - "```json", - "", - "```" - ] - }, - "rule-azure-example-cli": { - "scope": "markdown", - "prefix": "rule-azure-example-cli", - "description": "Example for Azure CLI", - "body": [ - "### Configure with Azure CLI", - "", - "```bash", - "az ${1:command} -n '' -g ''", - "```" - ] - }, - "rule-azure-example-pwsh": { - "scope": "markdown", - "prefix": "rule-azure-example-pwsh", - "description": "Example for Azure PowerShell", - "body": [ - "### Configure with Azure PowerShell", - "", - "```powershell", - "${1:command} -Name '' -ResourceGroupName ''", - "```" - ] - }, - "rule-azure-example-bicep": { - "scope": "markdown", - "prefix": "rule-azure-example-bicep", - "description": "Example for Bicep", - "body": [ - "### Configure with Bicep", - "", - "To deploy ${1:resource} that pass this rule:", - "", - "- ${2:steps}", - "", - "For example:", - "", - "```bicep", - "", - "```" - ] - } + "Azure rule documentation": { + "scope": "markdown", + "prefix": "rule-azure", + "description": "Azure rule documentation", + "body": [ + "---", + "reviewed: 2022-mm-dd", + "severity: ${4:severity}", + "pillar: ${5:pillar}", + "category: ${6:category}", + "resource: ${3:resource}", + "online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/${2:Name}/", + "---", + "", + "# ${1:Name of rule}", + "", + "## SYNOPSIS", + "", + "{{ A brief summary of the rule }}", + "", + "## DESCRIPTION", + "", + "{{ A detailed description of the rule }}", + "", + "## RECOMMENDATION", + "", + "{{ A detailed explanation of the steps required to pass the rule }}", + "", + "## EXAMPLES", + "", + "### Configure with Azure template", + "", + "To deploy ${3:resource} that pass this rule:", + "", + "- steps", + "", + "For example:", + "", + "```json", + "", + "```", + "", + "### Configure with Bicep", + "", + "To deploy ${3:resource} that pass this rule:", + "", + "- steps", + "", + "For example:", + "", + "```bicep", + "", + "```", + "", + "## NOTES", + "", + "{{ Additional information or configuration options }}", + "", + "## LINKS", + "", + "{{ Links to external references }}", + "" + ] + }, + "rule-azure-example-arm": { + "scope": "markdown", + "prefix": "rule-azure-example-arm", + "description": "Example for Azure template", + "body": [ + "### Configure with Azure template", + "", + "To deploy ${1:resource} that pass this rule:", + "", + "- ${2:steps}", + "", + "For example:", + "", + "```json", + "", + "```" + ] + }, + "rule-azure-example-cli": { + "scope": "markdown", + "prefix": "rule-azure-example-cli", + "description": "Example for Azure CLI", + "body": [ + "### Configure with Azure CLI", + "", + "```bash", + "az ${1:command} -n '' -g ''", + "```" + ] + }, + "rule-azure-example-pwsh": { + "scope": "markdown", + "prefix": "rule-azure-example-pwsh", + "description": "Example for Azure PowerShell", + "body": [ + "### Configure with Azure PowerShell", + "", + "```powershell", + "${1:command} -Name '' -ResourceGroupName ''", + "```" + ] + }, + "rule-azure-example-bicep": { + "scope": "markdown", + "prefix": "rule-azure-example-bicep", + "description": "Example for Bicep", + "body": [ + "### Configure with Bicep", + "", + "To deploy ${1:resource} that pass this rule:", + "", + "- ${2:steps}", + "", + "For example:", + "", + "```bicep", + "", + "```" + ] + } } diff --git a/.vscode/powershell.code-snippets b/.vscode/powershell.code-snippets index d738f1108c..2bbc87b4a8 100644 --- a/.vscode/powershell.code-snippets +++ b/.vscode/powershell.code-snippets @@ -1,13 +1,13 @@ { - "rule-azure": { - "scope": "powershell", - "prefix": "rule-azure", - "description": "Rule definition for Azure", - "body": [ - "# Synopsis: ${2}", - "Rule '${1}' -Type '${3}' -Tag @{ release = ''; ruleSet = ''; } {", - "\t$0", - "}" - ] - } + "rule-azure": { + "scope": "powershell", + "prefix": "rule-azure", + "description": "Rule definition for Azure", + "body": [ + "# Synopsis: ${2}", + "Rule '${1}' -Type '${3}' -Tag @{ release = ''; ruleSet = ''; } {", + "\t$0", + "}" + ] + } } diff --git a/.vscode/yaml.code-snippets b/.vscode/yaml.code-snippets index e2fe51af1b..dbc9254d4e 100644 --- a/.vscode/yaml.code-snippets +++ b/.vscode/yaml.code-snippets @@ -1,23 +1,23 @@ { - "Azure rule with type": { - "prefix": "rule-azure-with-type", - "description": "Rule definition for Azure", - "body": [ - "---", - "# Synopsis: ${2}", - "apiVersion: github.com/microsoft/PSRule/v1", - "kind: Rule", - "metadata:", - " name: ${1}", - " ref: AZR-000nnn", - " tags:", - " release: 'GA'", - " ruleSet: '${3}'", - "spec:", - " type:", - " - ${4}", - " condition:", - " ${5}" - ] - } + "Azure rule with type": { + "prefix": "rule-azure-with-type", + "description": "Rule definition for Azure", + "body": [ + "---", + "# Synopsis: ${2}", + "apiVersion: github.com/microsoft/PSRule/v1", + "kind: Rule", + "metadata:", + " name: ${1}", + " ref: AZR-000nnn", + " tags:", + " release: 'GA'", + " ruleSet: '${3}'", + "spec:", + " type:", + " - ${4}", + " condition:", + " ${5}" + ] + } }