From 39aa1e45e998eb773ba804e22bc4f2a3a61823fb Mon Sep 17 00:00:00 2001 From: Bernie White Date: Wed, 14 Aug 2024 16:54:57 +1000 Subject: [PATCH] Update tooling for .NET 8 (#3018) --- .config/dotnet-tools.json | 13 ++++ .devcontainer/Dockerfile | 12 ---- .devcontainer/container-build.ps1 | 10 ++- .devcontainer/devcontainer.json | 36 +++++----- .github/workflows/build.yaml | 2 +- docs/CHANGELOG-v1.md | 5 ++ docs/install.md | 4 +- global.json | 6 ++ src/PSRule.Common.props | 5 ++ .../PSRule.Rules.Azure.Benchmark.csproj | 8 ++- .../PSRule.Rules.Azure.BuildTool.csproj | 2 +- .../packages.lock.json | 53 +++++++++++++++ src/PSRule.Rules.Azure/packages.lock.json | 65 +++++++++++++++++++ src/SDK/packages.lock.json | 58 +++++++++++++++++ .../PSRule.Rules.Azure.Tests.csproj | 6 +- 15 files changed, 243 insertions(+), 42 deletions(-) create mode 100644 .config/dotnet-tools.json delete mode 100644 .devcontainer/Dockerfile create mode 100644 global.json create mode 100644 src/PSRule.Rules.Azure.BuildTool/packages.lock.json create mode 100644 src/PSRule.Rules.Azure/packages.lock.json create mode 100644 src/SDK/packages.lock.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000000..ba73e9cdeef --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "gitversion.tool": { + "version": "5.12.0", + "commands": [ + "dotnet-gitversion" + ], + "rollForward": false + } + } +} diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 4ad86c42c0b..00000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -# Visual Studio Code image with .NET - -# NOTE: -# See here for image contents: https://github.com/devcontainers/images/tree/main/src/dotnet - -ARG VARIANT="7.0-bullseye-slim" -FROM mcr.microsoft.com/vscode/devcontainers/dotnet:${VARIANT} - -RUN sudo apt update -y && sudo apt install python3-pip python3-wheel -y diff --git a/.devcontainer/container-build.ps1 b/.devcontainer/container-build.ps1 index a01331b2b62..a0b0b203d61 100644 --- a/.devcontainer/container-build.ps1 +++ b/.devcontainer/container-build.ps1 @@ -5,10 +5,18 @@ # This is run during container creation. # Install Python 3 dependencies -sudo apt install python3-pip -y +sudo apt-get update +sudo apt-get install dotnet-sdk-8.0 -y +sudo apt-get install python3-pip -y sudo python3 -m pip install --upgrade pip sudo python3 -m pip install wheel +# Install Python packages +pip install -r requirements-docs.txt + +# Restore .NET packages +dotnet restore + # Install PowerShell dependencies $ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue; if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) { diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 40d25c8dbd9..039fec40f37 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,18 +1,20 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { "name": "PSRule for Azure Developer Codespace", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm", "customizations": { "vscode": { "settings": { "terminal.integrated.defaultProfile.linux": "pwsh", "terminal.integrated.profiles.linux": { "pwsh": { - "path": "/opt/microsoft/powershell/7/pwsh" + "path": "/usr/local/bin/pwsh" } - }, - "powershell.powerShellDefaultVersion": "PowerShell" + } }, "extensions": [ - "ms-dotnettools.vscode-dotnet-runtime", "ms-dotnettools.csdevkit", "ms-vscode.powershell", "ms-azuretools.vscode-bicep", @@ -21,29 +23,25 @@ "github.vscode-github-actions", "bewhite.psrule-vscode-preview", "davidanson.vscode-markdownlint", + "streetsidesoftware.code-spell-checker", "eamodio.gitlens", - "streetsidesoftware.code-spell-checker" + "ms-sarifvscode.sarif-viewer", + "github.vscode-github-actions" ] } }, "features": { - "ghcr.io/devcontainers/features/github-cli": { + "ghcr.io/devcontainers/features/github-cli:1": { "version": "latest" }, - "ghcr.io/devcontainers/features/powershell": { + "ghcr.io/devcontainers/features/powershell:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/python:1": { "version": "latest" } }, - "onCreateCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-build.ps1", - "postStartCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-start.ps1", - "build": { - "dockerfile": "Dockerfile", - "args": { - "VARIANT": "7.0-bullseye-slim" - } - }, - "remoteUser": "vscode", - "forwardPorts": [ - 8000 - ] + "onCreateCommand": "sudo chown -R vscode:vscode /opt/microsoft/powershell/7/pwsh && sudo chmod u+x /opt/microsoft/powershell/7/pwsh && wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && sudo dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb && sudo apt-get update && sudo apt-get install dotnet-sdk-8.0 -y && sudo apt-get install python3-pip -y", + "updateContentCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-build.ps1", + "postStartCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-start.ps1" } diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 41d8736ccac..5a89be05e07 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ on: env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_VERSION: 7.x + DOTNET_VERSION: 8.x jobs: build: diff --git a/docs/CHANGELOG-v1.md b/docs/CHANGELOG-v1.md index 5a61593ed80..bb3cf93c002 100644 --- a/docs/CHANGELOG-v1.md +++ b/docs/CHANGELOG-v1.md @@ -29,6 +29,8 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers ## Unreleased +What's changed since pre-release v1.39.0-B0029: + - New rules: - Virtual Machine: - Verify that virtual machines does not have public IPs attached by @BenjaminEngeset. @@ -36,6 +38,9 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers - Virtual Machine Scale Sets: - Verify that virtual machine scale set instances does not have public IPs attached by @BenjaminEngeset. [#3014](https://github.com/Azure/PSRule.Rules.Azure/issues/3014) +- Engineering: + - Bump development tools to .NET 8.0 SDK by @BernieWhite. + [#3017](https://github.com/Azure/PSRule.Rules.Azure/issues/3017) ## v1.39.0-B0029 (pre-release) diff --git a/docs/install.md b/docs/install.md index fa81be425d2..39760234a14 100644 --- a/docs/install.md +++ b/docs/install.md @@ -259,9 +259,9 @@ This build script will compile the module and documentation then output the resu | Operating System | Tool | Overview | Installation Link | | ---------------- | ---- | -------- | ----------------- | | Windows | Windows PowerShell | Support for version 5.1 with .NET Framework 4.7.2 or greater. | [link](https://dotnet.microsoft.com/download/dotnet-framework/net48) | -| Windows, MacOS, Linux | PowerShell | Version 7.3 or greater is support. | [link](https://github.com/PowerShell/PowerShell#get-powershell) | +| Windows, MacOS, Linux | PowerShell | Version 7.4 or greater is support. | [link](https://github.com/PowerShell/PowerShell#get-powershell) | | - | - | Multiple PowerShell modules are required (PlatyPS, Pester, PSScriptAnalyzer, PowerShellGet, PackageManagement, InvokeBuild, PSRule). | Installed when you run the `build.ps1` script | -| - | .NET | .NET SDK v7 is required. | [link](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) | +| - | .NET | .NET SDK v8 is required. | [link](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) | | - | Bicep CLI | PSRule depends on the Bicep CLI to expand Bicep modules to ARM | [link](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install) | The following dependencies will be automatically installed if the required versions are not present: diff --git a/global.json b/global.json new file mode 100644 index 00000000000..ae9f38c48f8 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.400", + "rollForward": "latestFeature" + } +} diff --git a/src/PSRule.Common.props b/src/PSRule.Common.props index 03aa6af4e31..deac517571e 100644 --- a/src/PSRule.Common.props +++ b/src/PSRule.Common.props @@ -4,13 +4,18 @@ netstandard2.0 9.0 + + en-US true portable true snupkg true + true + true + true diff --git a/src/PSRule.Rules.Azure.Benchmark/PSRule.Rules.Azure.Benchmark.csproj b/src/PSRule.Rules.Azure.Benchmark/PSRule.Rules.Azure.Benchmark.csproj index 0f78433cec2..ed98a69268b 100644 --- a/src/PSRule.Rules.Azure.Benchmark/PSRule.Rules.Azure.Benchmark.csproj +++ b/src/PSRule.Rules.Azure.Benchmark/PSRule.Rules.Azure.Benchmark.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 AnyCPU {9bb90abe-25f9-4110-af9f-149b0618b2a0} https://github.com/Azure/PSRule.Rules.Azure @@ -19,9 +19,11 @@ - - + + + + diff --git a/src/PSRule.Rules.Azure.BuildTool/PSRule.Rules.Azure.BuildTool.csproj b/src/PSRule.Rules.Azure.BuildTool/PSRule.Rules.Azure.BuildTool.csproj index 141bd41fe01..4d8e6261867 100644 --- a/src/PSRule.Rules.Azure.BuildTool/PSRule.Rules.Azure.BuildTool.csproj +++ b/src/PSRule.Rules.Azure.BuildTool/PSRule.Rules.Azure.BuildTool.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 {218b2d45-a2bd-4966-9b9f-4064cd68ba8a} false false diff --git a/src/PSRule.Rules.Azure.BuildTool/packages.lock.json b/src/PSRule.Rules.Azure.BuildTool/packages.lock.json new file mode 100644 index 00000000000..0c28b753ad8 --- /dev/null +++ b/src/PSRule.Rules.Azure.BuildTool/packages.lock.json @@ -0,0 +1,53 @@ +{ + "version": 1, + "dependencies": { + "net8.0": { + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "Newtonsoft.Json": { + "type": "Direct", + "requested": "[13.0.3, )", + "resolved": "13.0.3", + "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" + }, + "System.CommandLine": { + "type": "Direct", + "requested": "[2.0.0-beta1.21308.1, )", + "resolved": "2.0.0-beta1.21308.1", + "contentHash": "X8qLygjyktfmcNMNFekMkumyaTblJmkH3BBbKiQlk4FvJfp613gkMKrA0CNqLUT9tEfLcm3XMzAbsiYFwM8zbQ==", + "dependencies": { + "Microsoft.CSharp": "4.4.1", + "system.memory": "4.5.4" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.4.1", + "contentHash": "A5hI3gk6WpcBI0QGZY6/d5CCaYUxJgi7iENn1uYEng+Olo8RfI5ReGVkjXjeu3VR3srLvVYREATXa2M0X7FYJA==" + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" + } + } + } +} \ No newline at end of file diff --git a/src/PSRule.Rules.Azure/packages.lock.json b/src/PSRule.Rules.Azure/packages.lock.json new file mode 100644 index 00000000000..76a8b3fdbf0 --- /dev/null +++ b/src/PSRule.Rules.Azure/packages.lock.json @@ -0,0 +1,65 @@ +{ + "version": 1, + "dependencies": { + ".NETStandard,Version=v2.0": { + "Microsoft.CodeAnalysis.NetAnalyzers": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "DxiTgkCl3CGq1rYmBX2wjY7XGbxiBdL4J+/AJIAFLKy5z70NxhnVRnPghnicXZ8oF6JKVXlW3xwznRbI3ioEKg==" + }, + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "NETStandard.Library": { + "type": "Direct", + "requested": "[2.0.3, )", + "resolved": "2.0.3", + "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "Newtonsoft.Json": { + "type": "Direct", + "requested": "[13.0.3, )", + "resolved": "13.0.3", + "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" + }, + "PowerShellStandard.Library": { + "type": "Direct", + "requested": "[5.1.1, )", + "resolved": "5.1.1", + "contentHash": "e31xJjG+Kjbv6YF3Yq6D4Dl3or8v7LrNF41k3CXrWozW6hR1zcOe5KYuZJaGSiAgLnwP8wcW+I3+IWEzMPZKXQ==" + }, + "YamlDotNet": { + "type": "Direct", + "requested": "[11.2.1, )", + "resolved": "11.2.1", + "contentHash": "tBt8K+korVfrjH9wyDEhiLKxbs8qoLCLIFwvYgkSUuMC9//w3z0cFQ8LQAI/5MCKq+BMil0cfRTRvPeE7eXhQw==" + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.NETCore.Platforms": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + } + } + } +} \ No newline at end of file diff --git a/src/SDK/packages.lock.json b/src/SDK/packages.lock.json new file mode 100644 index 00000000000..61da56e3b6d --- /dev/null +++ b/src/SDK/packages.lock.json @@ -0,0 +1,58 @@ +{ + "version": 1, + "dependencies": { + ".NETStandard,Version=v2.0": { + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "NETStandard.Library": { + "type": "Direct", + "requested": "[2.0.3, )", + "resolved": "2.0.3", + "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.NETCore.Platforms": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.3", + "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" + }, + "YamlDotNet": { + "type": "Transitive", + "resolved": "11.2.1", + "contentHash": "tBt8K+korVfrjH9wyDEhiLKxbs8qoLCLIFwvYgkSUuMC9//w3z0cFQ8LQAI/5MCKq+BMil0cfRTRvPeE7eXhQw==" + }, + "Microsoft.PSRule.Rules.Azure.Core": { + "type": "Project", + "dependencies": { + "Newtonsoft.Json": "[13.0.3, )", + "YamlDotNet": "[11.2.1, )" + } + } + } + } +} \ No newline at end of file diff --git a/tests/PSRule.Rules.Azure.Tests/PSRule.Rules.Azure.Tests.csproj b/tests/PSRule.Rules.Azure.Tests/PSRule.Rules.Azure.Tests.csproj index 7bb9d080186..2ef978406ee 100644 --- a/tests/PSRule.Rules.Azure.Tests/PSRule.Rules.Azure.Tests.csproj +++ b/tests/PSRule.Rules.Azure.Tests/PSRule.Rules.Azure.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 {28251f7f-fc8c-495b-af73-d134f642ffb9} true false @@ -11,8 +11,8 @@ - - + + all