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

Specifying the AutomatedLab Version to Install #1391

Open
shurick81 opened this issue Sep 4, 2022 · 4 comments
Open

Specifying the AutomatedLab Version to Install #1391

shurick81 opened this issue Sep 4, 2022 · 4 comments
Assignees
Labels
Enhancement The issue is an enhancement request.

Comments

@shurick81
Copy link

Description

When I install one of the previous versions of AutomatedLab, not the latest available in Gallery, 5.43.0, I get inconsistent set of module versions installed. For example, I get installed AutomatedLab 5.43.0 but AutomatedLabDefinition 5.45.0. One issue with that is that I don't know if such combination is even supported by AutomatedLab team. Another issue is that I want my installation script to bring the system to the same state now and every time I run it in the future regardless of whether new versions of AutomatedLab are released or not. For repeatability purposes.

This might be related but it does not solve the issue as far as I can see: #679

Here's what I use for the workaround:

$latestAutomatedLabVersion = ( Find-Module AutomatedLab ).Version;
$requiredAutomatedLabVersion = "5.43.0";
Install-Module -Name AutomatedLab -RequiredVersion $requiredAutomatedLabVersion -Force -SkipPublisherCheck -AllowClobber;
if ( $requiredAutomatedLabVersion -ne $latestAutomatedLabVersion ) {
    "AutomatedLabDefinition", "AutomatedLabNotifications", "AutomatedLabTest", "AutomatedLabWorker", "AutomatedLabUnattended" | % {
        Install-Module -Name $_ -RequiredVersion $requiredAutomatedLabVersion -Force;
        Uninstall-Module -Name $_ -RequiredVersion $latestAutomatedLabVersion -Force;
    }
}

Expected behavior

When I run Install-Module -Name AutomatedLab -RequiredVersion 5.43.0, I expect these versions to be installed:

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.43.0     AutomatedLab                        {Install-LabScvmm, Install-LabRdsCertificate, Install-LabAzureRequiredModule, Uninstall-LabRdsCertificate...}
Script     2.2.247    AutomatedLab.Common                 {Add-AccountPrivilege, Add-CATemplateStandardPermission, Add-Certificate2, Add-FunctionToPSSession...}
Script     5.43.0     AutomatedLabDefinition              {Add-LabAzureWebAppDefinition, Add-LabAzureAppServicePlanDefinition, Add-LabDiskDefinition, Add-LabDomainDefinition...}
Script     5.43.0     AutomatedLabNotifications           Send-ALNotification
Script     5.43.0     AutomatedLabTest                    {Test-LabDeployment, Import-LabTestResult, Invoke-LabPester, New-LabPesterTest}
Script     5.43.0     AutomatedLabUnattended
Script     5.43.0     AutomatedLabWorker                  {Wait-LWLabJob, Uninstall-LWHypervWindowsFeature, Uninstall-LWAzureWindowsFeature, Install-LWAzureWindowsFeature...}

Actual behavior

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.43.0     AutomatedLab                        {Install-LabScvmm, Install-LabRdsCertificate, Install-LabAzureRequiredModule, Uninstall-LabRdsCertificate...}
Script     2.2.247    AutomatedLab.Common                 {Add-AccountPrivilege, Add-CATemplateStandardPermission, Add-Certificate2, Add-FunctionToPSSession...}
Script     5.45.0     AutomatedLabDefinition              {Add-LabAzureWebAppDefinition, Add-LabAzureAppServicePlanDefinition, Add-LabDiskDefinition, Add-LabDomainDefinition...}
Script     5.45.0     AutomatedLabNotifications           Send-ALNotification
Script     5.45.0     AutomatedLabTest                    {Test-LabDeployment, Import-LabTestResult, Invoke-LabPester, New-LabPesterTest}
Script     5.45.0     AutomatedLabUnattended
Script     5.45.0     AutomatedLabWorker                  {Add-LWAzureLoadBalancedPort, Add-LWVMVHDX, Checkpoint-LWAzureVM, Checkpoint-LWHypervVM...}

Steps to reproduce

Install-Module -Name AutomatedLab -RequiredVersion 5.43.0 -Force -SkipPublisherCheck -AllowClobber
Get-Module AutomatedLab* -ListAvailable

Environment details

powershell_support_pack_2022_09_04-12_32_28.zip

PowerShell Version

Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

AutomatedLab components

Name                      Version
----                      -------
AutomatedLab              5.43.0
AutomatedLab.Common       2.2.247
AutomatedLabDefinition    5.45.0
AutomatedLabNotifications 5.45.0
AutomatedLabTest          5.45.0
AutomatedLabUnattended    5.45.0
AutomatedLabWorker        5.45.0
@raandree
Copy link
Member

raandree commented Sep 4, 2022

Indeed, this is a very old issue that is because of the module design.

@nyanhp, are we setting the module version for AutomatedLab.Common in the psd1 somewhere in the build process or is updating to the latest version a manual task? (

@{ModuleName='AutomatedLab.Common'; ModuleVersion='2.2.247'; }
).

What we could do is setting the version numbers for all the modules in the build process so that not the latest but a specific version should be downloaded from the PowerShell Gallery. @shurick81, would that help?

@raandree raandree self-assigned this Sep 4, 2022
@raandree raandree added the Enhancement The issue is an enhancement request. label Sep 4, 2022
@shurick81
Copy link
Author

I guess so @raandree. As far as I understand, I will be able to run one installation command and specify the version of the AutomatedLab module to install and then all the AutomatedLab* modules will be installed with the same version, right?

@nyanhp
Copy link
Member

nyanhp commented Sep 7, 2022

Indeed, this is a very old issue that is because of the module design.

@nyanhp, are we setting the module version for AutomatedLab.Common in the psd1 somewhere in the build process or is updating to the latest version a manual task? (

@{ModuleName='AutomatedLab.Common'; ModuleVersion='2.2.247'; }

).
What we could do is setting the version numbers for all the modules in the build process so that not the latest but a specific version should be downloaded from the PowerShell Gallery. @shurick81, would that help?

That is a manual task, but there is no reason why we couldn't automate this in the pipeline.

@raandree
Copy link
Member

raandree commented Sep 8, 2022

@shurick81, the only workaround is the script you added when opening this problem. If you install only the main module AutomatedLab in a version lower than the latest one, the latest version of all required modules like AutomatedLabWorker or AutomatedLabDefinition will still be installed.

All this is not ideal and, as mentioned, is due to the module design. The design is from 2014 when we all didn`t have that much experience. We would definitely choose something completely different now. I had a discussion with @nyanhp recently and redesigning the whole solution would be a nice thing to do, albeit extremely time consuming.

Considering that this is the first time this issue has come up since 2014 and that there is a workaround and that we are thinking about redesigning the solution in the future, I don't want to put time and energy into a quick fix that still would cost us a couple of hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement The issue is an enhancement request.
Projects
None yet
Development

No branches or pull requests

3 participants