From 448c1c97b5ea7c945296a47809fe37941c71f588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Wed, 27 Mar 2024 12:19:18 +0100 Subject: [PATCH] fix(windows): correct git-lfs installation and bump of its version to 3.4.1 --- tests/sshAgent.Tests.ps1 | 4 +++- updatecli/updatecli.d/git-lfs-windows.yml | 12 ++++++++++++ windows/nanoserver/Dockerfile | 7 +++++-- windows/windowsservercore/Dockerfile | 17 ++++++++++------- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/tests/sshAgent.Tests.ps1 b/tests/sshAgent.Tests.ps1 index 49bd7b1e..f58e80bb 100644 --- a/tests/sshAgent.Tests.ps1 +++ b/tests/sshAgent.Tests.ps1 @@ -55,6 +55,8 @@ TUwLP4n7pK4J2sCIs6fRD5kEYms4BnddXeRuI2fGZHGH70Ci/Q== -----END RSA PRIVATE KEY----- "@ +$global:GITLFSVERSION = '3.4.1' + Cleanup($global:CONTAINERNAME) Describe "[$global:IMAGE_NAME] image is present" { @@ -116,7 +118,7 @@ Describe "[$global:IMAGE_NAME] image has correct version of java and git-lfs ins It 'has git-lfs (and thus git) installed' { $exitCode, $stdout, $stderr = Run-Program 'docker' "exec $global:CONTAINERNAME $global:CONTAINERSHELL -C `"`& git lfs version`"" $exitCode | Should -Be 0 - $stdout.Trim() | Should -Match "git-lfs/${global:GITLFSVERSION}" + $stdout.Trim() | Should -Match "git-lfs/$global:GITLFSVERSION" } AfterAll { diff --git a/updatecli/updatecli.d/git-lfs-windows.yml b/updatecli/updatecli.d/git-lfs-windows.yml index 0cd52a7e..25da7faf 100644 --- a/updatecli/updatecli.d/git-lfs-windows.yml +++ b/updatecli/updatecli.d/git-lfs-windows.yml @@ -23,6 +23,8 @@ sources: username: "{{ .github.username }}" versionfilter: kind: semver + transformers: + - trimprefix: "v" targets: setGitLfsVersionWindowsNanoserver: @@ -43,6 +45,16 @@ targets: keyword: ARG matcher: GIT_LFS_VERSION scmid: default + setGitLfsVersionTests: + name: Update the `git-lfs` Windows version in tests + kind: file + spec: + file: tests/sshAgent.Tests.ps1 + matchpattern: > + global:GITLFSVERSION =(.*) + replacepattern: > + global:GITLFSVERSION = '{{ source "lastVersion" }}' + scmid: default actions: default: diff --git a/windows/nanoserver/Dockerfile b/windows/nanoserver/Dockerfile index 8e097d5f..f0452c9d 100644 --- a/windows/nanoserver/Dockerfile +++ b/windows/nanoserver/Dockerfile @@ -66,12 +66,15 @@ ENV WindowsPATH="C:\Windows\system32;C:\Windows" ENV PATH="${WindowsPATH};${ProgramFiles}\PowerShell;${JAVA_HOME}\bin;C:\mingit\cmd" # Install git-lfs -ARG GIT_LFS_VERSION=v3.1.4 +ARG GIT_LFS_VERSION=3.4.1 RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` - $url = $('https://github.com/git-lfs/git-lfs/releases/download/{0}/git-lfs-windows-amd64-{0}.zip' -f $env:GIT_LFS_VERSION) ; ` + $url = $('https://github.com/git-lfs/git-lfs/releases/download/v{0}/git-lfs-windows-amd64-v{0}.zip' -f $env:GIT_LFS_VERSION) ; ` Write-Host "Retrieving $url..." ; ` Invoke-WebRequest $url -OutFile 'GitLfs.zip' -UseBasicParsing ; ` Expand-Archive GitLfs.zip -DestinationPath c:\mingit\mingw64\bin ; ` + $gitLfsFolder = 'c:\mingit\mingw64\bin\git-lfs-{0}' -f $env:GIT_LFS_VERSION ; ` + Move-Item -Path "${gitLfsFolder}\git-lfs.exe" -Destination c:\mingit\mingw64\bin\ ; ` + Remove-Item -Path $gitLfsFolder -Recurse -Force ; ` Remove-Item GitLfs.zip -Force ; ` & C:\mingit\cmd\git.exe lfs install diff --git a/windows/windowsservercore/Dockerfile b/windows/windowsservercore/Dockerfile index 0d3c2051..7d8ef140 100644 --- a/windows/windowsservercore/Dockerfile +++ b/windows/windowsservercore/Dockerfile @@ -56,17 +56,20 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Remove-Item mingit.zip -Force # Install git-lfs -ARG GIT_LFS_VERSION=v3.1.4 -RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` - $url = $('https://github.com/git-lfs/git-lfs/releases/download/{0}/git-lfs-windows-amd64-{0}.zip' -f $env:GIT_LFS_VERSION) ; ` +ARG GIT_LFS_VERSION=3.4.1 +RUN $CurrentPath = (Get-Itemproperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path).Path ; ` + $NewPath = $CurrentPath + ';{0}\bin;C:\mingit\cmd' -f $env:JAVA_HOME ; ` + Set-ItemProperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path -Value $NewPath ; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` + $url = $('https://github.com/git-lfs/git-lfs/releases/download/v{0}/git-lfs-windows-amd64-v{0}.zip' -f $env:GIT_LFS_VERSION) ; ` Write-Host "Retrieving $url..." ; ` Invoke-WebRequest $url -OutFile 'GitLfs.zip' -UseBasicParsing ; ` Expand-Archive GitLfs.zip -DestinationPath c:\mingit\mingw64\bin ; ` + $gitLfsFolder = 'c:\mingit\mingw64\bin\git-lfs-{0}' -f $env:GIT_LFS_VERSION ; ` + Move-Item -Path "${gitLfsFolder}\git-lfs.exe" -Destination c:\mingit\mingw64\bin\ ; ` + Remove-Item -Path $gitLfsFolder -Recurse -Force ; ` Remove-Item GitLfs.zip -Force ; ` - & C:\mingit\cmd\git.exe lfs install ; ` - $CurrentPath = (Get-Itemproperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path).Path ; ` - $NewPath = $CurrentPath + ';{0}\bin;C:\mingit\cmd' -f $env:JAVA_HOME ; ` - Set-ItemProperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path -Value $NewPath + & C:\mingit\cmd\git.exe lfs install # Setup SSH server ARG OPENSSH_VERSION=V8.6.0.0p1-Beta