poshbotio / PoshBot

Powershell-based bot framework
MIT License
540 stars 108 forks source link

Psake Requires Admin Rights #20

Closed michaeltlombardi closed 7 years ago

michaeltlombardi commented 7 years ago

When trying to run Psake build locally, it errors out during the init task due to not having admin rights. It may also error out when resolving modules in the build.ps1 if the specified modules are not the latest available on the gallery.

Expected Behavior

Psake tasks should be able to run with normal user privileges and gracefully alert / give option to install if module versions are outdated instead of just updating them globally.

Current Behavior

Psake will attempt to upgrade/install modules globally and will fail if not running with administrator privileges.

Possible Solution

If we intend to keep the global-update behavior, the scripts should be updated to include a #requires statement for running as administrator. Otherwise, it's probably preferable to update the CI to offer the option to upgrade globally, install locally, or continue with older versions of the modules.

Steps to Reproduce (for bugs)

  1. Clone this repository.
  2. CD into the project root.
  3. .\build.ps1 -Task Init -Verbose

Screenshot

image

Context

Most users, most of the time, will be running the module build process from ISE/VSCode terminal or normal powershell console, and mostly not as administrator. This means they're likely to fail to build locally for reasons that aren't immediately clear; it also means that all build attempts for the project must be executed as administrator which seems unusual.

It also means that the build process is updating the global state of the node the build is running on - not so bad if it's a disposable runner, less fun for a personal workstation, especially if the user did not parse the build script first.

Your Environment

devblackops commented 7 years ago

I've made some major changes to the build process in PR #22. One of those changes is only installing dependent modules in CurrentUser scope.