Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,48 @@ steps:
event:
- tag

volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine

---
kind: pipeline
name: windows-20H2

platform:
os: windows
arch: amd64
version: 20H2

# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
clone:
disable: true

steps:
- name: clone
image: luthermonson/drone-git:windows-20H2-amd64
- name: publish-hyperkube-windows-20H2
image: luthermonson/drone-docker:20H2
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile.windows.20H2
repo: rancher/hyperkube
tag: "${DRONE_TAG}-windows-20H2"
build_args:
- SERVERCORE_VERSION=20H2
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
instance:
- drone-publish.rancher.io
event:
- tag

volumes:
- name: docker_pipe
host:
Expand All @@ -219,7 +261,7 @@ name: manifest

steps:
- name: push-manifest
image: ibuildthecloud/manifest:v1.2.3-patch1
image: plugins/manifest
settings:
username:
from_secret: docker_username
Expand All @@ -237,4 +279,5 @@ depends_on:
- windows-1809
- windows-1903
- windows-1909
- windows-2004
- windows-2004
- windows-20H2
70 changes: 70 additions & 0 deletions Dockerfile.windows.20H2
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
ARG SERVERCORE_VERSION

FROM mcr.microsoft.com/windows/servercore:${SERVERCORE_VERSION} as builder
SHELL ["powershell", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) { \
Install-PackageProvider -Name NuGet -Force -Verbose; \
Install-Module -Name 7Zip4Powershell -Repository PSGallery -Force -Verbose; \
if(-not $?) { \
Write-Error "Failed to install package"; \
Exit 1; \
} \
}
ENV K8S_VERSION v1.19.7
RUN $URL = ('https://dl.k8s.io/{0}/kubernetes-node-windows-amd64.tar.gz' -f $env:K8S_VERSION); \
\
function Expand-GZip ($inFile, $outFile) { \
$input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read); \
$output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None); \
$gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress); \
try { \
if (!$input -or !$output -or !$gzipStream) { \
Write-Error "Failed to Unzip the archive"; \
Exit 1; \
} \
$buffer = New-Object byte[](1024); \
while ($true) { \
$read = $gzipstream.Read($buffer, 0, 1024); \
if ($read -le 0 ) { \
break; \
} \
$output.Write($buffer, 0, $read); \
} \
} finally { \
$gzipStream.Close(); \
$output.Close(); \
$input.Close(); \
} \
}; \
\
Write-Host ('Downloading Kubernetes from {0} ...' -f $URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -UseBasicParsing -OutFile c:\kubernetes.tar.gz -Uri $URL; \
\
Write-Host 'Expanding ...'; \
Expand-GZip c:\kubernetes.tar.gz c:\kubernetes.tar; \
Expand-7Zip c:\kubernetes.tar c:\; \
\
Write-Host 'Complete.'

# FROM mcr.microsoft.com/powershell:nanoserver-${SERVERCORE_VERSION}
# USER ContainerAdministrator
# SHELL ["pwsh.exe", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN $URL = 'https://github.com/rancher/azure-cli/releases/download/v0.0.2/dist.azure-cli.zip'; \
\
Write-Host ('Downloading azure-cli from {0} ...' -f $URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -UseBasicParsing -OutFile c:\azure-cli.zip -Uri $URL; \
\
Write-Host 'Expanding ...'; \
Expand-Archive -Force -Path c:\azure-cli.zip -DestinationPath c:\azure-cli; \
Remove-Item -Force -Path c:\azure-cli.zip; \
\
Write-Host 'Complete.'
# COPY --from=builder /Windows/System32/netapi32.dll /Windows/System32/
RUN Move-Item -Path /kubernetes/node/bin/kubectl.exe -Destination /Windows
RUN New-Item -Force -ItemType Directory -Path /etc; \
New-Item -Force -ItemType Directory -Path /etc/kubernetes; \
New-Item -Force -ItemType Directory -Path /etc/kubernetes/bin; \
Move-Item -Path /kubernetes/node/bin/*.exe -Destination /etc/kubernetes/bin/
COPY windows/entrypoint.ps1 /usr/bin/
6 changes: 6 additions & 0 deletions manifest.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ manifests:
architecture: amd64
os: windows
version: 2004
-
image: rancher/hyperkube:{{build.tag}}-windows-20H2
platform:
architecture: amd64
os: windows
version: 20H2