Skip to content

Commit 62862e4

Browse files
committed
[Ubuntu] Add Azure modules to PS scope; deprecate zip
1 parent 4e4e6cd commit 62862e4

7 files changed

Lines changed: 6 additions & 39 deletions

File tree

images/ubuntu/scripts/build/Install-PowerShellAzModules.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Import-Module "$env:HELPER_SCRIPTS/../tests/Helpers.psm1"
1111
# Get modules content from toolset
1212
$modules = (Get-ToolsetContent).azureModules
1313
$installPSModulePath = "/usr/share"
14+
$psModuleMachinePath = $env:PSModulePath + ":"
1415

1516
foreach ($module in $modules) {
1617
$moduleName = $module.name
@@ -19,9 +20,12 @@ foreach ($module in $modules) {
1920
foreach ($version in $module.versions) {
2021
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
2122
Write-Host " - $version [$modulePath]"
23+
$psModuleMachinePath += ($modulePath + ":")
2224
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force
2325
}
24-
2526
}
2627

28+
$finalLine = "PSModulePath=$($psModuleMachinePath.TrimEnd(':').Replace("\root", '$HOME'))"
29+
Add-Content -Path "/etc/environment" -Value $finalLine
30+
2731
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules"

images/ubuntu/scripts/tests/PowerShellModules.Tests.ps1

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ Describe "AzureModules" {
5050
$moduleVersion | Should -Match $expectedVersion
5151
}
5252
}
53-
54-
if ($module.default) {
55-
$moduleInfo = @{ moduleName = $moduleName; moduleDefault = $module.default }
56-
57-
It "<moduleDefault> set as default" -TestCases $moduleInfo {
58-
$moduleVersion = (Get-Module -ListAvailable -Name $moduleName).Version.ToString()
59-
$moduleVersion | Should -Match $moduleDefault
60-
}
61-
}
6253
}
6354
}
6455
}

images/windows/scripts/build/Install-PowershellAzModules.ps1

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,6 @@ foreach ($module in $modules) {
2626
$psModuleMachinePath += "$modulePath;"
2727
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force -ErrorAction Stop
2828
}
29-
30-
foreach ($version in $module.zip_versions) {
31-
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
32-
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force -ErrorAction Stop
33-
Compress-Archive -Path $modulePath -DestinationPath "${modulePath}.zip"
34-
Remove-Item $modulePath -Recurse -Force
35-
}
36-
# Append default tool version to machine path
37-
if ($null -ne $module.default) {
38-
$defaultVersion = $module.default
39-
40-
Write-Host "Use ${moduleName} ${defaultVersion} as default version..."
41-
$psModuleMachinePath += "${installPSModulePath}\${moduleName}_${defaultVersion};"
42-
}
4329
}
4430

4531
# Add modules to the PSModulePath

images/windows/scripts/tests/PowerShellAzModules.Tests.ps1

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ Describe "AzureModules" {
2727
$moduleVersion | Should -Match $expectedVersion
2828
}
2929
}
30-
31-
if ($module.default) {
32-
$moduleInfo = @{ moduleName = $moduleName; moduleDefault = $module.default }
33-
It "<moduleDefault> set as default" -TestCases $moduleInfo {
34-
$moduleVersions = Get-Module -ListAvailable -Name $moduleName | ForEach-Object { $_.Version.ToString() }
35-
$moduleVersions | Should -Contain $moduleDefault
36-
}
37-
}
3830
}
3931
}
4032
}

images/windows/toolsets/toolset-2019.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@
9494
"name": "az",
9595
"versions": [
9696
"12.5.0"
97-
],
98-
"zip_versions": [
9997
]
10098
}
10199
],

images/windows/toolsets/toolset-2022.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@
9393
"name": "az",
9494
"versions": [
9595
"12.5.0"
96-
],
97-
"zip_versions": [
98-
9996
]
10097
}
10198
],

images/windows/toolsets/toolset-2025.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@
7777
"name": "az",
7878
"versions": [
7979
"12.5.0"
80-
],
81-
"zip_versions": []
80+
]
8281
}
8382
],
8483
"java": {

0 commit comments

Comments
 (0)