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

Added version update notification #1424

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

twneale
Copy link
Collaborator

@twneale twneale commented Nov 13, 2024

Adds notification of version update availability

🗣 Description

This pull request resolves #1285 by introducing a new configuration option, DisableVersionCheck, to the ScubaConfig module and to the orchestrator module as a command line switch. Setting this option to $false enables version checks within the orchestrator. The checks will target both PSGallery and Github in an attempt to determine whether a newer release is available. If a new release is available, a warning is printed to the console.

💭 Motivation and context

Users get the best possible assessment by using the latest version of the ScubaGear tool, with the latest baselines. Later versions incorporate updates, fixes, and enhancements. A mechanism to notify users of a new version when running ScubaGear.

🧪 Testing

I tested these changes by modifying the ScubaConfig module and verifying that:

  • The DisableVersionCheck parameter enables or disables checks when set in the config file
  • The 'DisableVersionCheck' command line switch takes precedence over the config file
  • When scuba is installed from PSGallery, if the version is not the latest version, the warning message is printed to the console. If the installed version is the latest version, no warning is printed.
  • When scuba is installed from Github, if the current revision is not a tagged release, the warning message is printed to the console; otherwise no message is printed.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • PR targets the correct parent branch (e.g., main or release-name) for merge.
  • Changes are limited to a single goal - eschew scope creep!
  • Changes are sized such that they do not touch excessive number of files.
  • All future TODOs are captured in issues, which are referenced in code comments.
  • These code changes follow the ScubaGear content style guide.
  • Related issues these changes resolve are linked preferably via closing keywords.
  • All relevant type-of-change labels added.
  • All relevant project fields are set.
  • All relevant repo and/or project documentation updated to reflect these changes.
  • Unit tests added/updated to cover PowerShell and Rego changes.
  • Functional tests added/updated to cover PowerShell and Rego changes.
  • All relevant functional tests passed.
  • All automated checks (e.g., linting, static analysis, unit/smoke tests) passed.

✅ Pre-merge checklist

  • PR passed smoke test check.
  • Feature branch has been rebased against changes from parent branch, as needed
  • Resolved all merge conflicts on branch
  • Notified merge coordinator that PR is ready for merge via comment mention
  • Demonstrate changes to the team for questions and comments.

✅ Post-merge checklist

  • Feature branch deleted after merge to clean up repository.
  • Verified that all checks pass on parent branch (e.g., main or release-name) after merge.

@twneale twneale added the enhancement This issue or pull request will add new or improve existing functionality label Nov 13, 2024
@twneale twneale added this to the Kraken milestone Nov 13, 2024
@twneale twneale self-assigned this Nov 13, 2024
Comment on lines +160 to +164
[Parameter(Mandatory = $false, ParameterSetName = 'Configuration')]
[ValidateNotNullOrEmpty()]
[ValidateSet($true, $false)]
[switch]
$DisableVersionCheck = [ScubaConfig]::ScubaDefault('DisableVersionCheck'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to make this an env variable.
If we make DisableVersionCheck a env variable, then CheckVersion.psm1 can be added as a script in ScriptsToProcess in the manifest.
manifest

The update notification would trigger on ScubaGear import rather than on Invoke-SCuBA.

PnP PowerShell does this and it's more flexible than the other PowerShell modules that tie the update notification check to parameters to their authentication cmdlets.
pnpDoesThis

Copy link
Collaborator

@adhilto adhilto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still testing, but don't forget to update the README to describe the new parameter (or env variable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue or pull request will add new or improve existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ScubaGear version update available notification
3 participants