Skip to content

mattkur/docker-w2wCIScripts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

John Howard, Microsoft Corporation (@jhowardmsft). November 2016.

This repo has scripts to deploy, configure, setup development VMs, and run Docker CI on Windows Server 2016.

###Directories - Deployment scripts

  • common - Common to all flavours
  • rs1 - rs1 (also rs2 and rs3 as of March 2017) specifics
  • config - tells production servers how to configure themselves according to the hostname

###Other directories

  • runCI - The scripts to run CI, including Invoke-DockerCI. executeCI.ps1 is what is configured in Jenkins.
  • Deploy-JenkinsVM - Easy way to deploy a Jenkins VM
  • Install-DevVM - Setup an existing VM for development/CI VM if on Microsoft corpnet.
  • Prepare-CIImage - Pick a build (on corpnet) and get a development VM (and optional) azure VHD from it.

How to use.

Pre-reqs

  • Need publish settings in $env:HOME\.azure\[email protected] Get-AzurePublishSettingsFile and save to above location.

  • Make sure your azure credentials are set. (Add-AzureAccount for [email protected])

  • Run elevated

Sample variables for development VM only

$sourceDir="\winbuilds\release\RS1_RELEASE\14393.693.161220-1747" $AzureImageVersion=0 $debugPort=50001 cd e:\docker\ci\w2w\Prepare-CIImage $AzureVMSize="" $AzurePassword="" $AzureStorageAccount="winrs1" $configSet="rs1" $vmBasePath="e:\VMs" $localPassword="something" $vmSwitch="Wired"

Sample variables for production VHD (and development VM)

$sourceDir="\winbuilds\release\RS1_RELEASE\14393.693.161220-1747" $AzureImageVersion=31 $debugPort=50001 cd e:\docker\ci\w2w\Prepare-CIImage $AzureVMSize="D3" $AzurePassword="somethingelse" $AzureStorageAccount="winrs1" $configSet="rs1" $vmBasePath="e:\VMs" $localPassword="something" $vmSwitch="Wired"

###Create the development VM (and Azure image optionally) cd e:\docker\ci\w2w\Prepare-CIImage .\Prepare-CIImage.ps1 -Target $vmBasePath -Password $localPassword -CreateVM -Switch $vmSwitch -DebugPort $debugPort -Path $sourceDir -ConfigSet $configSet -AzureImageVersion $AzureImageVersion -AzurePassword $AzurePassword

###Upload VHD to Azure and create an image from it $parts=$sourceDir.Split(""); $localLocation=(join-path $vmBasePath -ChildPath ("$($parts[4]) $($parts[5])")); $localVHD=(join-Path $localLocation -ChildPath "azure$($configSet)v$AzureImageVersion.vhd") $AzureMediaLocation="https://$AzureStorageAccount.blob.core.windows.net/vhds/azure$($configSet)v$($AzureImageVersion).vhd" Add-Azurevhd $AzureMediaLocation -LocalFilePath $localVHD Add-AzureVMImage -imagename "azure$($ConfigSet)v$($AzureImageVersion)" -MediaLocation $AzureMediaLocation -OS Windows

Deploy to production

$vmIDs=@(1,2,3,4,5,6,7,8,9) foreach ($vmID in $vmIDs) { start-job -argumentlist $vmID,$AzureVMSize,$AzureImageVersion,$configSet,$AzurePassword { param([int]$vmID, [string]$AzureVMSize,[int]$AzureImageVersion,[string]$configSet,[string]$AzurePassword ) cd e:\docker\ci\W2W\Deploy-JenkinsVM; dir; .\Deploy-JenkinsVM -Force -Size $AzureVMSize -ImageVersion $AzureImageVersion "jenkins-$configSet-$vmID" -Password $AzurePassword -ConfigSet $ConfigSet } | Out-Null }; Write-Host -nonewline "Deploying $($vmIDs.Count) production VMs in parallel:" while (Get-Job -State "Running") { Write-Host -nonewline "."; Start-Sleep -Seconds 5 }; Write-Host "n" foreach ($job in Get-Job) { Receive-Job $Job; Remove-Job $Job; Write-Host -ForegroundColor Yellow "nn - - - - - - - -n`n" }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 98.9%
  • Other 1.1%