From 139045c1f20d03176d830432bd19cb4029ab9a69 Mon Sep 17 00:00:00 2001 From: Eldar Alasgarov <86415933+ealasgarov@users.noreply.github.com> Date: Wed, 1 Feb 2023 13:55:14 +0100 Subject: [PATCH 1/2] Update configuring-windows-runners.md insure latest runner version is installed --- docs/configuring-windows-runners.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/configuring-windows-runners.md b/docs/configuring-windows-runners.md index 0eb1b3fe..252b4cd2 100644 --- a/docs/configuring-windows-runners.md +++ b/docs/configuring-windows-runners.md @@ -53,7 +53,24 @@ spec: > Note that you'd need to patch the below Dockerfile if you need a graceful termination. > See https://github.com/actions/actions-runner-controller/pull/1608/files#r917319574 for more information. - + + +I would like to propose in Dockerfile, instead of lines 68-69 (in the original file), to copy and run following script to grab the latest runner version (after line 77): + +COPY get-latestrunnerversion.ps1 +RUN ./get-latestrunnerversion.ps1 + +Where the get-latestrunnerversion.ps1 script looks like this: + +$URI="https://api.github.com/repos/actions/runner/releases/latest" +$Version=(Invoke-Webrequest $URI) +$latest=($Version | ConvertFrom-Json).name +$vnum=($latest).Substring(1) +Invoke-WebRequest -Uri "https://github.com/actions/runner/releases/download/$latest/actions-runner-win-x64-$vnum.zip" -OutFile "actions-runner-win-x64-latest.zip" +Expand-Archive -Path $PWD\actions-runner-win-x64-latest.zip -DestinationPath "$PWD" -Force +Remove-Item -Path $PWD\actions-runner-win-x64-latest.zip -Force + + ```Dockerfile FROM mcr.microsoft.com/windows/servercore:ltsc2019 From 9f047bc5fedbc89e8f0b4028494e47150f74f9ff Mon Sep 17 00:00:00 2001 From: Eldar Alasgarov <86415933+ealasgarov@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:03:09 +0100 Subject: [PATCH 2/2] Update configuring-windows-runners.md insure the latest runner version is installed --- docs/configuring-windows-runners.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/configuring-windows-runners.md b/docs/configuring-windows-runners.md index 252b4cd2..0b9d6bda 100644 --- a/docs/configuring-windows-runners.md +++ b/docs/configuring-windows-runners.md @@ -55,8 +55,14 @@ spec: > See https://github.com/actions/actions-runner-controller/pull/1608/files#r917319574 for more information. -I would like to propose in Dockerfile, instead of lines 68-69 (in the original file), to copy and run following script to grab the latest runner version (after line 77): - +I would like to propose in Dockerfile, instead of lines: + +RUN Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.292.0/actions-runner-win-x64-2.292.0.zip -OutFile actions-runner-win-x64-2.292.0.zip +RUN if((Get-FileHash -Path actions-runner-win-x64-2.292.0.zip -Algorithm SHA256).Hash.ToUpper() -ne 'f27dae1413263e43f7416d719e0baf338c8d80a366fed849ecf5fffcec1e941f'.ToUpper()){ throw 'Computed checksum did not match' } +RUN Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('actions-runner-win-x64-2.292.0.zip', $PWD) + +To add the following after the powershell installation step: + COPY get-latestrunnerversion.ps1 RUN ./get-latestrunnerversion.ps1