Merge pull request #5165 from adelina-t/azure_ci_workflow

Add CI periodic Windows Jobs.
This commit is contained in:
Derek McGowan
2021-05-28 08:12:25 -07:00
committed by GitHub
4 changed files with 246 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
Param(
[parameter(Mandatory=$true)]
[string]$SSHPublicKey
)
$ErrorActionPreference = "Stop"
function Set-SSHPublicKey {
if(!$SSHPublicKey) {
return
}
$authorizedKeysFile = Join-Path $env:ProgramData "ssh\administrators_authorized_keys"
Set-Content -Path $authorizedKeysFile -Value $SSHPublicKey -Encoding ascii
$acl = Get-Acl $authorizedKeysFile
$acl.SetAccessRuleProtection($true, $false)
$administratorsRule = New-Object system.security.accesscontrol.filesystemaccessrule("Administrators", "FullControl", "Allow")
$systemRule = New-Object system.security.accesscontrol.filesystemaccessrule("SYSTEM", "FullControl", "Allow")
$acl.SetAccessRule($administratorsRule)
$acl.SetAccessRule($systemRule)
$acl | Set-Acl
}
# Install OpenSSH
$(
Get-WindowsCapability -Online -Name OpenSSH* | Add-WindowsCapability -Online
Set-Service -Name sshd -StartupType Automatic
Start-Service sshd
# Authorize SSH key
Set-SSHPublicKey
# Set PowerShell as default shell
New-ItemProperty -Force -Path "HKLM:\SOFTWARE\OpenSSH" -PropertyType String `
-Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
) *>$1 >> c:\output.txt

View File

@@ -17,7 +17,7 @@
set -eu -o pipefail
DESTDIR="${DESTDIR:-"C:\\Program Files\\containerd"}"
WINCNI_BIN_DIR="${DESTDIR}/cni"
WINCNI_BIN_DIR="${DESTDIR}/cni/bin"
WINCNI_PKG=github.com/Microsoft/windows-container-networking
WINCNI_VERSION=aa10a0b31e9f72937063436454def1760b858ee2

View File

@@ -0,0 +1,40 @@
# Prepare windows environment for building and running containerd tests
$PACKAGES= "mingw", "git", "golang", "make"
write-host "Downloading chocolatey package"
curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip'
Expand-Archive "c:\choco.zip" -DestinationPath "c:\choco"
write-host "Installing choco"
& "c:\choco\tools\chocolateyInstall.ps1"
write-host "Set choco.exe path."
$env:PATH+=";C:\ProgramData\chocolatey\bin"
write-host "Install necessary packages"
foreach ($package in $PACKAGES) {
choco.exe install $package --yes
}
write-host "Set up environment."
$path = ";c:\Program Files\Git\bin;c:\Program Files\Go\bin;c:\Users\azureuser\go\bin;c:\containerd\bin"
$env:PATH+=$path
write-host $env:PATH
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, 'User')
# Prepare Log dir
mkdir c:\Logs
# Pull junit conversion tool
go get -u github.com/jstemmer/go-junit-report
# Get critctl tool. Used for cri-integration tests
$CRICTL_DOWNLOAD_URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-windows-amd64.tar.gz"
curl.exe -L $CRICTL_DOWNLOAD_URL -o c:\crictl.tar.gz
tar -xvf c:\crictl.tar.gz
mv crictl.exe c:\Users\azureuser\go\bin\crictl.exe # Move crictl somewhere in path