-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathInstall-RequiredModule-step.yml
More file actions
42 lines (37 loc) · 1.66 KB
/
Install-RequiredModule-step.yml
File metadata and controls
42 lines (37 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
parameters:
path: "$(Build.SourcesDirectory)/RequiredModules.psd1"
steps:
- powershell: |
$ModulePath = Join-Path (Split-Path $Profile.CurrentUserAllHosts) Modules
$null = New-Item $ModulePath -Force -Type Directory
Write-Host "##vso[task.setvariable variable=ModuleInstallPath]$ModulePath"
displayName: 'Create Module Install Folder'
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: 'packages.config'
feedsToUse: 'select'
vstsFeed: '/b3c073b2-9573-45ec-8914-6f70c6f1308c'
includeNuGetOrg: false
restoreDirectory: $(ModuleInstallPath)
- powershell: |
if (Test-Path packages.config) {
# Strip the version numbers from the path names:
[xml]$packages = Get-Content packages.config
foreach ($package in $packages.packages.package.id) {
Get-Item (Join-Path '$(ModuleInstallPath)' $package ) -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force
Get-Item (Join-Path '$(ModuleInstallPath)' $package* ) | Rename-Item -NewName $package
}
Get-ChildItem '$(ModuleInstallPath)' -Recurse
}
displayName: 'Fixup Nuget Module Install'
- powershell: |
# Apparently, Install-Script isn't good enough except on Windows?
# Install-Script Install-RequiredModule -Force -Verbose
Save-Script Install-RequiredModule -Path '$(Pipeline.Workspace)'
&"$(Pipeline.Workspace)/Install-RequiredModule" -Path '${{ parameters.path }}' -Confirm:$false -Verbose
foreach ($installErr in $IRM_InstallErrors) {
Write-Warning "ERROR: $installErr"
Write-Warning "STACKTRACE: $($installErr.ScriptStackTrace)"
}
displayName: 'Restore pre-requisites'