Skip to content

Commit

Permalink
chore(windows) track git version using updatecli and manages all wind…
Browse files Browse the repository at this point in the history
…ows patches (jenkinsci#370)

* chore(windows) track git version using updatecli and manages all windows patches

Signed-off-by: Damien Duportal <damien.duportal@gmail.com>

* Apply suggestions from code review

Co-authored-by: Alex Earl <slide.o.mix@gmail.com>

---------

Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Co-authored-by: Alex Earl <slide.o.mix@gmail.com>
  • Loading branch information
dduportal and slide committed Feb 8, 2023
1 parent cf0b46c commit 4c1b95e
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 4 deletions.
4 changes: 3 additions & 1 deletion 11/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ USER ContainerAdministrator
ARG GIT_VERSION=2.39.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
# The patch "windows.1" always have a different URL than the subsequent patch (ZIP filename is different)
if($env:GIT_PATCH_VERSION -eq 1) { $url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION); } `
else {$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}.{1}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION)} ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Expand Down
4 changes: 3 additions & 1 deletion 11/windows/windowsservercore-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
ARG GIT_VERSION=2.39.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
# The patch "windows.1" always have a different URL than the subsequent patch (ZIP filename is different)
if($env:GIT_PATCH_VERSION -eq 1) { $url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION); } `
else {$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}.{1}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION)} ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Expand Down
4 changes: 3 additions & 1 deletion 17/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ USER ContainerAdministrator
ARG GIT_VERSION=2.39.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
# The patch "windows.1" always have a different URL than the subsequent patch (ZIP filename is different)
if($env:GIT_PATCH_VERSION -eq 1) { $url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION); } `
else {$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}.{1}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION)} ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Expand Down
4 changes: 3 additions & 1 deletion 17/windows/windowsservercore-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
ARG GIT_VERSION=2.39.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
# The patch "windows.1" always have a different URL than the subsequent patch (ZIP filename is different)
if($env:GIT_PATCH_VERSION -eq 1) { $url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION); } `
else {$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}.{1}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION)} ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Expand Down
151 changes: 151 additions & 0 deletions updatecli/updatecli.d/git-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
name: Bump Git version on Windows

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
kind: githubrelease
name: Get the latest Git version
spec:
owner: "git-for-windows"
repository: "git"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionfilter:
kind: regex
## Latest stable v{x.y.z}.windows.<patch>
pattern: 'v(\d*)\.(\d*)\.(\d*)\.windows\.(\d*)$'
transformers:
- trimprefix: "v"

targets:
############# JDK11 Nanoserver 18.09
setGitVersionJDK11WindowsNanoserver1809:
name: Update the Git Windows version for JDK11 Windows Nanoserver 1809
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 1
kind: dockerfile
spec:
file: 11/windows/nanoserver-1809/Dockerfile
instruction:
keyword: ARG
matcher: GIT_VERSION
scmid: default
setGitPackagePatchJDK11WindowsNanoserver1809:
name: Update the Git Package Windows patch for JDK11 Windows Nanoserver 1809
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 2
kind: dockerfile
spec:
file: 11/windows/nanoserver-1809/Dockerfile
instruction:
keyword: ARG
matcher: GIT_PATCH_VERSION
scmid: default
############# JDK11 Windows Server Core LTSC2019
setGitVersionJDK11WindowsServer2019:
name: Update the Git Windows version for JDK11 Windows Server Core LTSC2019
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 1
kind: dockerfile
spec:
file: 11/windows/windowsservercore-ltsc2019/Dockerfile
instruction:
keyword: ARG
matcher: GIT_VERSION
scmid: default
setGitPackagePatchJDK11WindowsServer2019:
name: Update the Git Package Windows patch for Windows Server Core LTSC2019
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 2
kind: dockerfile
spec:
file: 11/windows/windowsservercore-ltsc2019/Dockerfile
instruction:
keyword: ARG
matcher: GIT_PATCH_VERSION
scmid: default
############# JDK17 Nanoserver 18.09
setGitVersionJDK17WindowsNanoserver1809:
name: Update the Git Windows version for JDK17 Windows Nanoserver 1809
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 1
kind: dockerfile
spec:
file: 17/windows/nanoserver-1809/Dockerfile
instruction:
keyword: ARG
matcher: GIT_VERSION
scmid: default
setGitPackagePatchJDK17WindowsNanoserver1809:
name: Update the Git Package Windows patch for JDK17 Windows Nanoserver 1809
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 2
kind: dockerfile
spec:
file: 17/windows/nanoserver-1809/Dockerfile
instruction:
keyword: ARG
matcher: GIT_PATCH_VERSION
scmid: default
############# JDK17 Windows Server Core LTSC2019
setGitVersionJDK17WindowsServer2019:
name: Update the Git Windows version for JDK17 Windows Server Core LTSC2019
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 1
kind: dockerfile
spec:
file: 17/windows/windowsservercore-ltsc2019/Dockerfile
instruction:
keyword: ARG
matcher: GIT_VERSION
scmid: default
setGitPackagePatchJDK17WindowsServer2019:
name: Update the Git Package Windows patch for JDK17 Windows Server Core LTSC2019
transformers:
- findsubmatch:
pattern: '(.*).windows\.(\d*)$'
captureindex: 2
kind: dockerfile
spec:
file: 17/windows/windowsservercore-ltsc2019/Dockerfile
instruction:
keyword: ARG
matcher: GIT_PATCH_VERSION
scmid: default

actions:
default:
kind: github/pullrequest
title: Bump Git version on Windows to {{ source "lastVersion" }}
scmid: default
spec:
labels:
- enhancement
- git
- windows

0 comments on commit 4c1b95e

Please sign in to comment.