Skip to content

Commit c81020d

Browse files
committed
Download MSI file from PowerShell script
1 parent 5397df4 commit c81020d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019
33
# Download the latest self-hosted integration runtime installer into the SHIR folder
44
COPY SHIR C:/SHIR/
55

6-
RUN ["curl", "-L", "https://go.microsoft.com/fwlink/?linkid=839822&clcid=0x409", "-o", "C:/SHIR/IntegrationRuntime.latest.msi"]
7-
86
RUN ["powershell", "C:/SHIR/build.ps1"]
97

108
ENTRYPOINT ["powershell", "C:/SHIR/setup.ps1"]

SHIR/build.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,22 @@ function Write-Log($Message) {
88
function Install-SHIR() {
99
Write-Log "Install the Self-hosted Integration Runtime in the Windows container"
1010

11-
$MsiFileName = (Get-ChildItem -Path C:\SHIR | Where-Object { $_.Name -match [regex] "IntegrationRuntime.*.msi" })[0].Name
12-
Write-Log $MsiFileName
11+
$MsiFiles = (Get-ChildItem -Path C:\SHIR | Where-Object { $_.Name -match [regex] "IntegrationRuntime.*.msi" })
12+
if ($MsiFiles) {
13+
$MsiFileName = $MsiFiles[0].Name
14+
Write-Log "Using SHIR MSI file: $MsiFileName"
15+
}
16+
else {
17+
Write-Log "Downloading latest version of SHIR MSI file"
18+
$MsiFileName = 'IntegrationRuntime.latest.msi'
19+
20+
# Temporarily disable progress updates to speed up the download process. (See https://stackoverflow.com/questions/69942663/invoke-webrequest-progress-becomes-irresponsive-paused-while-downloading-the-fil)
21+
$ProgressPreference = 'SilentlyContinue'
22+
Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/?linkid=839822&clcid=0x409' -OutFile "C:\SHIR\$MsiFileName"
23+
$ProgressPreference = 'Continue'
24+
}
1325

26+
Write-Log "Installing SHIR"
1427
Start-Process msiexec.exe -Wait -ArgumentList "/i C:\SHIR\$MsiFileName /qn"
1528
if (!$?) {
1629
Write-Log "SHIR MSI Install Failed"

0 commit comments

Comments
 (0)