microsoft / microsoft/PSRule

Expand on baselines lifecycle

Open
#1,524 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature: baselines
Dominant language
C#
Stars
474
Forks
65
Avg merge
22h 25m
Merged PRs (30d)
26

Description

Currently customers can configure a single baseline to use. For general use, the baseline is defined on the workflow as an input parameter.

For cases with lots of workflows, this may create undue burden updating these workflows to point to the new baseline.

Setting by environment variable

If the baseline can be set by environment variable, a GitHub repository could set the environment variable which would be inherited by all repos. Azure DevOps would be via variable template/ variable group.

Technically this could already be done by passing the environment variable as a parameter in the GitHub Action. However there is no documentation for this approach.

Pros:

  • Low maintenance.
  • Flexible options to run different baselines with different environment variables.

Cons:

  • No code change, so no PR.
  • Privileged operation for the repository.

Options file

The baseline could be set by options file, this is mostly implemented for setting baselines via module configuration. i.e. rule.baseline.

Pros:

  • Low maintenance
  • Code change, so required PR and test validation as part of the process.

Cons:

  • Does not support environments natively, but different options files can be used.
  • Multi-module scenarios are not currently supported.
  • Only a single baseline can be selected currently.

Baseline group

Provide an option to configure a baseline group, which is friendly name for the baseline but one that can be set within options.

For example:

baseline:
  group:
    recommended: PSRule.Rules.Azure\Azure.Default
    preview: PSRule.Rules.Azure\Azure.Preview
# Analyze Azure resources using PSRule for Azure
- name: Analyze Azure template files
  uses: microsoft/ps-rule@v2.8.1
  with:
    modules: 'PSRule.Rules.Azure'
    baseline: '@recommended'

Pros:

  • Low maintenance
  • Code change, so required PR and test validation as part of the process.
  • Allows a different baseline tags to be configured within the pipeline, baseline can be bumped without updating the pipeline.

Cons:

  • Multi-module scenarios are not currently supported.
  • Only a single baseline can be selected currently.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing options-file and module-configuration handling referenced in the issue, along with the current baseline workflow input path. The issue does not name files or tests, and a contributor would first need a decision among environment variables, an options file, or baseline groups. Done would require an agreed approach with implementation and validation requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, powershell
Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.