Skip to content

Commit 71a3441

Browse files
authored
Merge pull request rancher#163 from luthermonson/v1.19
Adding Windows 20H2 Builds
2 parents 80e80b8 + 09d5b62 commit 71a3441

File tree

3 files changed

+121
-2
lines changed

3 files changed

+121
-2
lines changed

.drone.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,48 @@ steps:
209209
event:
210210
- tag
211211

212+
volumes:
213+
- name: docker_pipe
214+
host:
215+
path: \\\\.\\pipe\\docker_engine
216+
217+
---
218+
kind: pipeline
219+
name: windows-20H2
220+
221+
platform:
222+
os: windows
223+
arch: amd64
224+
version: 20H2
225+
226+
# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
227+
clone:
228+
disable: true
229+
230+
steps:
231+
- name: clone
232+
image: luthermonson/drone-git:windows-20H2-amd64
233+
- name: publish-hyperkube-windows-20H2
234+
image: luthermonson/drone-docker:20H2
235+
settings:
236+
username:
237+
from_secret: docker_username
238+
password:
239+
from_secret: docker_password
240+
dockerfile: Dockerfile.windows.20H2
241+
repo: rancher/hyperkube
242+
tag: "${DRONE_TAG}-windows-20H2"
243+
build_args:
244+
- SERVERCORE_VERSION=20H2
245+
volumes:
246+
- name: docker_pipe
247+
path: \\\\.\\pipe\\docker_engine
248+
when:
249+
instance:
250+
- drone-publish.rancher.io
251+
event:
252+
- tag
253+
212254
volumes:
213255
- name: docker_pipe
214256
host:
@@ -219,7 +261,7 @@ name: manifest
219261

220262
steps:
221263
- name: push-manifest
222-
image: ibuildthecloud/manifest:v1.2.3-patch1
264+
image: plugins/manifest
223265
settings:
224266
username:
225267
from_secret: docker_username
@@ -237,4 +279,5 @@ depends_on:
237279
- windows-1809
238280
- windows-1903
239281
- windows-1909
240-
- windows-2004
282+
- windows-2004
283+
- windows-20H2

Dockerfile.windows.20H2

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
ARG SERVERCORE_VERSION
2+
3+
FROM mcr.microsoft.com/windows/servercore:${SERVERCORE_VERSION} as builder
4+
SHELL ["powershell", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
RUN if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) { \
6+
Install-PackageProvider -Name NuGet -Force -Verbose; \
7+
Install-Module -Name 7Zip4Powershell -Repository PSGallery -Force -Verbose; \
8+
if(-not $?) { \
9+
Write-Error "Failed to install package"; \
10+
Exit 1; \
11+
} \
12+
}
13+
ENV K8S_VERSION v1.19.7
14+
RUN $URL = ('https://dl.k8s.io/{0}/kubernetes-node-windows-amd64.tar.gz' -f $env:K8S_VERSION); \
15+
\
16+
function Expand-GZip ($inFile, $outFile) { \
17+
$input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read); \
18+
$output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None); \
19+
$gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress); \
20+
try { \
21+
if (!$input -or !$output -or !$gzipStream) { \
22+
Write-Error "Failed to Unzip the archive"; \
23+
Exit 1; \
24+
} \
25+
$buffer = New-Object byte[](1024); \
26+
while ($true) { \
27+
$read = $gzipstream.Read($buffer, 0, 1024); \
28+
if ($read -le 0 ) { \
29+
break; \
30+
} \
31+
$output.Write($buffer, 0, $read); \
32+
} \
33+
} finally { \
34+
$gzipStream.Close(); \
35+
$output.Close(); \
36+
$input.Close(); \
37+
} \
38+
}; \
39+
\
40+
Write-Host ('Downloading Kubernetes from {0} ...' -f $URL); \
41+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
42+
Invoke-WebRequest -UseBasicParsing -OutFile c:\kubernetes.tar.gz -Uri $URL; \
43+
\
44+
Write-Host 'Expanding ...'; \
45+
Expand-GZip c:\kubernetes.tar.gz c:\kubernetes.tar; \
46+
Expand-7Zip c:\kubernetes.tar c:\; \
47+
\
48+
Write-Host 'Complete.'
49+
50+
# FROM mcr.microsoft.com/powershell:nanoserver-${SERVERCORE_VERSION}
51+
# USER ContainerAdministrator
52+
# SHELL ["pwsh.exe", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
53+
RUN $URL = 'https://github.com/rancher/azure-cli/releases/download/v0.0.2/dist.azure-cli.zip'; \
54+
\
55+
Write-Host ('Downloading azure-cli from {0} ...' -f $URL); \
56+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
57+
Invoke-WebRequest -UseBasicParsing -OutFile c:\azure-cli.zip -Uri $URL; \
58+
\
59+
Write-Host 'Expanding ...'; \
60+
Expand-Archive -Force -Path c:\azure-cli.zip -DestinationPath c:\azure-cli; \
61+
Remove-Item -Force -Path c:\azure-cli.zip; \
62+
\
63+
Write-Host 'Complete.'
64+
# COPY --from=builder /Windows/System32/netapi32.dll /Windows/System32/
65+
RUN Move-Item -Path /kubernetes/node/bin/kubectl.exe -Destination /Windows
66+
RUN New-Item -Force -ItemType Directory -Path /etc; \
67+
New-Item -Force -ItemType Directory -Path /etc/kubernetes; \
68+
New-Item -Force -ItemType Directory -Path /etc/kubernetes/bin; \
69+
Move-Item -Path /kubernetes/node/bin/*.exe -Destination /etc/kubernetes/bin/
70+
COPY windows/entrypoint.ps1 /usr/bin/

manifest.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ manifests:
3434
architecture: amd64
3535
os: windows
3636
version: 2004
37+
-
38+
image: rancher/hyperkube:{{build.tag}}-windows-20H2
39+
platform:
40+
architecture: amd64
41+
os: windows
42+
version: 20H2

0 commit comments

Comments
 (0)