techthoughts2 / Catesta

Catesta is a PowerShell module and vault project generator. It uses templates to rapidly scaffold test and build integration for a variety of CI/CD platforms.
https://www.catesta.dev/
MIT License
169 stars 20 forks source link

AWS install_modules does not load $moduleInstallPath #22

Closed techthoughts2 closed 4 years ago

techthoughts2 commented 4 years ago

Expected Behavior

When as S3 bucket is provided for AWS install_modules the $moduleInstallPath should be set for them to be installed to the correct location within the CodeBuild container.

Current Behavior

The $moduleInstallPath is not set.

Possible Solution

if ($PSVersionTable.Platform -eq 'Win32NT') {
    $moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'WindowsPowerShell', 'Modules')
    if ($PSEdition -eq 'Core') {
        $moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'PowerShell', 'Modules')
    }
    else {
        $moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'WindowsPowerShell', 'Modules')
    }
}
elseif ($PSVersionTable.Platform -eq 'Unix') {
    $moduleInstallPath = [System.IO.Path]::Combine('/', 'usr', 'local', 'share', 'powershell', 'Modules')
}
elseif ($PSEdition -eq 'Desktop') {
    $moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'WindowsPowerShell', 'Modules')
}
else {
    throw 'Unrecognized OS platform'
}

Steps to Reproduce

  1. Build a new PowerShell project
  2. Select AWS CI/CD
  3. Provide S3 bucket name
  4. Push through AWS CodeBuild
techthoughts2 commented 4 years ago

Addressed in a previous release.