Added project files (#3)
This commit is contained in:
Родитель
d02ee81532
Коммит
d06f5f1bb9
|
@ -0,0 +1,194 @@
|
||||||
|
# Azure DevOps
|
||||||
|
# CI pipeline for PSRule.Rules.MSFT.OSS
|
||||||
|
|
||||||
|
variables:
|
||||||
|
version: '0.1.0'
|
||||||
|
buildConfiguration: 'Release'
|
||||||
|
disable.coverage.autogenerate: 'true'
|
||||||
|
imageName: 'ubuntu-18.04'
|
||||||
|
|
||||||
|
# Use build number format, i.e. 0.1.0-B2007001
|
||||||
|
name: $(version)-B$(date:yyMM)$(rev:rrr)
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- 'main'
|
||||||
|
tags:
|
||||||
|
include:
|
||||||
|
- 'v0.*'
|
||||||
|
|
||||||
|
pr:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
stages:
|
||||||
|
|
||||||
|
# Build pipeline
|
||||||
|
- stage: Build
|
||||||
|
displayName: Build
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- job:
|
||||||
|
pool:
|
||||||
|
vmImage: $(imageName)
|
||||||
|
displayName: 'Module'
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# Install pipeline dependencies
|
||||||
|
- powershell: ./.azure-pipelines/pipeline-deps.ps1
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
# Build module
|
||||||
|
- powershell: Invoke-Build -Configuration $(buildConfiguration) -Build $(Build.BuildNumber)
|
||||||
|
displayName: 'Build module'
|
||||||
|
|
||||||
|
# DotNet test results
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
displayName: 'Publish unit test results'
|
||||||
|
inputs:
|
||||||
|
testRunTitle: 'DotNet on $(imageName)'
|
||||||
|
testRunner: VSTest
|
||||||
|
testResultsFiles: 'reports/*.trx'
|
||||||
|
mergeTestResults: true
|
||||||
|
platform: $(imageName)
|
||||||
|
configuration: $(buildConfiguration)
|
||||||
|
publishRunAttachments: true
|
||||||
|
condition: succeededOrFailed()
|
||||||
|
|
||||||
|
# PSRule results
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
displayName: 'Publish PSRule results'
|
||||||
|
inputs:
|
||||||
|
testRunTitle: 'PSRule on $(imageName)'
|
||||||
|
testRunner: NUnit
|
||||||
|
testResultsFiles: 'reports/ps-rule*.xml'
|
||||||
|
mergeTestResults: true
|
||||||
|
platform: $(imageName)
|
||||||
|
configuration: $(buildConfiguration)
|
||||||
|
publishRunAttachments: true
|
||||||
|
condition: succeededOrFailed()
|
||||||
|
|
||||||
|
# Generate artifacts
|
||||||
|
- publish: out/modules/PSRule.Rules.MSFT.OSS
|
||||||
|
displayName: 'Publish module'
|
||||||
|
artifact: PSRule.Rules.MSFT.OSS
|
||||||
|
|
||||||
|
# Analysis pipeline
|
||||||
|
- stage: Analysis
|
||||||
|
displayName: Analysis
|
||||||
|
dependsOn: []
|
||||||
|
variables:
|
||||||
|
# Already run in build stage
|
||||||
|
skipComponentGovernanceDetection: 'true'
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
- job: Secret_Scan
|
||||||
|
pool: 'Hosted VS2017'
|
||||||
|
displayName: Secret scan
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
|
||||||
|
displayName: 'Scan for secrets'
|
||||||
|
inputs:
|
||||||
|
debugMode: false
|
||||||
|
toolMajorVersion: V2
|
||||||
|
|
||||||
|
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
|
||||||
|
displayName: 'Publish scan logs'
|
||||||
|
continueOnError: true
|
||||||
|
|
||||||
|
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@1
|
||||||
|
displayName: 'Check for failures'
|
||||||
|
inputs:
|
||||||
|
CredScan: true
|
||||||
|
ToolLogsNotFoundAction: Error
|
||||||
|
|
||||||
|
# Test pipeline
|
||||||
|
- stage: Test
|
||||||
|
dependsOn: Build
|
||||||
|
variables:
|
||||||
|
# Already run in build stage
|
||||||
|
skipComponentGovernanceDetection: 'true'
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
- template: jobs/test.yaml
|
||||||
|
parameters:
|
||||||
|
name: ubuntu_18_04_coverage
|
||||||
|
imageName: 'ubuntu-18.04'
|
||||||
|
displayName: 'PowerShell coverage'
|
||||||
|
coverage: 'true'
|
||||||
|
publishResults: 'false'
|
||||||
|
|
||||||
|
- template: jobs/test.yaml
|
||||||
|
parameters:
|
||||||
|
name: macOS_10_15
|
||||||
|
displayName: 'PowerShell 7.1 - macOS-10.15'
|
||||||
|
imageName: 'macOS-10.15'
|
||||||
|
|
||||||
|
- template: jobs/test.yaml
|
||||||
|
parameters:
|
||||||
|
name: windows
|
||||||
|
displayName: 'PowerShell 5.1 - win2016'
|
||||||
|
imageName: 'vs2017-win2016'
|
||||||
|
|
||||||
|
- template: jobs/testContainer.yaml
|
||||||
|
parameters:
|
||||||
|
name: ps_7_ubuntu_18_04
|
||||||
|
displayName: 'PowerShell 7.0 - ubuntu-18.04'
|
||||||
|
imageName: mcr.microsoft.com/powershell
|
||||||
|
imageTag: 7.0.0-ubuntu-18.04
|
||||||
|
|
||||||
|
- template: jobs/testContainer.yaml
|
||||||
|
parameters:
|
||||||
|
name: ps_6_ubuntu_18_04
|
||||||
|
displayName: 'PowerShell 6.2.4 - ubuntu-18.04'
|
||||||
|
imageName: mcr.microsoft.com/powershell
|
||||||
|
imageTag: 6.2.4-ubuntu-18.04
|
||||||
|
|
||||||
|
# Release pipeline
|
||||||
|
- stage: Release
|
||||||
|
displayName: Release
|
||||||
|
dependsOn: [ 'Test', 'Analysis' ]
|
||||||
|
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v0.'))
|
||||||
|
variables:
|
||||||
|
# Already run in build stage
|
||||||
|
skipComponentGovernanceDetection: 'true'
|
||||||
|
jobs:
|
||||||
|
- job:
|
||||||
|
displayName: Live
|
||||||
|
pool:
|
||||||
|
vmImage: $(imageName)
|
||||||
|
variables:
|
||||||
|
isPreRelease: $[contains(variables['Build.SourceBranchName'], '-B')]
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# Download module from build
|
||||||
|
- task: DownloadPipelineArtifact@2
|
||||||
|
displayName: 'Download module'
|
||||||
|
inputs:
|
||||||
|
artifact: PSRule.Rules.MSFT.OSS
|
||||||
|
path: $(Build.SourcesDirectory)/out/modules/PSRule.Rules.MSFT.OSS
|
||||||
|
|
||||||
|
# Install pipeline dependencies
|
||||||
|
- powershell: ./.azure-pipelines/pipeline-deps.ps1
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
# Install pipeline dependencies and build module
|
||||||
|
- powershell: Invoke-Build Release -ApiKey $(apiKey)
|
||||||
|
displayName: 'Publish module'
|
||||||
|
|
||||||
|
# Update GitHub release
|
||||||
|
# - task: GitHubRelease@1
|
||||||
|
# displayName: 'GitHub release'
|
||||||
|
# inputs:
|
||||||
|
# gitHubConnection: 'AzureDevOps-PSRule.Rules.MSFT.OSS'
|
||||||
|
# repositoryName: '$(Build.Repository.Name)'
|
||||||
|
# action: edit
|
||||||
|
# tag: '$(Build.SourceBranchName)'
|
||||||
|
# releaseNotesSource: inline
|
||||||
|
# releaseNotesInline: 'See [change log](https://github.com/Microsoft/PSRule.Rules.MSFT.OSS/blob/main/CHANGELOG.md)'
|
||||||
|
# assetUploadMode: replace
|
||||||
|
# addChangeLog: false
|
||||||
|
# isPreRelease: $(isPreRelease)
|
|
@ -0,0 +1,71 @@
|
||||||
|
# Azure DevOps
|
||||||
|
# CI job for running VM pipelines
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
name: ''
|
||||||
|
displayName: ''
|
||||||
|
buildConfiguration: 'Release'
|
||||||
|
imageName: ''
|
||||||
|
coverage: 'false'
|
||||||
|
publishResults: 'true'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: ${{ parameters.name }}
|
||||||
|
displayName: ${{ parameters.displayName }}
|
||||||
|
pool:
|
||||||
|
vmImage: ${{ parameters.imageName }}
|
||||||
|
variables:
|
||||||
|
COVERAGE: ${{ parameters.coverage }}
|
||||||
|
PUBLISHRESULTS: ${{ parameters.publishResults }}
|
||||||
|
skipComponentGovernanceDetection: true
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# Install pipeline dependencies
|
||||||
|
- powershell: ./.azure-pipelines/pipeline-deps.ps1
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
# Download module
|
||||||
|
- task: DownloadPipelineArtifact@2
|
||||||
|
displayName: 'Download module'
|
||||||
|
inputs:
|
||||||
|
artifact: PSRule.Rules.MSFT.OSS
|
||||||
|
path: $(Build.SourcesDirectory)/out/modules/PSRule.Rules.MSFT.OSS
|
||||||
|
|
||||||
|
# Build module
|
||||||
|
- powershell: Invoke-Build TestModule -Configuration ${{ parameters.buildConfiguration }} -Build $(Build.BuildNumber)
|
||||||
|
env:
|
||||||
|
COVERAGE: ${{ parameters.coverage }}
|
||||||
|
displayName: 'Test module'
|
||||||
|
|
||||||
|
# Pester test results
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
displayName: 'Publish Pester results'
|
||||||
|
inputs:
|
||||||
|
testRunTitle: 'Pester on ${{ parameters.imageName }}'
|
||||||
|
testRunner: NUnit
|
||||||
|
testResultsFiles: 'reports/pester-unit.xml'
|
||||||
|
mergeTestResults: true
|
||||||
|
platform: ${{ parameters.name }}
|
||||||
|
configuration: ${{ parameters.buildConfiguration }}
|
||||||
|
publishRunAttachments: true
|
||||||
|
condition: and(succeededOrFailed(), eq(variables['PUBLISHRESULTS'], 'true'))
|
||||||
|
|
||||||
|
# Generate Code Coverage report
|
||||||
|
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
|
||||||
|
displayName: 'Code coverage report generator'
|
||||||
|
inputs:
|
||||||
|
reports: 'reports/pester-coverage.xml'
|
||||||
|
targetdir: 'reports/coverage'
|
||||||
|
sourcedirs: 'src/PSRule.Rules.MSFT.OSS'
|
||||||
|
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;SonarQube;Badges'
|
||||||
|
tag: $(Build.BuildNumber)
|
||||||
|
condition: eq(variables['COVERAGE'], 'true')
|
||||||
|
|
||||||
|
# Publish Code Coverage report
|
||||||
|
- task: PublishCodeCoverageResults@1
|
||||||
|
displayName: 'Publish Pester code coverage'
|
||||||
|
inputs:
|
||||||
|
codeCoverageTool: 'Cobertura'
|
||||||
|
summaryFileLocation: 'reports/coverage/Cobertura.xml'
|
||||||
|
reportDirectory: 'reports/coverage'
|
||||||
|
condition: eq(variables['COVERAGE'], 'true')
|
|
@ -0,0 +1,76 @@
|
||||||
|
# Azure DevOps
|
||||||
|
# CI job for running container pipelines
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
name: ''
|
||||||
|
displayName: ''
|
||||||
|
buildConfiguration: 'Release'
|
||||||
|
vmImage: 'ubuntu-16.04'
|
||||||
|
imageName: ''
|
||||||
|
imageTag: ''
|
||||||
|
coverage: 'false'
|
||||||
|
publishResults: 'true'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: ${{ parameters.name }}
|
||||||
|
displayName: ${{ parameters.displayName }}
|
||||||
|
pool:
|
||||||
|
vmImage: ${{ parameters.vmImage }}
|
||||||
|
container:
|
||||||
|
image: '${{ parameters.imageName }}:${{ parameters.imageTag }}'
|
||||||
|
env:
|
||||||
|
COVERAGE: ${{ parameters.coverage }}
|
||||||
|
PUBLISHRESULTS: ${{ parameters.publishResults }}
|
||||||
|
variables:
|
||||||
|
COVERAGE: ${{ parameters.coverage }}
|
||||||
|
PUBLISHRESULTS: ${{ parameters.publishResults }}
|
||||||
|
skipComponentGovernanceDetection: true
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# Install pipeline dependencies
|
||||||
|
- powershell: ./.azure-pipelines/pipeline-deps.ps1
|
||||||
|
displayName: 'Install dependencies'
|
||||||
|
|
||||||
|
# Download module
|
||||||
|
- task: DownloadPipelineArtifact@2
|
||||||
|
displayName: 'Download module'
|
||||||
|
inputs:
|
||||||
|
artifact: PSRule.Rules.MSFT.OSS
|
||||||
|
path: $(Build.SourcesDirectory)/out/modules/PSRule.Rules.MSFT.OSS
|
||||||
|
|
||||||
|
# Build module
|
||||||
|
- powershell: Invoke-Build TestModule -Configuration ${{ parameters.buildConfiguration }} -Build $(Build.BuildNumber)
|
||||||
|
displayName: 'Test module'
|
||||||
|
|
||||||
|
# Pester test results
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
displayName: 'Publish Pester results'
|
||||||
|
inputs:
|
||||||
|
testRunTitle: 'Pester on ${{ parameters.imageTag }}'
|
||||||
|
testRunner: NUnit
|
||||||
|
testResultsFiles: 'reports/pester-unit.xml'
|
||||||
|
mergeTestResults: true
|
||||||
|
platform: ${{ parameters.imageTag }}
|
||||||
|
configuration: ${{ parameters.buildConfiguration }}
|
||||||
|
publishRunAttachments: true
|
||||||
|
condition: and(succeededOrFailed(), eq(variables['PUBLISHRESULTS'], 'true'))
|
||||||
|
|
||||||
|
# Generate Code Coverage report
|
||||||
|
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
|
||||||
|
displayName: 'Code coverage report generator'
|
||||||
|
inputs:
|
||||||
|
reports: 'reports\pester-coverage.xml'
|
||||||
|
targetdir: 'reports\coverage'
|
||||||
|
sourcedirs: 'src\PSRule.Rules.MSFT.OSS'
|
||||||
|
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;SonarQube;Badges'
|
||||||
|
tag: $(Build.BuildNumber)
|
||||||
|
condition: eq(variables['COVERAGE'], 'true')
|
||||||
|
|
||||||
|
# Publish Code Coverage report
|
||||||
|
- task: PublishCodeCoverageResults@1
|
||||||
|
displayName: 'Publish Pester code coverage'
|
||||||
|
inputs:
|
||||||
|
codeCoverageTool: 'Cobertura'
|
||||||
|
summaryFileLocation: 'reports/coverage/Cobertura.xml'
|
||||||
|
reportDirectory: 'reports/coverage'
|
||||||
|
condition: eq(variables['COVERAGE'], 'true')
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install dependencies for integration with Azure DevOps
|
||||||
|
#
|
||||||
|
|
||||||
|
if ($Env:SYSTEM_DEBUG -eq 'true') {
|
||||||
|
$VerbosePreference = 'Continue';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) {
|
||||||
|
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -ErrorAction Ignore)) {
|
||||||
|
Install-Module PowerShellGet -MinimumVersion 2.2.1 -Scope CurrentUser -Force -AllowClobber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) {
|
||||||
|
Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"extensions": [
|
||||||
|
"ms-azure-devops.azure-pipelines",
|
||||||
|
"ms-vscode.powershell",
|
||||||
|
"davidanson.vscode-markdownlint",
|
||||||
|
"redhat.vscode-yaml",
|
||||||
|
"bewhite.psrule-vscode-preview"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
# https://help.github.com/articles/about-codeowners/
|
||||||
|
* @microsoft/psrule-rules-msft-oss
|
|
@ -0,0 +1,43 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Report errors or unexpected behaviour
|
||||||
|
---
|
||||||
|
|
||||||
|
**Description of the issue**
|
||||||
|
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
|
||||||
|
Steps to reproduce the issue:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**Expected behaviour**
|
||||||
|
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Error output**
|
||||||
|
|
||||||
|
Capture any error messages and or verbose messages with `-Verbose`.
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**Module in use and version:**
|
||||||
|
|
||||||
|
- Module: PSRule.Rules.MSFT.OSS
|
||||||
|
- Version: **[e.g. 0.1.0]**
|
||||||
|
|
||||||
|
Captured output from `$PSVersionTable`:
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
|
||||||
|
Add any other context about the problem here.
|
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
|
||||||
|
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
name: Rule request
|
||||||
|
about: Suggest the creation of a new or to update an existing rule
|
||||||
|
---
|
||||||
|
|
||||||
|
# Rule request
|
||||||
|
|
||||||
|
## Suggested rule change
|
||||||
|
|
||||||
|
A clear and concise description of the what the rule should check and why.
|
||||||
|
|
||||||
|
## Sample data
|
||||||
|
|
||||||
|
Include a sample of passing/ failing JSON data.
|
||||||
|
|
||||||
|
> Only provide sanitized samples, replacing information such as repository and branch names with examples (i.e. repository-A).
|
||||||
|
|
||||||
|
A passing sample:
|
||||||
|
|
||||||
|
```json
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
A failing sample:
|
||||||
|
|
||||||
|
```json
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional context
|
||||||
|
|
||||||
|
Add any other context or references.
|
|
@ -0,0 +1,15 @@
|
||||||
|
## PR Summary
|
||||||
|
|
||||||
|
<!-- summarize your PR between here and the checklist -->
|
||||||
|
|
||||||
|
## PR Checklist
|
||||||
|
|
||||||
|
- [ ] PR has a meaningful title
|
||||||
|
- [ ] Summarized changes
|
||||||
|
- [ ] Change is not breaking
|
||||||
|
- [ ] This PR is ready to merge and is not **Work in Progress**
|
||||||
|
- **Rule changes**
|
||||||
|
- [ ] Unit tests created/ updated
|
||||||
|
- [ ] Rule documentation created/ updated
|
||||||
|
- [ ] Link to a filed issue
|
||||||
|
- [ ] [Change log](https://github.com/Microsoft/PSRule.Rules.MSFT.OSS/blob/main/CHANGELOG.md) has been updated with change under unreleased section
|
|
@ -0,0 +1,19 @@
|
||||||
|
#
|
||||||
|
# Dependabot configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
|
||||||
|
# Maintain dependencies for GitHub Actions
|
||||||
|
- package-ecosystem: 'github-actions'
|
||||||
|
directory: '/'
|
||||||
|
schedule:
|
||||||
|
interval: 'daily'
|
||||||
|
labels:
|
||||||
|
- 'ci-quality'
|
||||||
|
reviewers:
|
||||||
|
- 'microsoft/psrule-rules-msft-oss'
|
|
@ -0,0 +1,21 @@
|
||||||
|
#
|
||||||
|
# Repository validation
|
||||||
|
#
|
||||||
|
name: Analyze
|
||||||
|
on:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Run self analysis
|
||||||
|
- name: Run PSRule analysis (self)
|
||||||
|
uses: Microsoft/ps-rule@main
|
||||||
|
with:
|
||||||
|
source: src/PSRule.Rues.MSFT.OSS/
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
# Synopsis: Use short rule names
|
||||||
|
Rule 'Rule.Name' -Type 'PSRule.Rules.Rule' {
|
||||||
|
Recommend 'Rule name should be less than 35 characters to prevent being truncated.'
|
||||||
|
$Assert.LessOrEqual($TargetObject, 'RuleName', 35)
|
||||||
|
$Assert.StartsWith($TargetObject, 'RuleName', 'MSFT.OSS.')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Complete help documentation
|
||||||
|
Rule 'Rule.Help' -Type 'PSRule.Rules.Rule' {
|
||||||
|
$Assert.HasFieldValue($TargetObject, 'Info.Synopsis')
|
||||||
|
$Assert.HasFieldValue($TargetObject, 'Info.Description')
|
||||||
|
$Assert.HasFieldValue($TargetObject, 'Info.Recommendation')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Use category annotation
|
||||||
|
Rule 'Rule.Annotations' -Type 'PSRule.Rules.Rule' {
|
||||||
|
$Assert.HasFieldValue($TargetObject, 'Info.Annotations.category')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Use online help
|
||||||
|
Rule 'Rule.OnlineHelp' -Type 'PSRule.Rules.Rule' {
|
||||||
|
$Assert.HasFieldValue($TargetObject, 'Info.Annotations.''online version''')
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"ms-vscode.powershell",
|
||||||
|
"ms-azure-devops.azure-pipelines",
|
||||||
|
"redhat.vscode-yaml",
|
||||||
|
"bewhite.psrule-vscode-preview",
|
||||||
|
"streetsidesoftware.code-spell-checker"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"reports/": true,
|
||||||
|
"out/": true,
|
||||||
|
".vs/": true,
|
||||||
|
"**/bin/": true,
|
||||||
|
"**/obj/": true
|
||||||
|
},
|
||||||
|
"search.exclude": {
|
||||||
|
"out/": true
|
||||||
|
},
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"[yaml]": {
|
||||||
|
"editor.tabSize": 2
|
||||||
|
},
|
||||||
|
"[markdown]": {
|
||||||
|
"editor.tabSize": 2
|
||||||
|
},
|
||||||
|
"files.associations": {
|
||||||
|
"**/.azure-pipelines/*.yaml": "azure-pipelines",
|
||||||
|
"**/.azure-pipelines/jobs/*.yaml": "azure-pipelines"
|
||||||
|
},
|
||||||
|
"cSpell.words": [
|
||||||
|
],
|
||||||
|
"cSpell.enabledLanguageIds": [
|
||||||
|
"csharp",
|
||||||
|
"git-commit",
|
||||||
|
"markdown",
|
||||||
|
"plaintext",
|
||||||
|
"powershell",
|
||||||
|
"text",
|
||||||
|
"yaml",
|
||||||
|
"yml"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Test",
|
||||||
|
"type": "shell",
|
||||||
|
"detail": "Build and test module.",
|
||||||
|
"command": "Invoke-Build Test -AssertStyle Client",
|
||||||
|
"group": {
|
||||||
|
"kind": "test",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$pester"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"clear": true,
|
||||||
|
"panel": "dedicated"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Build",
|
||||||
|
"detail": "Build module.",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "Invoke-Build Build",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher": [],
|
||||||
|
"presentation": {
|
||||||
|
"clear": true,
|
||||||
|
"panel": "dedicated"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Clean",
|
||||||
|
"type": "shell",
|
||||||
|
"detail": "Clean output directories.",
|
||||||
|
"command": "Invoke-Build Clean",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "script-analyzer",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "Invoke-Build Analyze",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"presentation": {
|
||||||
|
"clear": true,
|
||||||
|
"panel": "dedicated"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Rule docs",
|
||||||
|
"detail": "Generate rule table of contents.",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "Invoke-Build BuildRuleDocs",
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,4 +1,16 @@
|
||||||
# Contributing
|
# Contributing to PSRule for Microsoft OSS
|
||||||
|
|
||||||
|
Welcome, and thank you for your interest in contributing to PSRule!
|
||||||
|
|
||||||
|
There are many ways in which you can contribute, beyond writing code.
|
||||||
|
The goal of this document is to provide a high-level overview of how you can get involved.
|
||||||
|
|
||||||
|
- [Reporting issues](#reporting-issues)
|
||||||
|
- [Improve documentation](#improving-documentation)
|
||||||
|
- [Adding or improving rules](#adding-or-improving-rules)
|
||||||
|
- Fix bugs or add features
|
||||||
|
|
||||||
|
## Contributor License Agreement (CLA)
|
||||||
|
|
||||||
This project welcomes contributions and suggestions. Most contributions require you to
|
This project welcomes contributions and suggestions. Most contributions require you to
|
||||||
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
|
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
|
||||||
|
@ -15,11 +27,53 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
|
||||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||||
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
|
|
||||||
## How to contribute
|
## Reporting issues
|
||||||
|
|
||||||
- File or vote up issues
|
Have you identified a reproducible problem?
|
||||||
- Improve documentation
|
Have a feature request?
|
||||||
- Fix bugs or add features
|
We want to hear about it!
|
||||||
|
Here's how you can make reporting your issue as effective as possible.
|
||||||
|
|
||||||
|
### Look for an existing issue
|
||||||
|
|
||||||
|
Before you create a new issue, please do a search in [open issues][issues] to see if the issue or feature request has already been filed.
|
||||||
|
|
||||||
|
If you find your issue already exists,
|
||||||
|
make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments).
|
||||||
|
Use a reaction in place of a "+1" comment:
|
||||||
|
|
||||||
|
* 👍 - upvote
|
||||||
|
|
||||||
|
## Improving documentation
|
||||||
|
|
||||||
|
This project contains a wide range of documentation.
|
||||||
|
Some of the documentation that you might like to improve include:
|
||||||
|
|
||||||
|
- Rule recommendations (`src/PSRule.Rules.MSFT.OSS/`).
|
||||||
|
- Scenarios and examples (`docs/scenarios/`).
|
||||||
|
|
||||||
|
### Rule recommendations
|
||||||
|
|
||||||
|
Before improving rule recommendations familiarize yourself with writing [rule markdown documentation](https://microsoft.github.io/PSRule/scenarios/rule-docs/rule-docs.html#writing-markdown-documentation).
|
||||||
|
|
||||||
|
Rule documentation requires the following annotations:
|
||||||
|
|
||||||
|
- `severity`
|
||||||
|
- `category`
|
||||||
|
- `online version`
|
||||||
|
|
||||||
|
## Adding or improving rules
|
||||||
|
|
||||||
|
- Rules are stored in `src/PSRule.Rules.MSFT.OSS/rules/`.
|
||||||
|
- Rule documentation in English is stored in `src/PSRule.Rules.MSFT.OSS/en/`.
|
||||||
|
- Additional cultures can be added in a subdirectory under `src/PSRule.Rules.MSFT.OSS/`.
|
||||||
|
- Use pre-conditions to limit the type of resource a rule applies to.
|
||||||
|
|
||||||
|
**Tips for authoring rules:**
|
||||||
|
|
||||||
|
- To create new rules, snippets in the VS Code extension for PSRule can be used.
|
||||||
|
- Use `-Type` over `-If` pre-conditions when possible.
|
||||||
|
Both may be required in some cases.
|
||||||
|
|
||||||
### Intro to Git and GitHub
|
### Intro to Git and GitHub
|
||||||
|
|
||||||
|
@ -33,17 +87,30 @@ Check out the links below to get started.
|
||||||
- [Fork a repo][github-fork].
|
- [Fork a repo][github-fork].
|
||||||
- [About Pull Requests][github-pr].
|
- [About Pull Requests][github-pr].
|
||||||
|
|
||||||
## Contributing to issues
|
### Code editor
|
||||||
|
|
||||||
- Check if the issue you are going to file already exists in our GitHub [issues](https://github.com/Microsoft/PSRule.Rules.GitHub/issues).
|
You should use the multi-platform [Visual Studio Code][vscode] (VS Code).
|
||||||
- If you do not see your problem captured, please file a new issue and follow the provided template.
|
The project contains a number of workspace specific settings that make it easier to author consistently.
|
||||||
- If the an open issue exists for the problem you are experiencing, vote up the issue or add a comment.
|
|
||||||
|
|
||||||
## Contributing to code
|
After installing VS Code, install the following extensions:
|
||||||
|
|
||||||
- Before writing a fix or feature enhancement, ensure that an issue is logged.
|
- [PSRule](https://marketplace.visualstudio.com/items?itemName=bewhite.psrule-vscode-preview)
|
||||||
- Be prepared to discuss a feature and take feedback.
|
- [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)
|
||||||
- Include unit tests and updates documentation to complement the change.
|
- [PowerShell](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell)
|
||||||
|
- [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
|
||||||
|
|
||||||
|
### Building and testing
|
||||||
|
|
||||||
|
When creating a pull request to merge your changes, a continuous integration (CI) pipeline is run.
|
||||||
|
The CI pipeline will build then test your changes across MacOS, Linux and Windows configurations.
|
||||||
|
|
||||||
|
Before opening a pull request try building your changes locally.
|
||||||
|
To do this See [building from source][build] for instructions.
|
||||||
|
|
||||||
|
## Thank You!
|
||||||
|
|
||||||
|
Your contributions to open source, large or small, make great projects like this possible.
|
||||||
|
Thank you for taking the time to contribute.
|
||||||
|
|
||||||
[learn-git]: https://help.github.com/en/articles/git-and-github-learning-resources
|
[learn-git]: https://help.github.com/en/articles/git-and-github-learning-resources
|
||||||
[github-flow]: https://guides.github.com/introduction/flow/
|
[github-flow]: https://guides.github.com/introduction/flow/
|
||||||
|
@ -51,4 +118,6 @@ Check out the links below to get started.
|
||||||
[github-fork]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo
|
[github-fork]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo
|
||||||
[github-pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
|
[github-pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
|
||||||
[github-pr-create]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork
|
[github-pr-create]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork
|
||||||
[build]: docs/scenarios/install-instructions.md#building-from-source
|
[build]: docs/install-instructions.md#building-from-source
|
||||||
|
[vscode]: https://code.visualstudio.com/
|
||||||
|
[issues]: https://github.com/Microsoft/PSRule.Rules.MSFT.OSS/issues
|
||||||
|
|
30
README.md
30
README.md
|
@ -16,7 +16,35 @@ If you have any problems with the [PSRule][engine] engine, please check the proj
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
**More to come**
|
### Using with GitHub Actions
|
||||||
|
|
||||||
|
1. See [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
|
||||||
|
2. Reference `Microsoft/ps-rule@main` with `modules: 'PSRule.Rules.MSFT.OSS'`
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
#
|
||||||
|
# Repository validation
|
||||||
|
#
|
||||||
|
name: Analyze
|
||||||
|
on:
|
||||||
|
- pull_request
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Run analysis against repository
|
||||||
|
- name: Run PSRule analysis
|
||||||
|
uses: Microsoft/ps-rule@main
|
||||||
|
with:
|
||||||
|
modules: 'PSRule.Rules.MSFT.OSS'
|
||||||
|
```
|
||||||
|
|
||||||
## Changes and versioning
|
## Changes and versioning
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
Document 'module' {
|
||||||
|
Title 'Rules by category'
|
||||||
|
|
||||||
|
Import-Module .\out\modules\PSRule.Rules.MSFT.OSS
|
||||||
|
$rules = Get-PSRule -Module PSRule.Rules.MSFT.OSS -WarningAction SilentlyContinue |
|
||||||
|
Add-Member -MemberType ScriptProperty -Name Category -Value { $this.Info.Annotations.category } -PassThru |
|
||||||
|
Sort-Object -Property Category;
|
||||||
|
|
||||||
|
Section 'Rules' {
|
||||||
|
'The following rules are included within `PSRule.Rules.MSFT.OSS`.'
|
||||||
|
|
||||||
|
$categories = $rules | Group-Object -Property Category;
|
||||||
|
|
||||||
|
foreach ($category in $categories) {
|
||||||
|
Section "$($category.Name)" {
|
||||||
|
$category.Group |
|
||||||
|
Sort-Object -Property RuleName |
|
||||||
|
Table -Property @{ Name = 'Name'; Expression = {
|
||||||
|
"[$($_.RuleName)]($($_.RuleName).md)"
|
||||||
|
}}, Synopsis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
# Note:
|
||||||
|
# This manually builds the project locally
|
||||||
|
|
||||||
|
. ./.azure-pipelines/pipeline-deps.ps1
|
||||||
|
Invoke-Build Test -AssertStyle Client
|
||||||
|
|
||||||
|
Write-Host 'If no build errors occurred. The module has been saved to out/modules/PSRule.Rules.MSFT.OSS'
|
|
@ -0,0 +1,81 @@
|
||||||
|
# Install instructions
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Windows PowerShell 5.1 with .NET Framework 4.7.2+ or
|
||||||
|
- PowerShell Core 6.2 or greater on Windows, MacOS and Linux or
|
||||||
|
- PowerShell 7.0 or greater on Windows, MacOS and Linux
|
||||||
|
|
||||||
|
For a list of platforms that PowerShell 7.0 is supported on [see][get-powershell].
|
||||||
|
|
||||||
|
The following modules are required for `PSRule.Rules.MSFT.OSS` to work:
|
||||||
|
|
||||||
|
- PSRule
|
||||||
|
|
||||||
|
The required version of each module will automatically be installed along-side `PSRule.Rules.MSFT.OSS` when using `Install-Module` or `Update-Module` cmdlets.
|
||||||
|
|
||||||
|
## Getting the modules
|
||||||
|
|
||||||
|
### PowerShell Gallery
|
||||||
|
|
||||||
|
Install from [PowerShell Gallery][module] for all users (requires permissions):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Install module
|
||||||
|
Install-Module -Name 'PSRule.Rules.MSFT.OSS' -Repository PSGallery;
|
||||||
|
```
|
||||||
|
|
||||||
|
Install from [PowerShell Gallery][module] for current user only:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Install module
|
||||||
|
Install-Module -Name 'PSRule.Rules.MSFT.OSS' -Repository PSGallery -Scope CurrentUser;
|
||||||
|
```
|
||||||
|
|
||||||
|
Save for offline use from PowerShell Gallery:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Save module, in the .\modules directory
|
||||||
|
Save-Module -Name 'PSRule', 'PSRule.Rules.MSFT.OSS' -Path '.\modules';
|
||||||
|
```
|
||||||
|
|
||||||
|
> For pre-release versions the `-AllowPrerelease` switch must be added when calling `Install-Module` or `Save-Module`.
|
||||||
|
>
|
||||||
|
> To install pre-release module versions, upgrading to the latest version of _PowerShellGet_ may be required.
|
||||||
|
To do this use:
|
||||||
|
>
|
||||||
|
> `Install-Module -Name PowerShellGet -Repository PSGallery -Scope CurrentUser -Force`
|
||||||
|
|
||||||
|
## Building from source
|
||||||
|
|
||||||
|
To build this module from source run `./build.ps1`.
|
||||||
|
This build script will compile the module and documentation then output the result into `out/modules/PSRule.Rules.MSFT.OSS`.
|
||||||
|
|
||||||
|
The following PowerShell modules will be automatically downloaded if the required versions are not present:
|
||||||
|
|
||||||
|
- PlatyPS
|
||||||
|
- Pester
|
||||||
|
- PSScriptAnalyzer
|
||||||
|
- PowerShellGet
|
||||||
|
- PackageManagement
|
||||||
|
- InvokeBuild
|
||||||
|
|
||||||
|
These additional modules are only required for building PSRule and are not required for running PSRule.
|
||||||
|
|
||||||
|
If you are on a network that does not permit Internet access to the PowerShell Gallery,
|
||||||
|
download these modules on an alternative device that has access.
|
||||||
|
The following script can be used to download the required modules to an alternative device.
|
||||||
|
After downloading the modules copy the module directories to devices with restricted Internet access.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Save modules, in the .\modules directory
|
||||||
|
Save-Module -Name PlatyPS, Pester, PSScriptAnalyzer, PowerShellGet, PackageManagement, InvokeBuild -Repository PSGallery -Path '.\modules';
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally .NET Core SDK v3.1 is required.
|
||||||
|
.NET Core will not be automatically downloaded and installed.
|
||||||
|
To download and install the latest SDK see [Download .NET Core 3.1][dotnet].
|
||||||
|
|
||||||
|
[module]: https://www.powershellgallery.com/packages/PSRule.Rules.MSFT.OSS
|
||||||
|
[get-powershell]: https://github.com/PowerShell/PowerShell#get-powershell
|
||||||
|
[dotnet]: https://dotnet.microsoft.com/download/dotnet-core/3.1
|
|
@ -0,0 +1,20 @@
|
||||||
|
#
|
||||||
|
# Repository validation
|
||||||
|
#
|
||||||
|
name: Analyze
|
||||||
|
on:
|
||||||
|
- pull_request
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Run analysis against repository
|
||||||
|
- name: Run PSRule analysis
|
||||||
|
uses: Microsoft/ps-rule@main
|
||||||
|
with:
|
||||||
|
modules: 'PSRule.Rules.MSFT.OSS'
|
|
@ -0,0 +1,276 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[String]$Build = '0.0.1',
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[String]$Configuration = 'Debug',
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[String]$ApiKey,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[Switch]$CodeCoverage = $False,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[String]$ArtifactPath = (Join-Path -Path $PWD -ChildPath out/modules),
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[String]$AssertStyle = 'AzurePipelines'
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host -Object "[Pipeline] -- PowerShell: v$($PSVersionTable.PSVersion.ToString())" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- PWD: $PWD" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- ArtifactPath: $ArtifactPath" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- BuildNumber: $($Env:BUILD_BUILDNUMBER)" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- SourceBranch: $($Env:BUILD_SOURCEBRANCH)" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- SourceBranchName: $($Env:BUILD_SOURCEBRANCHNAME)" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- Culture: $((Get-Culture).Name), $((Get-Culture).Parent)" -ForegroundColor Green;
|
||||||
|
|
||||||
|
if ($Env:SYSTEM_DEBUG -eq 'true') {
|
||||||
|
$VerbosePreference = 'Continue';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Env:BUILD_SOURCEBRANCH -like '*/tags/*' -and $Env:BUILD_SOURCEBRANCHNAME -like 'v0.*') {
|
||||||
|
$Build = $Env:BUILD_SOURCEBRANCHNAME.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$version = $Build;
|
||||||
|
$versionSuffix = [String]::Empty;
|
||||||
|
|
||||||
|
if ($version -like '*-*') {
|
||||||
|
[String[]]$versionParts = $version.Split('-', [System.StringSplitOptions]::RemoveEmptyEntries);
|
||||||
|
$version = $versionParts[0];
|
||||||
|
|
||||||
|
if ($versionParts.Length -eq 2) {
|
||||||
|
$versionSuffix = $versionParts[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host -Object "[Pipeline] -- Using version: $version" -ForegroundColor Green;
|
||||||
|
Write-Host -Object "[Pipeline] -- Using versionSuffix: $versionSuffix" -ForegroundColor Green;
|
||||||
|
|
||||||
|
if ($Env:COVERAGE -eq 'true') {
|
||||||
|
$CodeCoverage = $True;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Copy the PowerShell modules files to the destination path
|
||||||
|
function CopyModuleFiles {
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[String]$Path,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[String]$DestinationPath
|
||||||
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
|
$sourcePath = Resolve-Path -Path $Path;
|
||||||
|
|
||||||
|
Get-ChildItem -Path $sourcePath -Recurse -File -Include *.ps1,*.psm1,*.psd1,*.ps1xml,*.yaml,*.md | Where-Object -FilterScript {
|
||||||
|
($_.FullName -notmatch '(\.(cs|csproj)|(\\|\/)(obj|bin))')
|
||||||
|
} | ForEach-Object -Process {
|
||||||
|
$filePath = $_.FullName.Replace($sourcePath, $destinationPath);
|
||||||
|
|
||||||
|
$parentPath = Split-Path -Path $filePath -Parent;
|
||||||
|
|
||||||
|
if (!(Test-Path -Path $parentPath)) {
|
||||||
|
$Null = New-Item -Path $parentPath -ItemType Directory -Force;
|
||||||
|
}
|
||||||
|
|
||||||
|
Copy-Item -Path $_.FullName -Destination $filePath -Force;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task VersionModule ModuleDependencies, {
|
||||||
|
$modulePath = Join-Path -Path $ArtifactPath -ChildPath PSRule.Rules.MSFT.OSS;
|
||||||
|
$manifestPath = Join-Path -Path $modulePath -ChildPath PSRule.Rules.MSFT.OSS.psd1;
|
||||||
|
Write-Verbose -Message "[VersionModule] -- Checking module path: $modulePath";
|
||||||
|
|
||||||
|
if (![String]::IsNullOrEmpty($Build)) {
|
||||||
|
# Update module version
|
||||||
|
if (![String]::IsNullOrEmpty($version)) {
|
||||||
|
Write-Verbose -Message "[VersionModule] -- Updating module manifest ModuleVersion";
|
||||||
|
Update-ModuleManifest -Path $manifestPath -ModuleVersion $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update pre-release version
|
||||||
|
if (![String]::IsNullOrEmpty($versionSuffix)) {
|
||||||
|
Write-Verbose -Message "[VersionModule] -- Updating module manifest Prerelease";
|
||||||
|
Update-ModuleManifest -Path $manifestPath -Prerelease $versionSuffix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$manifest = Test-ModuleManifest -Path $manifestPath;
|
||||||
|
$requiredModules = $manifest.RequiredModules | ForEach-Object -Process {
|
||||||
|
if ($_.Name -eq 'PSRule' -and $Configuration -eq 'Release') {
|
||||||
|
@{ ModuleName = 'PSRule'; ModuleVersion = '0.22.0' }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@{ ModuleName = $_.Name; ModuleVersion = $_.Version }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Update-ModuleManifest -Path $manifestPath -RequiredModules $requiredModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Publish to PowerShell Gallery
|
||||||
|
task ReleaseModule VersionModule, {
|
||||||
|
$modulePath = (Join-Path -Path $ArtifactPath -ChildPath 'PSRule.Rules.MSFT.OSS');
|
||||||
|
Write-Verbose -Message "[ReleaseModule] -- Checking module path: $modulePath";
|
||||||
|
|
||||||
|
if (!(Test-Path -Path $modulePath)) {
|
||||||
|
Write-Error -Message "[ReleaseModule] -- Module path does not exist";
|
||||||
|
}
|
||||||
|
elseif (![String]::IsNullOrEmpty($ApiKey)) {
|
||||||
|
Publish-Module -Path $modulePath -NuGetApiKey $ApiKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Install NuGet provider
|
||||||
|
task NuGet {
|
||||||
|
if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) {
|
||||||
|
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Install Pester module
|
||||||
|
task Pester NuGet, {
|
||||||
|
if ($Null -eq (Get-InstalledModule -Name Pester -RequiredVersion 4.10.1 -ErrorAction Ignore)) {
|
||||||
|
Install-Module -Name Pester -RequiredVersion 4.10.1 -Scope CurrentUser -Force -SkipPublisherCheck;
|
||||||
|
}
|
||||||
|
Import-Module -Name Pester -RequiredVersion 4.10.1 -Verbose:$False;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Install PSScriptAnalyzer module
|
||||||
|
task PSScriptAnalyzer NuGet, {
|
||||||
|
if ($Null -eq (Get-InstalledModule -Name PSScriptAnalyzer -MinimumVersion 1.18.3 -ErrorAction Ignore)) {
|
||||||
|
Install-Module -Name PSScriptAnalyzer -MinimumVersion 1.18.3 -Scope CurrentUser -Force;
|
||||||
|
}
|
||||||
|
Import-Module -Name PSScriptAnalyzer -Verbose:$False;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Install PSRule
|
||||||
|
task PSRule NuGet, {
|
||||||
|
if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion 0.22.0 -ErrorAction Ignore)) {
|
||||||
|
Install-Module -Name PSRule -Repository PSGallery -MinimumVersion 0.22.0 -Scope CurrentUser -Force;
|
||||||
|
}
|
||||||
|
Import-Module -Name PSRule -Verbose:$False;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Install PSDocs
|
||||||
|
task PSDocs NuGet, {
|
||||||
|
if ($Null -eq (Get-InstalledModule -Name PSDocs -MinimumVersion 0.6.3 -ErrorAction Ignore)) {
|
||||||
|
Install-Module -Name PSDocs -Repository PSGallery -MinimumVersion 0.6.3 -Scope CurrentUser -Force;
|
||||||
|
}
|
||||||
|
Import-Module -Name PSDocs -Verbose:$False;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Install module dependencies
|
||||||
|
task ModuleDependencies NuGet, PSRule, {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
task CopyModule {
|
||||||
|
CopyModuleFiles -Path src/PSRule.Rules.MSFT.OSS -DestinationPath out/modules/PSRule.Rules.MSFT.OSS;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Build modules only
|
||||||
|
task BuildModule CopyModule
|
||||||
|
|
||||||
|
task TestModule ModuleDependencies, Pester, PSScriptAnalyzer, {
|
||||||
|
# Run Pester tests
|
||||||
|
$pesterParams = @{ Path = (Join-Path -Path $PWD -ChildPath tests/PSRule.Rules.MSFT.OSS.Tests); OutputFile = 'reports/pester-unit.xml'; OutputFormat = 'NUnitXml'; PesterOption = @{ IncludeVSCodeMarker = $True }; PassThru = $True; };
|
||||||
|
|
||||||
|
if ($CodeCoverage) {
|
||||||
|
$pesterParams.Add('CodeCoverage', (Join-Path -Path $PWD -ChildPath 'out/modules/**/*.psm1'));
|
||||||
|
$pesterParams.Add('CodeCoverageOutputFile', (Join-Path -Path $PWD -ChildPath 'reports/pester-coverage.xml'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path -Path reports)) {
|
||||||
|
$Null = New-Item -Path reports -ItemType Directory -Force;
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = Invoke-Pester @pesterParams;
|
||||||
|
|
||||||
|
# Throw an error if pester tests failed
|
||||||
|
if ($Null -eq $results) {
|
||||||
|
throw 'Failed to get Pester test results.';
|
||||||
|
}
|
||||||
|
elseif ($results.FailedCount -gt 0) {
|
||||||
|
throw "$($results.FailedCount) tests failed.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task IntegrationTest ModuleDependencies, Pester, {
|
||||||
|
# Run Pester tests
|
||||||
|
$pesterParams = @{ Path = (Join-Path -Path $PWD -ChildPath tests/Integration); OutputFile = 'reports/pester-unit.xml'; OutputFormat = 'NUnitXml'; PesterOption = @{ IncludeVSCodeMarker = $True }; PassThru = $True; };
|
||||||
|
|
||||||
|
if ($CodeCoverage) {
|
||||||
|
$pesterParams.Add('CodeCoverage', (Join-Path -Path $PWD -ChildPath 'out/modules/**/*.psm1'));
|
||||||
|
$pesterParams.Add('CodeCoverageOutputFile', (Join-Path -Path $PWD -ChildPath 'reports/pester-coverage.xml'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path -Path reports)) {
|
||||||
|
$Null = New-Item -Path reports -ItemType Directory -Force;
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = Invoke-Pester @pesterParams;
|
||||||
|
|
||||||
|
# Throw an error if pester tests failed
|
||||||
|
if ($Null -eq $results) {
|
||||||
|
throw 'Failed to get Pester test results.';
|
||||||
|
}
|
||||||
|
elseif ($results.FailedCount -gt 0) {
|
||||||
|
throw "$($results.FailedCount) tests failed.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Run validation
|
||||||
|
task Rules PSRule, {
|
||||||
|
$assertParams = @{
|
||||||
|
Path = './.ps-rule/'
|
||||||
|
Style = $AssertStyle
|
||||||
|
OutputFormat = 'NUnit3'
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
Import-Module (Join-Path -Path $PWD -ChildPath out/modules/PSRule.Rules.MSFT.OSS) -Force;
|
||||||
|
Assert-PSRule @assertParams -InputPath $PWD -Format File -OutputPath reports/ps-rule-file.xml;
|
||||||
|
|
||||||
|
$rules = Get-PSRule -Module PSRule.Rules.MSFT.OSS;
|
||||||
|
$rules | Assert-PSRule @assertParams -OutputPath reports/ps-rule-file2.xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Run script analyzer
|
||||||
|
task Analyze Build, PSScriptAnalyzer, {
|
||||||
|
Invoke-ScriptAnalyzer -Path out/modules/PSRule.Rules.MSFT.OSS;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Build table of content for rules
|
||||||
|
task BuildRuleDocs Build, PSRule, PSDocs, {
|
||||||
|
$Null = Invoke-PSDocument -Name module -OutputPath src/PSRule.Rules.MSFT.OSS/en/ -Path .\RuleToc.Doc.ps1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Add shipit build tag
|
||||||
|
task TagBuild {
|
||||||
|
if ($Null -ne $Env:BUILD_DEFINITIONNAME) {
|
||||||
|
Write-Host "`#`#vso[build.addbuildtag]shipit";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Remove temp files.
|
||||||
|
task Clean {
|
||||||
|
Remove-Item -Path out,reports -Recurse -Force -ErrorAction SilentlyContinue;
|
||||||
|
}
|
||||||
|
|
||||||
|
task Build Clean, BuildModule, VersionModule
|
||||||
|
|
||||||
|
task Test Build, Rules, TestModule
|
||||||
|
|
||||||
|
task Release ReleaseModule, TagBuild
|
||||||
|
|
||||||
|
# Synopsis: Build and test. Entry point for CI Build stage
|
||||||
|
task . Build, Rules
|
|
@ -16,7 +16,7 @@ bugs:
|
||||||
url: https://github.com/Microsoft/PSRule.Rules.MSFT.OSS/issues
|
url: https://github.com/Microsoft/PSRule.Rules.MSFT.OSS/issues
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
PSRule: ^0.19.0
|
PSRule: ^0.20.0
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
clear:
|
clear:
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
# PSRule options for QA
|
# PSRule options for QA
|
||||||
|
|
||||||
binding:
|
|
||||||
targetName:
|
|
||||||
- RuleName
|
|
||||||
- FullName
|
|
||||||
|
|
||||||
output:
|
output:
|
||||||
culture:
|
culture:
|
||||||
- en-US
|
- en-US
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
# Synopsis: Check for recommended community files
|
||||||
|
Rule 'MSFT.OSS.Community' -Type 'PSRule.Data.RepositoryInfo' {
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('LICENSE'));
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('CODE_OF_CONDUCT.md'));
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('CONTRIBUTING.md'));
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('SECURITY.md'));
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('README.md'));
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('.github/CODEOWNERS'));
|
||||||
|
$Assert.FilePath($TargetObject, 'FullName', @('.github/PULL_REQUEST_TEMPLATE.md'));
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synopsis: Check for license in code files
|
||||||
|
Rule 'MSFT.OSS.License' -Type '.cs', '.ps1', '.psd1', '.psm1' {
|
||||||
|
$Assert.FileHeader($TargetObject, 'FullName', @(
|
||||||
|
'Copyright (c) Microsoft Corporation.'
|
||||||
|
'Licensed under the MIT License.'
|
||||||
|
));
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
#
|
||||||
|
# PSRule.Rules.MSFT.OSS
|
||||||
|
#
|
||||||
|
@{
|
||||||
|
|
||||||
|
# Script module or binary module file associated with this manifest.
|
||||||
|
# RootModule = ''
|
||||||
|
|
||||||
|
# Version number of this module.
|
||||||
|
ModuleVersion = '0.0.1'
|
||||||
|
|
||||||
|
# Supported PSEditions
|
||||||
|
CompatiblePSEditions = 'Core', 'Desktop'
|
||||||
|
|
||||||
|
# ID used to uniquely identify this module
|
||||||
|
GUID = '7bfb5234-1648-4e52-956c-42f303d416cb'
|
||||||
|
|
||||||
|
# Author of this module
|
||||||
|
Author = 'Microsoft Corporation'
|
||||||
|
|
||||||
|
# Company or vendor of this module
|
||||||
|
CompanyName = 'Microsoft Corporation'
|
||||||
|
|
||||||
|
# Copyright statement for this module
|
||||||
|
Copyright = '(c) Microsoft Corporation. All rights reserved.'
|
||||||
|
|
||||||
|
# Description of the functionality provided by this module
|
||||||
|
Description = 'A suite of rules to validate repositories against Microsoft Open Source Software (OSS) requirements.'
|
||||||
|
|
||||||
|
# Minimum version of the Windows PowerShell engine required by this module
|
||||||
|
PowerShellVersion = '5.1'
|
||||||
|
|
||||||
|
# Name of the Windows PowerShell host required by this module
|
||||||
|
# PowerShellHostName = ''
|
||||||
|
|
||||||
|
# Minimum version of the Windows PowerShell host required by this module
|
||||||
|
# PowerShellHostVersion = ''
|
||||||
|
|
||||||
|
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
|
||||||
|
DotNetFrameworkVersion = '4.7.2'
|
||||||
|
|
||||||
|
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
|
||||||
|
# ClrVersion = ''
|
||||||
|
|
||||||
|
# Processor architecture (None, X86, Amd64) required by this module
|
||||||
|
# ProcessorArchitecture = ''
|
||||||
|
|
||||||
|
# Modules that must be imported into the global environment prior to importing this module
|
||||||
|
RequiredModules = @(
|
||||||
|
@{ ModuleName = 'PSRule'; ModuleVersion = '0.0.1' }
|
||||||
|
)
|
||||||
|
|
||||||
|
# Assemblies that must be loaded prior to importing this module
|
||||||
|
# RequiredAssemblies = @()
|
||||||
|
|
||||||
|
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||||
|
# ScriptsToProcess = @()
|
||||||
|
|
||||||
|
# Type files (.ps1xml) to be loaded when importing this module
|
||||||
|
# TypesToProcess = @()
|
||||||
|
|
||||||
|
# Format files (.ps1xml) to be loaded when importing this module
|
||||||
|
# FormatsToProcess = @()
|
||||||
|
|
||||||
|
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
|
||||||
|
# NestedModules = @()
|
||||||
|
|
||||||
|
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||||
|
FunctionsToExport = @()
|
||||||
|
|
||||||
|
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||||
|
CmdletsToExport = @()
|
||||||
|
|
||||||
|
# Variables to export from this module
|
||||||
|
VariablesToExport = @()
|
||||||
|
|
||||||
|
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
|
||||||
|
AliasesToExport = @()
|
||||||
|
|
||||||
|
# DSC resources to export from this module
|
||||||
|
# DscResourcesToExport = @()
|
||||||
|
|
||||||
|
# List of all modules packaged with this module
|
||||||
|
# ModuleList = @()
|
||||||
|
|
||||||
|
# List of all files packaged with this module
|
||||||
|
# FileList = @()
|
||||||
|
|
||||||
|
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
|
||||||
|
PrivateData = @{
|
||||||
|
PSData = @{
|
||||||
|
|
||||||
|
# Tags applied to this module. These help with module discovery in online galleries.
|
||||||
|
Tags = @('PSRule-rules', 'Rule', 'Microsoft', 'OSS')
|
||||||
|
|
||||||
|
# A URL to the license for this module.
|
||||||
|
LicenseUri = 'https://github.com/microsoft/PSRule.Rules.MSFT.OSS/blob/main/LICENSE'
|
||||||
|
|
||||||
|
# A URL to the main website for this project.
|
||||||
|
ProjectUri = 'https://github.com/microsoft/PSRule.Rules.MSFT.OSS'
|
||||||
|
|
||||||
|
# A URL to an icon representing this module.
|
||||||
|
# IconUri = ''
|
||||||
|
|
||||||
|
# ReleaseNotes of this module
|
||||||
|
ReleaseNotes = 'https://github.com/microsoft/PSRule.Rules.MSFT.OSS/blob/main/CHANGELOG.md'
|
||||||
|
|
||||||
|
# Prerelease string of this module
|
||||||
|
# Prerelease = ''
|
||||||
|
|
||||||
|
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
|
||||||
|
# RequireLicenseAcceptance = $false
|
||||||
|
|
||||||
|
# External dependent modules of this module
|
||||||
|
# ExternalModuleDependencies = @()
|
||||||
|
|
||||||
|
} # End of PSData hashtable
|
||||||
|
|
||||||
|
} # End of PrivateData hashtable
|
||||||
|
|
||||||
|
# HelpInfo URI of this module
|
||||||
|
# HelpInfoURI = ''
|
||||||
|
|
||||||
|
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
|
||||||
|
# DefaultCommandPrefix = ''
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
category: Community
|
||||||
|
online version: https://github.com/microsoft/PSRule.Rules.MSFT.OSS/blob/main/docs/rules/en/MSFT.OSS.Community.md
|
||||||
|
---
|
||||||
|
|
||||||
|
# Use recommend community files
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
|
||||||
|
Use standard files to communicate with the open source community.
|
||||||
|
|
||||||
|
## DESCRIPTION
|
||||||
|
|
||||||
|
Use standard files to communicate with the open source community.
|
||||||
|
|
||||||
|
## RECOMMENDATION
|
||||||
|
|
||||||
|
Consider adding required files in addition to GitHub community health files.
|
||||||
|
|
||||||
|
## LINKS
|
||||||
|
|
||||||
|
- [Releasing projects](https://docs.opensource.microsoft.com/content/releasing/index.html)
|
||||||
|
- [Creating a default community health file](https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/creating-a-default-community-health-file)
|
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
category: License
|
||||||
|
online version: https://github.com/microsoft/PSRule.Rules.MSFT.OSS/blob/main/docs/rules/en/MSFT.OSS.License.md
|
||||||
|
---
|
||||||
|
|
||||||
|
# Use license header
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
|
||||||
|
Code files should include standard MIT license header.
|
||||||
|
|
||||||
|
## DESCRIPTION
|
||||||
|
|
||||||
|
Code files should include standard MIT license header.
|
||||||
|
|
||||||
|
## RECOMMENDATION
|
||||||
|
|
||||||
|
Consider adding standard license header to code files.
|
||||||
|
|
||||||
|
## LINKS
|
||||||
|
|
||||||
|
- [Copyright headers](https://docs.opensource.microsoft.com/content/releasing/copyright-headers.html)
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Rules by category
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
The following rules are included within `PSRule.Rules.MSFT.OSS`.
|
||||||
|
|
||||||
|
### Community
|
||||||
|
|
||||||
|
Name | Synopsis
|
||||||
|
---- | --------
|
||||||
|
[MSFT.OSS.Community](MSFT.OSS.Community.md) | Use standard files to communicate with the open source community.
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
Name | Synopsis
|
||||||
|
---- | --------
|
||||||
|
[MSFT.OSS.License](MSFT.OSS.License.md) | Code files should include standard MIT license header.
|
Загрузка…
Ссылка в новой задаче