diff --git a/.azure-pipelines/azure-pipelines.yaml b/.azure-pipelines/azure-pipelines.yaml index 121ed65..f621346 100644 --- a/.azure-pipelines/azure-pipelines.yaml +++ b/.azure-pipelines/azure-pipelines.yaml @@ -110,7 +110,8 @@ stages: displayName: 'Complete SonarCloud' - job: Secret_Scan - pool: 'Hosted VS2017' + pool: + vmImage: 'windows-2022' displayName: Secret scan steps: - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 @@ -145,28 +146,29 @@ stages: - template: jobs/test.yaml parameters: name: macOS_10_15 - displayName: 'PowerShell 7.1 - macOS-10.15' + displayName: 'PowerShell 7.2 - macOS-10.15' imageName: 'macOS-10.15' - template: jobs/test.yaml parameters: - name: windows - displayName: 'PowerShell 5.1 - win2016' - imageName: 'vs2017-win2016' + name: ps_5_1_windows_2022 + displayName: 'PowerShell 5.1 - windows-2022' + imageName: 'windows-2022' + pwsh: false + + - template: jobs/test.yaml + parameters: + name: ps_7_2_windows_2022 + displayName: 'PowerShell 7.2 - windows-2022' + imageName: 'windows-2022' + pwsh: true - template: jobs/testContainer.yaml parameters: - name: ps_7_ubuntu_18_04 - displayName: 'PowerShell 7.0 - ubuntu-18.04' + name: ps_7_2_ubuntu_20_04 + displayName: 'PowerShell 7.2 - ubuntu-20.04' imageName: mcr.microsoft.com/powershell - imageTag: 7.1.5-ubuntu-18.04 - - - template: jobs/testContainer.yaml - parameters: - name: ps_7_1_ubuntu_20_04 - displayName: 'PowerShell 7.1 - ubuntu-20.04' - imageName: mcr.microsoft.com/powershell - imageTag: 7.1.5-ubuntu-20.04 + imageTag: 7.2.2-ubuntu-20.04 # Release pipeline - stage: Release diff --git a/.azure-pipelines/jobs/test.yaml b/.azure-pipelines/jobs/test.yaml index 70d09f5..9aae860 100644 --- a/.azure-pipelines/jobs/test.yaml +++ b/.azure-pipelines/jobs/test.yaml @@ -2,12 +2,35 @@ # CI job for running VM pipelines parameters: - name: '' - displayName: '' - buildConfiguration: 'Release' - imageName: '' - coverage: 'false' - publishResults: 'true' + +- name: 'name' + type: 'string' + +- name: 'displayName' + type: 'string' + +- name: 'buildConfiguration' + type: 'string' + default: 'Release' + +- name: 'imageName' + type: 'string' + +- name: 'coverage' + type: 'string' + default: 'false' + +- name: 'publishResults' + type: 'string' + default: 'true' + +- name: 'platform' + type: 'string' + default: 'linux' + +- name: pwsh + type: 'boolean' + default: true jobs: - job: ${{ parameters.name }} @@ -21,7 +44,11 @@ jobs: steps: # Install pipeline dependencies - - powershell: ./.azure-pipelines/pipeline-deps.ps1 + - task: PowerShell@2 + inputs: + targetType: inline + script: ./.azure-pipelines/pipeline-deps.ps1 + pwsh: ${{ parameters.pwsh }} displayName: 'Install dependencies' # Download module @@ -32,7 +59,11 @@ jobs: path: $(Build.SourcesDirectory)/out/modules/PSRule.Monitor # Build module - - powershell: Invoke-Build TestModule -Configuration ${{ parameters.buildConfiguration }} -Build $(Build.BuildNumber) + - task: PowerShell@2 + inputs: + targetType: inline + script: Invoke-Build TestModule -Configuration ${{ parameters.buildConfiguration }} -Build $(Build.BuildNumber)./.azure-pipelines/pipeline-deps.ps1 + pwsh: ${{ parameters.pwsh }} env: COVERAGE: ${{ parameters.coverage }} displayName: 'Test module' diff --git a/.github/workflows/analyze.yaml b/.github/workflows/analyze.yaml index 7584c97..390994e 100644 --- a/.github/workflows/analyze.yaml +++ b/.github/workflows/analyze.yaml @@ -1,20 +1,82 @@ # -# Repository validation +# Repository analysis # + +# NOTES: +# This workflow uses PSRule, CodeQL, and DevSkim. +# You can read more about these linting tools and configuration options here: +# PSRule - https://aka.ms/ps-rule and https://github.com/Microsoft/PSRule.Rules.MSFT.OSS +# CodeQL - https://codeql.github.com/docs/codeql-overview/about-codeql/ +# DevSkim - https://github.com/microsoft/DevSkim-Action and https://github.com/Microsoft/DevSkim + name: Analyze on: -- pull_request + push: + branches: [ main, 'release/*' ] + pull_request: + branches: [ main, 'release/*' ] + schedule: + - cron: '51 20 * * 0' # At 08:51 PM, on Sunday each week + workflow_dispatch: + jobs: - analyze: - name: Analyze repository + oss: + name: Analyze with PSRule runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout uses: actions/checkout@v3 - name: Run PSRule analysis - uses: Microsoft/ps-rule@main + uses: microsoft/ps-rule@v2.1.0 with: modules: PSRule.Rules.MSFT.OSS prerelease: true + + devskim: + name: Analyze with DevSkim + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Run DevSkim scanner + uses: microsoft/DevSkim-Action@v1 + with: + directory-to-scan: src/ + + - name: Upload results to security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: devskim-results.sarif + + codeql: + name: Analyze with CodeQL + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: 'csharp' + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.vscode/settings.json b/.vscode/settings.json index e0ffb12..4681b92 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,5 +24,8 @@ "cmdlet", "cmdlets", "hashtable" - ] + ], + "files.associations": { + "**/.azure-pipelines/**/*.yaml": "azure-pipelines" + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index fb9b7b8..e848493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,21 +2,33 @@ ## Unreleased +What's changed since v0.3.0: + +- Engineering: + - Bump Newtonsoft.Json to v13.0.1. + [#73](https://github.com/microsoft/PSRule.Monitor/pull/73) + ## v0.3.0 What's changed since v0.2.0: - New features: - - Added support for passing through rule annotations. [#29](https://github.com/microsoft/PSRule.Monitor/issues/29) - - Added convention to support ingestion in a pipeline. [#46](https://github.com/microsoft/PSRule.Monitor/issues/46) + - Added support for passing through rule annotations. + [#29](https://github.com/microsoft/PSRule.Monitor/issues/29) + - Added convention to support ingestion in a pipeline. + [#46](https://github.com/microsoft/PSRule.Monitor/issues/46) - To use this feature, include the `Monitor.LogAnalytics.Import` convention. - General improvements: - - Ignore null or empty field and data properties. [#44](https://github.com/microsoft/PSRule.Monitor/issues/44) - - Added `CorrelationId` to ingested events. [#45](https://github.com/microsoft/PSRule.Monitor/issues/44) - - Added configuration of workspace parameter through environment variable. [#32](https://github.com/microsoft/PSRule.Monitor/issues/32) + - Ignore null or empty field and data properties. + [#44](https://github.com/microsoft/PSRule.Monitor/issues/44) + - Added `CorrelationId` to ingested events. + [#45](https://github.com/microsoft/PSRule.Monitor/issues/44) + - Added configuration of workspace parameter through environment variable. + [#32](https://github.com/microsoft/PSRule.Monitor/issues/32) - Set `PSRULE_CONFIGURATION_MONITOR_WORKSPACE_ID` to configure the workspace id. - Set `PSRULE_CONFIGURATION_MONITOR_WORKSPACE_KEY` to configure the shared key. - - Added `Duration_d` that duration in milliseconds that the rule took to execute. [#49](https://github.com/microsoft/PSRule.Monitor/issues/49) + - Added `Duration_d` that duration in milliseconds that the rule took to execute. + [#49](https://github.com/microsoft/PSRule.Monitor/issues/49) What's changed since pre-release v0.3.0-B2108014: @@ -27,20 +39,26 @@ What's changed since pre-release v0.3.0-B2108014: What's changed since pre-release v0.3.0-B2108008: - General improvements: - - Added `Duration_d` that duration in milliseconds that the rule took to execute. [#49](https://github.com/microsoft/PSRule.Monitor/issues/49) + - Added `Duration_d` that duration in milliseconds that the rule took to execute. + [#49](https://github.com/microsoft/PSRule.Monitor/issues/49) ## v0.3.0-B2108008 (pre-release) What's changed since v0.2.0: - New features: - - Added support for passing through rule annotations. [#29](https://github.com/microsoft/PSRule.Monitor/issues/29) - - Added convention to support ingestion in a pipeline. [#46](https://github.com/microsoft/PSRule.Monitor/issues/46) + - Added support for passing through rule annotations. + [#29](https://github.com/microsoft/PSRule.Monitor/issues/29) + - Added convention to support ingestion in a pipeline. + [#46](https://github.com/microsoft/PSRule.Monitor/issues/46) - To use this feature, include the `Monitor.LogAnalytics.Import` convention. - General improvements: - - Ignore null or empty field and data properties. [#44](https://github.com/microsoft/PSRule.Monitor/issues/44) - - Added `CorrelationId` to ingested events. [#45](https://github.com/microsoft/PSRule.Monitor/issues/44) - - Added configuration of workspace parameter through environment variable. [#32](https://github.com/microsoft/PSRule.Monitor/issues/32) + - Ignore null or empty field and data properties. + [#44](https://github.com/microsoft/PSRule.Monitor/issues/44) + - Added `CorrelationId` to ingested events. + [#45](https://github.com/microsoft/PSRule.Monitor/issues/44) + - Added configuration of workspace parameter through environment variable. + [#32](https://github.com/microsoft/PSRule.Monitor/issues/32) - Set `PSRULE_CONFIGURATION_MONITOR_WORKSPACE_ID` to configure the workspace id. - Set `PSRULE_CONFIGURATION_MONITOR_WORKSPACE_KEY` to configure the shared key. @@ -49,8 +67,10 @@ What's changed since v0.2.0: What's changed since v0.1.0: - New features: - - Added support for passing through data and field properties. [#31](https://github.com/microsoft/PSRule.Monitor/issues/31) - - Added support for passing through rule module name. [#30](https://github.com/microsoft/PSRule.Monitor/issues/30) + - Added support for passing through data and field properties. + [#31](https://github.com/microsoft/PSRule.Monitor/issues/31) + - Added support for passing through rule module name. + [#30](https://github.com/microsoft/PSRule.Monitor/issues/30) What's changed since pre-release v0.2.0-B2104009: @@ -61,15 +81,18 @@ What's changed since pre-release v0.2.0-B2104009: What's changed since v0.1.0: - New features: - - Added support for passing through data and field properties. [#31](https://github.com/microsoft/PSRule.Monitor/issues/31) - - Added support for passing through rule module name. [#30](https://github.com/microsoft/PSRule.Monitor/issues/30) + - Added support for passing through data and field properties. + [#31](https://github.com/microsoft/PSRule.Monitor/issues/31) + - Added support for passing through rule module name. + [#30](https://github.com/microsoft/PSRule.Monitor/issues/30) ## v0.1.0 What's changed since pre-release v0.1.0-B1912005: - Bug fixes: - - Removed module dependency on `PSRule`. [#13](https://github.com/microsoft/PSRule.Monitor/issues/13) + - Removed module dependency on `PSRule`. + [#13](https://github.com/microsoft/PSRule.Monitor/issues/13) ## v0.1.0-B1912005 (pre-release) diff --git a/src/PSRule.Monitor/PSRule.Monitor.csproj b/src/PSRule.Monitor/PSRule.Monitor.csproj index da5ca2c..e2541ac 100644 --- a/src/PSRule.Monitor/PSRule.Monitor.csproj +++ b/src/PSRule.Monitor/PSRule.Monitor.csproj @@ -31,7 +31,7 @@ This project uses GitHub Issues to track bugs and feature requests. See GitHub p runtime; build; native; contentfiles; analyzers; buildtransitive - +