Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate default baseline to module configuration #809

Closed
BernieWhite opened this issue Sep 29, 2021 · 0 comments · Fixed by #847
Closed

Migrate default baseline to module configuration #809

BernieWhite opened this issue Sep 29, 2021 · 0 comments · Fixed by #847
Assignees
Labels
feature: baselines Issues that affect baselines
Milestone

Comments

@BernieWhite
Copy link
Member

BernieWhite commented Sep 29, 2021

Currently a default baseline can be configured by editing the module manifest.

@{
  # 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')
      }
      PSRule = @{
          Baseline = 'Enterprise.Default'
      }
  }
}

Adding a PSRule property in the manifest is problematic because the Update-ModuleManifest cmdlet reformats this.

Module configuration support was added later which provides an alternative mechanism to configure the default baseline.

For example:

---
# Synopsis: Example module configuration for Enterprise.Rules module
apiVersion: github.com/microsoft/PSRule/v1
kind: ModuleConfig
metadata:
  name: Enterprise.Rules
spec:
  rule:
    baseline: 'Enterprise.Default'

If default baseline in both module manifest and module configuration are set, Module configuration should take priority.

@BernieWhite BernieWhite added the feature: baselines Issues that affect baselines label Sep 29, 2021
@BernieWhite BernieWhite added this to the v1.9.0 milestone Oct 7, 2021
@BernieWhite BernieWhite self-assigned this Nov 3, 2021
BernieWhite added a commit to BernieWhite/PSRule that referenced this issue Nov 8, 2021
BernieWhite added a commit that referenced this issue Nov 8, 2021
* Migrated default baseline to module config #809

* Fixed broken test

Co-authored-by: Armaan Mcleod <armaan_mcleod@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: baselines Issues that affect baselines
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant