mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
replace git for windows internal tools
This commit is contained in:
@@ -235,6 +235,14 @@
|
|||||||
"{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1"
|
"{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "powershell",
|
||||||
|
"elevated_user": "SYSTEM",
|
||||||
|
"elevated_password": "",
|
||||||
|
"scripts":[
|
||||||
|
"{{ template_dir }}/scripts/Installers/Install-Msys2.ps1"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts":[
|
"scripts":[
|
||||||
@@ -290,15 +298,6 @@
|
|||||||
"{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1"
|
"{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"type": "powershell",
|
|
||||||
"elevated_user": "SYSTEM",
|
|
||||||
"elevated_password": "",
|
|
||||||
"scripts":[
|
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Msys2.ps1"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts":[
|
"scripts":[
|
||||||
@@ -385,7 +384,8 @@
|
|||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts":[
|
"scripts":[
|
||||||
"{{ template_dir }}/scripts/Installers/Configure-Antivirus.ps1",
|
"{{ template_dir }}/scripts/Installers/Configure-Antivirus.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1"
|
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1",
|
||||||
|
"{{ template_dir }}/scripts/Installers/Post-Deployment.ps1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -249,6 +249,14 @@
|
|||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "powershell",
|
||||||
|
"elevated_user": "SYSTEM",
|
||||||
|
"elevated_password": "",
|
||||||
|
"scripts":[
|
||||||
|
"{{ template_dir }}/scripts/Installers/Install-Msys2.ps1"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts":[
|
"scripts":[
|
||||||
@@ -276,14 +284,6 @@
|
|||||||
"elevated_user": "{{user `install_user`}}",
|
"elevated_user": "{{user `install_user`}}",
|
||||||
"elevated_password": "{{user `install_password`}}"
|
"elevated_password": "{{user `install_password`}}"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "powershell",
|
|
||||||
"elevated_user": "SYSTEM",
|
|
||||||
"elevated_password": "",
|
|
||||||
"scripts":[
|
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Msys2.ps1"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts":[
|
"scripts":[
|
||||||
@@ -382,19 +382,10 @@
|
|||||||
{
|
{
|
||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts":[
|
"scripts":[
|
||||||
"{{ template_dir }}/scripts/Installers/Configure-Antivirus.ps1"
|
"{{ template_dir }}/scripts/Installers/Configure-Antivirus.ps1",
|
||||||
]
|
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1",
|
||||||
},
|
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1",
|
||||||
{
|
"{{ template_dir }}/scripts/Installers/Post-Deployment.ps1"
|
||||||
"type": "powershell",
|
|
||||||
"scripts":[
|
|
||||||
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "powershell",
|
|
||||||
"scripts":[
|
|
||||||
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Install-Binary -Url $downloadUrl `
|
|||||||
"/SP-", `
|
"/SP-", `
|
||||||
"/CLOSEAPPLICATIONS", `
|
"/CLOSEAPPLICATIONS", `
|
||||||
"/RESTARTAPPLICATIONS", `
|
"/RESTARTAPPLICATIONS", `
|
||||||
"/o:PathOption=CmdTools", `
|
"/o:PathOption=Cmd", `
|
||||||
"/o:BashTerminalOption=ConHost", `
|
"/o:BashTerminalOption=ConHost", `
|
||||||
"/o:EnableSymlinks=Enabled", `
|
"/o:EnableSymlinks=Enabled", `
|
||||||
"/COMPONENTS=gitlfs")
|
"/COMPONENTS=gitlfs")
|
||||||
@@ -38,7 +38,5 @@ Choco-Install -PackageName hub
|
|||||||
# Disable GCM machine-wide
|
# Disable GCM machine-wide
|
||||||
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)
|
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)
|
||||||
|
|
||||||
Add-MachinePathItem "C:\Program Files\Git\bin"
|
|
||||||
|
|
||||||
Invoke-PesterTests -TestFile "Git" -TestName "Git"
|
Invoke-PesterTests -TestFile "Git" -TestName "Git"
|
||||||
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI"
|
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI"
|
||||||
|
|||||||
@@ -9,35 +9,22 @@
|
|||||||
|
|
||||||
$dash = "-" * 40
|
$dash = "-" * 40
|
||||||
|
|
||||||
$origPath = $env:PATH
|
# Downloading msys2
|
||||||
$gitPath = "$env:ProgramFiles\Git"
|
$msys2Release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
|
||||||
|
$msys2Uri = ((Invoke-RestMethod $msys2Release).assets | Where-Object {
|
||||||
$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
|
|
||||||
|
|
||||||
$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object {
|
|
||||||
$_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url
|
$_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url
|
||||||
|
|
||||||
# Download the latest msys2 x86_64, filename includes release date
|
|
||||||
Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])"
|
|
||||||
$msys2File = Start-DownloadWithRetry -Url $msys2Uri
|
$msys2File = Start-DownloadWithRetry -Url $msys2Uri
|
||||||
Write-Host "Finished download"
|
|
||||||
|
|
||||||
# nix style path for tar
|
|
||||||
$msys2FileU = "/$msys2File".replace(':', '').replace('\', '/')
|
|
||||||
|
|
||||||
# Git tar needs exe's from mingw64\bin
|
|
||||||
$env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath"
|
|
||||||
|
|
||||||
$tar = "$gitPath\usr\bin\tar.exe"
|
|
||||||
|
|
||||||
# extract tar.xz to C:\
|
# extract tar.xz to C:\
|
||||||
Write-Host "Starting msys2 extraction"
|
Write-Host "Starting msys2 extraction"
|
||||||
&$tar -xJf $msys2FileU -C /c/
|
$tempPath = Join-Path $env:Temp msys
|
||||||
Remove-Item $msys2File
|
Extract-7Zip -Path $msys2File -DestinationPath $tempPath
|
||||||
|
$tarPath = Resolve-Path $tempPath\msys*.tar
|
||||||
|
Extract-7Zip -Path $tarPath -DestinationPath C:\
|
||||||
Write-Host "Finished extraction"
|
Write-Host "Finished extraction"
|
||||||
|
|
||||||
# Add msys2 bin tools folders to PATH temporary
|
# Add msys2 bin tools folders to PATH temporary
|
||||||
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath"
|
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:PATH"
|
||||||
|
|
||||||
Write-Host "`n$dash bash pacman-key --init"
|
Write-Host "`n$dash bash pacman-key --init"
|
||||||
bash.exe -c "pacman-key --init 2>&1"
|
bash.exe -c "pacman-key --init 2>&1"
|
||||||
@@ -88,4 +75,15 @@ pacman.exe -Q | grep -v ^mingw-w64-
|
|||||||
|
|
||||||
Write-Host "`nMSYS2 installation completed"
|
Write-Host "`nMSYS2 installation completed"
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
# add C:\msys64\mingw64\bin and C:\msys64\usr\bin to PATH
|
||||||
|
# C:\msys64\mingw64\bin add after C:\Windows\System32 to not replace built-in tar.exe
|
||||||
|
$regEnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\'
|
||||||
|
$pathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path'
|
||||||
|
$pathValue += ";C:\msys64\mingw64\bin;C:\msys64\usr\bin"
|
||||||
|
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $pathValue
|
||||||
|
|
||||||
|
# Rename python
|
||||||
|
Rename-Item "C:\msys64\usr\bin\python.exe" -NewName "_python.exe"
|
||||||
|
|
||||||
Invoke-PesterTests -TestFile "MSYS2"
|
Invoke-PesterTests -TestFile "MSYS2"
|
||||||
|
|||||||
19
images/win/scripts/Installers/Post-Deployment.ps1
Normal file
19
images/win/scripts/Installers/Post-Deployment.ps1
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Create shells folder
|
||||||
|
$shellPath = "C:\shells"
|
||||||
|
$null = New-Item -Path $shellPath -ItemType Directory
|
||||||
|
|
||||||
|
# MSYS2 <--> C:\msys64\usr\bin\bash.exe
|
||||||
|
$null = New-Item -ItemType SymbolicLink -Path "$shellPath\msys2.exe" -Target "C:\msys64\usr\bin\bash.exe"
|
||||||
|
|
||||||
|
# sh and bash <--> C:\msys64\usr\bin\bash.exe
|
||||||
|
$null = New-Item -ItemType SymbolicLink -Path "$shellPath\bash.exe" -Target "C:\msys64\usr\bin\bash.exe"
|
||||||
|
$null = New-Item -ItemType SymbolicLink -Path "$shellPath\sh.exe" -Target "C:\msys64\usr\bin\sh.exe"
|
||||||
|
|
||||||
|
# winbash <--> C:\Windows\System32\bash.exe
|
||||||
|
$null = New-Item -ItemType SymbolicLink -Path "$shellPath\winbash.exe" -Target "$env:SystemRoot\System32\bash.exe"
|
||||||
|
|
||||||
|
# git4bash <--> C:\Program Files\Git\bin\bash.exe
|
||||||
|
$null = New-Item -ItemType SymbolicLink -Path "$shellPath\git4bash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe"
|
||||||
|
|
||||||
|
# Add shells to PATH
|
||||||
|
Add-MachinePathItem $shellPath
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
Describe "Git" {
|
Describe "Git" {
|
||||||
$gitTools = 'bash', 'awk', 'git', 'git-lfs'
|
$gitTools = 'git', 'git-lfs'
|
||||||
$gitTestCases = $gitTools | ForEach-Object {
|
$gitTestCases = $gitTools | ForEach-Object {
|
||||||
@{
|
@{
|
||||||
toolName = $_
|
toolName = $_
|
||||||
|
|||||||
Reference in New Issue
Block a user