Skip to content

Commit

Permalink
Update tooling for .NET 8 (#3018)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite committed Aug 14, 2024
1 parent 2391c3b commit 39aa1e4
Show file tree
Hide file tree
Showing 15 changed files with 243 additions and 42 deletions.
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"gitversion.tool": {
"version": "5.12.0",
"commands": [
"dotnet-gitversion"
],
"rollForward": false
}
}
}
12 changes: 0 additions & 12 deletions .devcontainer/Dockerfile

This file was deleted.

10 changes: 9 additions & 1 deletion .devcontainer/container-build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
36 changes: 17 additions & 19 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_VERSION: 7.x
DOTNET_VERSION: 8.x

jobs:
build:
Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ 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.
[#11](https://github.com/Azure/PSRule.Rules.Azure/issues/11)
- 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)

Expand Down
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.400",
"rollForward": "latestFeature"
}
}
5 changes: 5 additions & 0 deletions src/PSRule.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<!-- <Nullable>enable</Nullable> -->
<!-- <ImplicitUsings>enable</ImplicitUsings> -->
<NeutralLanguage>en-US</NeutralLanguage>
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(CI)' == 'true' And '$(GITHUB_ACTIONS)' != 'true'">true</RestoreLockedMode>
</PropertyGroup>

<!-- Package metadata -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProjectGuid>{9bb90abe-25f9-4110-af9f-149b0618b2a0}</ProjectGuid>
<RepositoryUrl>https://github.com/Azure/PSRule.Rules.Azure</RepositoryUrl>
Expand All @@ -19,9 +19,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.12" />
<PackageReference Include="System.Management.Automation" Version="7.3.12" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.4" />
<PackageReference Include="System.Management.Automation" Version="7.4.4" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\PSRule.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ProjectGuid>{218b2d45-a2bd-4966-9b9f-4064cd68ba8a}</ProjectGuid>
<EnableNuget>false</EnableNuget>
<IsPackable>false</IsPackable>
Expand Down
53 changes: 53 additions & 0 deletions src/PSRule.Rules.Azure.BuildTool/packages.lock.json
Original file line number Diff line number Diff line change
@@ -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=="
}
}
}
}
65 changes: 65 additions & 0 deletions src/PSRule.Rules.Azure/packages.lock.json
Original file line number Diff line number Diff line change
@@ -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=="
}
}
}
}
58 changes: 58 additions & 0 deletions src/SDK/packages.lock.json
Original file line number Diff line number Diff line change
@@ -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, )"
}
}
}
}
}
Loading

0 comments on commit 39aa1e4

Please sign in to comment.