added versioning to windows docker containers
This commit is contained in:
parent
ede0017017
commit
548e07d5d4
7 changed files with 36 additions and 15 deletions
|
@ -1,7 +1,8 @@
|
||||||
# escape=`
|
# escape=`
|
||||||
|
|
||||||
# use windows server core image
|
# use windows server core image
|
||||||
FROM gcr.io/llvm-premerge-checks/agent-windows
|
ARG agent_windows_version
|
||||||
|
FROM gcr.io/llvm-premerge-checks/agent-windows:${agent_windows_version}
|
||||||
|
|
||||||
# install buildkite agent as described in the documentation
|
# install buildkite agent as described in the documentation
|
||||||
# https://buildkite.com/docs/agent/v3/windows
|
# https://buildkite.com/docs/agent/v3/windows
|
||||||
|
|
BIN
containers/agent-windows-buildkite/VERSION
Normal file
BIN
containers/agent-windows-buildkite/VERSION
Normal file
Binary file not shown.
|
@ -1,7 +1,8 @@
|
||||||
# escape=`
|
# escape=`
|
||||||
|
|
||||||
# use windows server core image
|
# use windows server core image
|
||||||
FROM gcr.io/llvm-premerge-checks/agent-windows
|
ARG agent_windows_version
|
||||||
|
FROM gcr.io/llvm-premerge-checks/agent-windows:$agent_windows_version
|
||||||
|
|
||||||
# install java
|
# install java
|
||||||
RUN choco install -y openjdk
|
RUN choco install -y openjdk
|
||||||
|
@ -17,9 +18,6 @@ RUN powershell -NoProfile -InputFormat None -Command `
|
||||||
RUN pip install gsutil
|
RUN pip install gsutil
|
||||||
VOLUME C:\credentials
|
VOLUME C:\credentials
|
||||||
|
|
||||||
# configure gsutil
|
|
||||||
COPY .boto "C:\Users\ContainerAdministrator\.boto"
|
|
||||||
|
|
||||||
# install python dependencies for the scripts
|
# install python dependencies for the scripts
|
||||||
RUN pip install -r https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/requirements.txt
|
RUN pip install -r https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/requirements.txt
|
||||||
|
|
||||||
|
|
BIN
containers/agent-windows-jenkins/VERSION
Normal file
BIN
containers/agent-windows-jenkins/VERSION
Normal file
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
# escape=`
|
# escape=`
|
||||||
|
|
||||||
# use windows server core image
|
# use windows server core image
|
||||||
ARG version=ltsc2019
|
ARG windows_version=ltsc2019
|
||||||
FROM mcr.microsoft.com/windows/servercore:$version
|
FROM mcr.microsoft.com/windows/servercore:${windows_version}
|
||||||
|
|
||||||
# install chocolately as package manager
|
# install chocolately as package manager
|
||||||
RUN powershell -NoProfile -InputFormat None -Command `
|
RUN powershell -NoProfile -InputFormat None -Command `
|
||||||
|
|
BIN
containers/agent-windows/VERSION
Normal file
BIN
containers/agent-windows/VERSION
Normal file
Binary file not shown.
|
@ -17,21 +17,43 @@ param(
|
||||||
[Parameter(Mandatory=$true)][string]$IMAGE_NAME
|
[Parameter(Mandatory=$true)][string]$IMAGE_NAME
|
||||||
)
|
)
|
||||||
|
|
||||||
New-Variable -Name ROOT_DIR -Value (Get-Item $PSScriptRoot).Parent.FullName
|
$ROOT_DIR=(Get-Item $PSScriptRoot).Parent.FullName
|
||||||
|
. ${ROOT_DIR}\scripts\common.ps1
|
||||||
|
$VERSION_FILE="VERSION"
|
||||||
|
|
||||||
# get config options
|
# get config options
|
||||||
Get-Content "${ROOT_DIR}/k8s_config" | Foreach-Object{
|
Get-Content "${ROOT_DIR}\k8s_config" | Foreach-Object{
|
||||||
$var = $_.Split('=')
|
if (! $_.StartsWith('#') ){
|
||||||
New-Variable -Name $var[0] -Value $var[1]
|
$var = $_.Split('=')
|
||||||
|
New-Variable -Name $var[0] -Value $var[1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
New-Variable -Name QUALIFIED_NAME -Value "${GCR_HOSTNAME}/${GCP_PROJECT}/${IMAGE_NAME}"
|
$QUALIFIED_NAME="${GCR_HOSTNAME}/${GCP_PROJECT}/${IMAGE_NAME}"
|
||||||
|
|
||||||
Push-Location "$PSScriptRoot\$IMAGE_NAME"
|
Push-Location "$PSScriptRoot\$IMAGE_NAME"
|
||||||
|
$container_version=[int](Get-Content $VERSION_FILE)
|
||||||
|
$container_version+=1
|
||||||
|
$agent_windows_version=Get-Content "../agent-windows/$VERSION_FILE"
|
||||||
|
|
||||||
|
Write-Host "Building ${IMAGE_NAME}:${container_version}..."
|
||||||
|
Write-Host "Using windows-agent:${agent_windows_version}"
|
||||||
|
|
||||||
# TODO: get current Windows version number from host via "cmd /c ver"
|
# TODO: get current Windows version number from host via "cmd /c ver"
|
||||||
# to solve these issues: https://stackoverflow.com/questions/43123851/unable-to-run-cygwin-in-windows-docker-container/52273489#52273489
|
# to solve these issues: https://stackoverflow.com/questions/43123851/unable-to-run-cygwin-in-windows-docker-container/52273489#52273489
|
||||||
docker build -t $IMAGE_NAME --build-arg version=10.0.17763.1039 .
|
$windows_version="10.0.17763.1039"
|
||||||
docker tag $IMAGE_NAME $QUALIFIED_NAME
|
|
||||||
docker push $QUALIFIED_NAME
|
Invoke-Call -ScriptBlock {
|
||||||
|
docker build . `
|
||||||
|
-t ${IMAGE_NAME}:${container_version} `
|
||||||
|
--build-arg windows_version=$windows_version `
|
||||||
|
--build-arg agent_windows_version=$agent_windows_version
|
||||||
|
}
|
||||||
|
Invoke-Call -ScriptBlock {
|
||||||
|
docker tag ${IMAGE_NAME}:${container_version} ${QUALIFIED_NAME}:${container_version}
|
||||||
|
}
|
||||||
|
Invoke-Call -ScriptBlock {
|
||||||
|
docker push ${QUALIFIED_NAME}:$container_version
|
||||||
|
}
|
||||||
|
$container_version | Out-File $VERSION_FILE
|
||||||
Pop-Location
|
Pop-Location
|
Loading…
Reference in a new issue