Skip to content

Instantly share code, notes, and snippets.

@johnmccrae
Created January 26, 2020 23:36
Show Gist options
  • Save johnmccrae/d9742926dfc3ee3405ee372df163bc3a to your computer and use it in GitHub Desktop.
Save johnmccrae/d9742926dfc3ee3405ee372df163bc3a to your computer and use it in GitHub Desktop.
{
"variables": {
"build_version": "1",
"buildkite-agent": null,
"client_id": "{{env `ARM_CLIENT_ID`}}",
"location": "{{env `ARM_DEFAULT_LOCATION`}}",
"client_secret": "{{env `ARM_CLIENT_SECRET`}}",
"tenant_id": "{{env `ARM_TENANT_ID`}}",
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
"managed_image_prefix": "buildkite_window_10_disk_{{timestamp}}",
"package_location": "",
"working_directory": "",
"ci-studio-common": null,
"habitat": null,
"winrm_username": "Administrator"
},
"builders": [
{
"type": "azure-arm",
"client_id": "<Hi>",
"client_secret": "<shhhh, it's a secret>",
"tenant_id": "<nunya>",
"subscription_id": "<something-something that Azure understands goes here.>",
"managed_image_name": "buildkite-windows-10",
"managed_image_resource_group_name": "EDM_Master_Storage_Resource_Group",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsDesktop",
"image_offer": "windows-10",
"image_sku": "19h2-ent",
"image_version": "latest",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "3m",
"azure_tags": {
"CreatedOn": "01-26-2020",
"Createdby": "name"
},
"location": "West US 2",
"vm_size": "Standard_B4ms"
}
],
"provisioners": [
{
"type": "file",
"source": "conf",
"destination": "C:/packer-temp"
},
{
"type": "powershell",
"script": "scripts/install-utils.ps1"
},
{
"type": "powershell",
"script": "scripts/update-users.ps1"
},
{
"type": "powershell",
"script": "scripts/install-buildkite-agent.ps1",
"environment_vars": [
"BUILDKITE_AGENT_VERSION={{ user `buildkite-agent` }}"
]
},
{
"type": "powershell",
"script": "scripts/install-buildkite-plugins.ps1",
"environment_vars": [
"DOCKER_LOGIN_BUILDKITE_PLUGIN_VERSION = {{ user `docker-login-buildkite-plugin` }}",
"ECR_BUILDKITE_PLUGIN_VERSION = {{ user `ecr-buildkite-plugin` }}"
]
},
{
"type": "file",
"source": "scripts/buildkite-agent.cfg",
"destination": "c:/buildkite-agent/buildkite-agent.cfg"
},
{
"type": "powershell",
"script": "scripts/install-ci-studio-common.ps1",
"environment_vars": [
"CI_STUDIO_COMMON_VERSION={{ user `ci-studio-common` }}"
]
},
{
"type": "powershell",
"script": "scripts/install-habitat.ps1",
"environment_vars": [
"HABITAT_VERSION={{ user `habitat` }}"
]
},
{
"type": "powershell",
"script": "scripts/install-hooks.ps1"
},
{
"type": "powershell",
"inline": [
"Remove-Item -Path C:/packer-temp -Recurse"
]
},
{
"type": "powershell",
"script": "scripts/configure-buildkite.ps1"
},
{
"type": "powershell",
"inline": [
"Choco install chef-workstation -y",
"Choco install ruby -y"
]
},
{
"type": "powershell",
"inline": [
"Choco install msys2 -y"
]
},
{
"type": "powershell",
"script": "scripts/update-path.ps1"
},
{
"type": "powershell",
"script": "scripts/install-bundler.ps1"
},
{
"type": "powershell",
"inline": [
" # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
" while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" & C:\\\\Windows\\\\System32\\\\Sysprep\\\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
" while(True) { = Get-ItemProperty HKLM:\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Setup\\\\State | Select ImageState; if(.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output .ImageState; Start-Sleep -s 10 } else { break } }"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment