Skip to content

Commit

Permalink
fix(windows): correct git-lfs installation and bump of its version to…
Browse files Browse the repository at this point in the history
… 3.4.1
  • Loading branch information
lemeurherve committed Mar 27, 2024
1 parent e25b322 commit 448c1c9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
4 changes: 3 additions & 1 deletion tests/sshAgent.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions updatecli/updatecli.d/git-lfs-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ sources:
username: "{{ .github.username }}"
versionfilter:
kind: semver
transformers:
- trimprefix: "v"

targets:
setGitLfsVersionWindowsNanoserver:
Expand All @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions windows/nanoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 10 additions & 7 deletions windows/windowsservercore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 448c1c9

Please sign in to comment.