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

Improve Get-OSRepoAvailableVersions #124

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

sergiomiranda-outsystems
  • Changes due to split of Development Environment installer to separate Service Studio and Integration Studio ones.
  • Fix issues with names and version numbers incompatible with [System.Version[]]. Some files in the repository have names ending in ..exe or have version numbers not following major.minor.build.revision causing variable assignment with [System.Version[]] to fail. Fixes Get-OSRepoAvailableVersions Repo Problem #105
  • Change to Az module from AzureRM, which will be deprecated soon
    https://learn.microsoft.com/en-gb/powershell/azure/migrate-from-azurerm-to-az
  • Fix error when no versions matching parameters were found

Changes due to split of Development Environment installer to separate Service Studio and Integration Studio ones.
…ersion[]]

Fix issues with names and version numbers incompatible with [System.Version[]]

Some files in the repository have names ending in ..exe or have version numbers not following major.minor.build.revision causing variable assignment with [System.Version[]] to fail

Removing extension and whatever is after the correct version numbering with regex.
"Cannot index into a null array." from $AppVersions[0].ToString()
@sergiomiranda-outsystems
Copy link
Author

sergiomiranda-outsystems commented Jan 9, 2024

Several tests are failing with the following error:
ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array. TypeInitializationException: The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. at <ScriptBlock>, C:\Users\appveyor\Documents\WindowsPowerShell\Modules\Az.Storage\6.0.1\Storage.Autorest\Az.Storage.psm1: line 49

Line 49 of Az.Storage.psm1 is:
$VTable = Register-AzModule

The Register-AzModule function is part of the Az.Accounts module, and it is installed as a dependency of Az.Storage.

One of the changes implemented in this PR with commit eebb252, is to replace the dependency on AzureRM.Storage module with Az.Storage which is part of the new Az modules.
This was done because the AzureRM modules haven't been updated since March 2021 and will be deprecated on February 29th.
https://learn.microsoft.com/en-gb/powershell/azure/migrate-from-azurerm-to-az

The two modules should not coexist in Windows PowerShell 5.1, so if the Az module is installed the older AzureRM should be removed.
https://learn.microsoft.com/en-gb/powershell/azure/troubleshooting?view=azps-11.1.0#az-and-azurerm-coexistence

This is also a problem for users wishing to install OutSystems.SetupTools having the Az modules already installed (it will throw an error when installing), which is increasingly common as users migrate away from AzureRM module closer to its retire date.

The Az module installation in the build environment fails because of possible conflicts with AzureRM that is installed, so it is made using AllowClobber to overcome this.
Since I suspected that this problem is caused by the coexistence of the two modules on the build environment, I tried to uninstall the AzureRM module when running the tests before installing the new module, but the issue persists.

I was able to reproduce after reading this about something very similar:
Azure/azure-powershell#21647

Steps to reproduce:

Import-Module AzureRM
Remove-Module AzureRM, AzureRM.Profile
Register-AzModule

Even though the AzureRM module is removed from the session, I think that some assemblies remain loaded in the session and cause the issue, possibly the NewtonSoft.Json referred in the previous link.

@pedro132 I believe that to solve this would required some knowledge of the configuration of the build environment, can you help?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get-OSRepoAvailableVersions Repo Problem
1 participant