Skip to content

Commit

Permalink
Merge pull request #64 from phillipsj/feature/windows-server-2022-sup…
Browse files Browse the repository at this point in the history
…port

Adding Windows Server 2022 support.
  • Loading branch information
phillipsj authored Nov 12, 2021
2 parents 611e104 + 16dfc3b commit 11717bb
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 62 deletions.
115 changes: 60 additions & 55 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
kind: pipeline
type: docker
name: windows-1809

platform:
Expand All @@ -10,15 +11,15 @@ platform:
steps:
- name: build
pull: always
image: rancher/dapper:v0.5.6
image: rancher/dapper:v0.5.8
commands:
- dapper.exe -f Dockerfile.dapper -d ci
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine

- name: stage-binaries
image: rancher/dapper:v0.5.6
image: rancher/dapper:v0.5.8
commands:
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

Expand Down Expand Up @@ -79,40 +80,41 @@ trigger:

---
kind: pipeline
name: windows-2004
type: docker
name: windows-20H2

platform:
os: windows
arch: amd64
version: 2004
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: rancher/drone-images:git-2004
image: rancher/drone-images:git-20H2

- name: build
pull: always
image: rancher/dapper:v0.5.6
image: rancher/dapper:v0.5.8
commands:
- dapper.exe -f Dockerfile.dapper -d ci
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine

- name: stage-binaries
image: rancher/dapper:v0.5.6
image: rancher/dapper:v0.5.8
commands:
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: rancher/drone-images:docker-2004
image: rancher/drone-images:docker-20H2
settings:
build_args:
- SERVERCORE_VERSION=2004
- SERVERCORE_VERSION=20H2
- ARCH=amd64
- VERSION=${DRONE_TAG}
context: package/windows
Expand All @@ -123,7 +125,7 @@ steps:
password:
from_secret: docker_password
repo: rancher/wins
tag: ${DRONE_TAG}-windows-2004
tag: ${DRONE_TAG}-windows-20H2
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
Expand All @@ -146,60 +148,61 @@ trigger:

---
kind: pipeline
name: windows-20H2
type: docker
name: windows-ltsc2022

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

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

steps:
- name: clone
image: rancher/drone-images:git-20H2

- name: build
pull: always
image: rancher/dapper:v0.5.6
commands:
- dapper.exe -f Dockerfile.dapper -d ci
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine

- name: stage-binaries
image: rancher/dapper:v0.5.6
commands:
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: rancher/drone-images:docker-20H2
settings:
build_args:
- SERVERCORE_VERSION=20H2
- ARCH=amd64
- VERSION=${DRONE_TAG}
context: package/windows
custom_dns: 1.1.1.1
dockerfile: package/windows/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: rancher/wins
tag: ${DRONE_TAG}-windows-20H2
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
event:
- tag
ref:
- refs/heads/main
- refs/tags/*
- name: clone
image: rancher/drone-images:git-amd64-ltsc2022

- name: build
pull: always
image: rancher/dapper:v0.5.8
commands:
- dapper.exe -f Dockerfile.dapper -d ci
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine

- name: stage-binaries
image: rancher/dapper:v0.5.8
commands:
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: rancher/drone-images:docker-amd64-ltsc2022
settings:
build_args:
- SERVERCORE_VERSION=ltsc2022
- ARCH=amd64
- VERSION=${DRONE_TAG}
context: package/windows
custom_dns: 1.1.1.1
dockerfile: package/windows/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: rancher/wins
tag: ${DRONE_TAG}-windows-ltsc2022
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
event:
- tag
ref:
- refs/heads/main
- refs/tags/*

volumes:
- name: docker_pipe
Expand All @@ -212,6 +215,7 @@ trigger:
- promote
---
kind: pipeline
type: docker
name: manifest

platform:
Expand All @@ -238,11 +242,12 @@ trigger:

depends_on:
- windows-1809
- windows-2004
- windows-20H2
- windows-ltsc2022

---
kind: pipeline
type: docker
name: fossa

platform:
Expand Down
6 changes: 6 additions & 0 deletions manifest.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ manifests:
architecture: amd64
os: windows
version: 20H2
-
image: rancher/wins:{{build.tag}}-windows-ltsc2022
platform:
architecture: amd64
os: windows
version: ltsc2022
14 changes: 8 additions & 6 deletions scripts/package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ if ($env:DRONE_TAG) {
$TAG = $env:DRONE_TAG
}

# Get release id as image tag suffix
$HOST_RELEASE_ID = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -ErrorAction Ignore).ReleaseId
$IMAGE = ('{0}/wins:{1}-windows-{2}' -f $REPO, $TAG, $HOST_RELEASE_ID)
if (-not $HOST_RELEASE_ID) {
Log-Fatal "release ID not found"
$buildTags = @{ "17763" = "1809"; "19042" = "20H2"; "20348" = "ltsc2022";}
$buildNumber = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -ErrorAction Ignore).CurrentBuildNumber
$WINDOWS_VERSION = $buildTags[$buildNumber]
if (-not $WINDOWS_VERSION) {
$WINDOWS_VERSION = "1809"
}

$IMAGE = ('{0}/wins:{1}-windows-{2}' -f $REPO, $TAG, $WINDOWS_VERSION)

$ARCH = $env:ARCH

docker build `
--build-arg SERVERCORE_VERSION=$HOST_RELEASE_ID `
--build-arg SERVERCORE_VERSION=$WINDOWS_VERSION `
--build-arg ARCH=$ARCH `
--build-arg VERSION=$TAG `
-t $IMAGE `
Expand Down
8 changes: 8 additions & 0 deletions scripts/version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ if (-not $ARCH) {
}
$env:ARCH = $ARCH

$buildTags = @{ "17763" = "1809"; "19042" = "20H2"; "20348" = "ltsc2022";}
$buildNumber = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -ErrorAction Ignore).CurrentBuildNumber
$SERVERCORE_VERSION = $buildTags[$buildNumber]
if (-not $SERVERCORE_VERSION) {
$env:SERVERCORE_VERSION = "1809"
}

Write-Host "ARCH: $ARCH"
Write-Host "VERSION: $VERSION"
Write-Host "SERVERCORE_VERSION: $SERVERCORE_VERSION"
8 changes: 7 additions & 1 deletion tests/integration/integration_suite_test.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
$ErrorActionPreference = "Stop"

# docker build
$SERVERCORE_VERSION = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' | Select-Object -ExpandProperty ReleaseId
$buildTags = @{ "17763" = "1809"; "19042" = "20H2"; "20348" = "ltsc2022";}
$buildNumber = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -ErrorAction Ignore).CurrentBuildNumber
$SERVERCORE_VERSION = $buildTags[$buildNumber]
if (-not $SERVERCORE_VERSION) {
$SERVERCORE_VERSION = "1809"
}

Get-ChildItem -Path $PSScriptRoot\docker -Name Dockerfile.* | ForEach-Object {
$dockerfile = $_
$tag = $dockerfile -replace "Dockerfile.", ""
Expand Down

0 comments on commit 11717bb

Please sign in to comment.