diff --git a/azure.pkr.hcl b/azure.pkr.hcl index 16731213..813d1d5f 100644 --- a/azure.pkr.hcl +++ b/azure.pkr.hcl @@ -41,6 +41,16 @@ variable "deployment_id" { default = "${env("deployment_id")}" } +variable "lastdeploy_id" { + type = string + default = "${env("lastdeploy_id")}" +} + +variable "notes" { + type = string + default = "" +} + variable "disk_additional_size" { type = string default = "${env("disk_additional_size")}" @@ -409,16 +419,19 @@ build { "src_Repository=${var.source_repository}", "src_Branch=${var.source_branch}", "deploymentId=${var.deployment_id}", + "lastdeployId=${var.lastdeploy_id}", "config=${var.config}", "client_id=${var.client_id}", "tenant_id=${var.tenant_id}", "application_id=${var.application_id}", + "notes=${var.notes}", "sharedimage_version=${var.sharedimage_version}" ] inline = [ "Import-Module BootStrap -Force", "Set-MarkdownPSModule", - "Set-ReleaseNotes -Config $ENV:config -Version $ENV:sharedimage_version -Organization $ENV:src_organisation -Branch $ENV:src_Branch -Repository $ENV:src_Repository -DeploymentId $ENV:deploymentId" + "Set-ReleaseNotes2 -Config $ENV:config -Version $ENV:sharedimage_version -Organization $ENV:src_organisation -Branch $ENV:src_Branch -Repository $ENV:src_Repository -DeploymentId $ENV:deploymentId -LastDeployID $ENV:lastdeployId -Notes @($env:notes -split '`n')", + "Write-Host Set-ReleaseNotes2 -Config $ENV:config -Version $ENV:sharedimage_version -Organization $ENV:src_organisation -Branch $ENV:src_Branch -Repository $ENV:src_Repository -DeploymentId $ENV:deploymentId -LastDeployID $ENV:lastdeployId" ] } @@ -451,3 +464,4 @@ build { } } + diff --git a/azure_temp.pkr.hcl b/azure_temp.pkr.hcl deleted file mode 100644 index 813d1d5f..00000000 --- a/azure_temp.pkr.hcl +++ /dev/null @@ -1,467 +0,0 @@ -packer { - required_plugins { - azure = { - version = ">= 1.4.5" - source = "github.com/hashicorp/azure" - } - } -} - -locals { - sbom_name = var.config -} - -variable "base_image" { - type = string - default = "${env("base_image")}" -} - -variable "bootstrap_script" { - type = string - default = "${env("bootstrap_script")}" -} - -variable "client_id" { - type = string - default = "${env("client_id")}" -} - -variable "oidc_request_url" { - type = string - default = "${env("ACTIONS_ID_TOKEN_REQUEST_URL")}" -} - -variable "oidc_request_token" { - type = string - default = "${env("ACTIONS_ID_TOKEN_REQUEST_TOKEN")}" -} - -variable "deployment_id" { - type = string - default = "${env("deployment_id")}" -} - -variable "lastdeploy_id" { - type = string - default = "${env("lastdeploy_id")}" -} - -variable "notes" { - type = string - default = "" -} - -variable "disk_additional_size" { - type = string - default = "${env("disk_additional_size")}" -} - -variable "image_offer" { - type = string - default = "${env("image_offer")}" -} - -variable "image_publisher" { - type = string - default = "${env("image_publisher")}" -} - -variable "image_sku" { - type = string - default = "${env("image_sku")}" -} - -variable "image_version" { - type = string - default = "${env("image_version")}" -} - -variable "sharedimage_version" { - type = string - default = "${env("sharedimage_version")}" -} - -variable "location" { - type = string - default = "${env("location")}" -} - -variable "managed-by" { - type = string - default = "${env("managed_by")}" -} - -variable "managed_image_name" { - type = string - default = "${env("managed_image_name")}" -} - -variable "managed_image_storage_account_type" { - type = string - default = "${env("managed_image_storage_account_type")}" -} - -variable "source_branch" { - type = string - default = "${env("source_branch")}" -} - -variable "source_organization" { - type = string - default = "${env("source_organization")}" -} - -variable "source_repository" { - type = string - default = "${env("sourceRepository")}" -} - -variable "subscription_id" { - type = string - default = "${env("subscription_id")}" -} - -variable "tenant_id" { - type = string - default = "${env("tenant_id")}" -} - -variable "vm_size" { - type = string - default = "${env("vm_size")}" -} - -variable "worker_pool_id" { - type = string - default = "${env("worker_pool_id")}" -} - -variable "resource_group" { - type = string - default = "${env("resource_group")}" -} - -variable "temp_resource_group_name" { - type = string - default = "${env("temp_resource_group_name")}" -} - -variable "gallery_name" { - type = string - default = "${env("gallery_name")}" -} - -variable "image_name" { - type = string - default = "${env("image_name")}" -} - -variable "application_id" { - type = string - default = "${env("application_id")}" -} - -variable "config" { - type = string - default = "${env("config")}" -} - -source "azure-arm" "sig" { - # WinRM - communicator = "winrm" - winrm_insecure = "true" - winrm_timeout = "3m" - winrm_use_ssl = "true" - winrm_username = "packer" - - # Authentication - oidc_request_url = "${var.oidc_request_url}" - oidc_request_token = "${var.oidc_request_token}" - client_id = "${var.client_id}" - subscription_id = "${var.subscription_id}" - tenant_id = "${var.tenant_id}" - - # Source - os_type = "Windows" - image_publisher = "${var.image_publisher}" - image_offer = "${var.image_offer}" - image_sku = "${var.image_sku}" - image_version = "${var.image_version}" - - # Destination - temp_resource_group_name = "${var.temp_resource_group_name}" - location = "Central US" - vm_size = "${var.vm_size}" - async_resourcegroup_delete = true - - # Shared image gallery https:github.com/mozilla-platform-ops/relops_infra_as_code/blob/master/terraform/azure_fx_nonci/worker-images.tf - shared_image_gallery_destination { - subscription = "${var.subscription_id}" - resource_group = "${var.resource_group}" - gallery_name = "${var.gallery_name}" - image_name = "${var.image_name}" - image_version = "${var.sharedimage_version}" - replication_regions = [ - "canadacentral", - "centralindia", - "eastus", - "eastus2", - "northcentralus", - "northeurope", - "southindia", - "southcentralus", - "uksouth", - "westus", - "westus2", - "westus3" - ] - } - - # Tags - azure_tags = { - base_image = "${var.base_image}" - deploymentId = "${var.deployment_id}" - sourceBranch = "${var.source_branch}" - sourceOrganisation = "${var.source_organization}" - sourceRepository = "${var.source_repository}" - worker_pool_id = "${var.worker_pool_id}" - } -} - -source "azure-arm" "nonsig" { - # WinRM - communicator = "winrm" - winrm_insecure = "true" - winrm_timeout = "3m" - winrm_use_ssl = "true" - winrm_username = "packer" - - # Authentication - oidc_request_url = "${var.oidc_request_url}" - oidc_request_token = "${var.oidc_request_token}" - client_id = "${var.client_id}" - subscription_id = "${var.subscription_id}" - tenant_id = "${var.tenant_id}" - - # Source - os_type = "Windows" - image_publisher = "${var.image_publisher}" - image_offer = "${var.image_offer}" - image_sku = "${var.image_sku}" - image_version = "${var.image_version}" - - # Destination - temp_resource_group_name = "${var.temp_resource_group_name}" - location = "${var.location}" - managed_image_storage_account_type = "Standard_LRS" - vm_size = "${var.vm_size}" - managed_image_name = "${var.managed_image_name}" - managed_image_resource_group_name = "${var.resource_group}" - async_resourcegroup_delete = true - - # Tags - azure_tags = { - base_image = "${var.base_image}" - deploymentId = "${var.deployment_id}" - sourceBranch = "${var.source_branch}" - sourceOrganisation = "${var.source_organization}" - sourceRepository = "${var.source_repository}" - worker_pool_id = "${var.worker_pool_id}" - image_version = "${var.image_version}" - } - -} - -build { - sources = [ - "source.azure-arm.sig", - "source.azure-arm.nonsig" - ] - - provisioner "powershell" { - inline = [ - "$ErrorActionPreference='SilentlyContinue'", - "Set-ExecutionPolicy unrestricted -force" - ] - } - - provisioner "file" { - source = "${path.root}/scripts/windows/CustomFunctions/Bootstrap" - destination = "C:/Windows/System32/WindowsPowerShell/v1.0/Modules/" - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - inline = [ - "$null = New-Item -Name 'Tests' -Path C:/ -Type Directory -Force", - "$null = New-Item -Name 'Config' -Path C:/ -Type Directory -Force" - ] - } - - provisioner "file" { - source = "${path.cwd}/tests/win/" - destination = "C:/Tests" - } - - provisioner "file" { - source = "${path.cwd}/config/" - destination = "C:/Config" - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - environment_vars = [ - "worker_pool_id=${var.worker_pool_id}", - "base_image=${var.base_image}", - "src_organisation=${var.source_organization}", - "src_Repository=${var.source_repository}", - "src_Branch=${var.source_branch}", - "deploymentId=${var.deployment_id}", - "client_id=${var.client_id}", - "tenant_id=${var.tenant_id}", - "application_id=${var.application_id}", - "config=${var.config}" - ] - inline = [ - "Import-Module BootStrap -Force", - "Disable-AntiVirus", - "Set-Logging", - "Install-AzPreReq", - "Set-RoninRegOptions" - ] - } - - provisioner "windows-restart" { - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - environment_vars = [ - "worker_pool_id=${var.worker_pool_id}", - "base_image=${var.base_image}", - "src_organisation=${var.source_organization}", - "src_Repository=${var.source_repository}", - "src_Branch=${var.source_branch}", - "deploymentId=${var.deployment_id}" - ] - inline = [ - "Import-Module BootStrap -Force", - "Set-AzRoninRepo" - ] - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - environment_vars = [ - "worker_pool_id=${var.worker_pool_id}", - "base_image=${var.base_image}", - "src_organisation=${var.source_organization}", - "src_Repository=${var.source_repository}", - "src_Branch=${var.source_branch}", - "deploymentId=${var.deployment_id}", - "client_id=${var.client_id}", - "tenant_id=${var.tenant_id}", - "application_id=${var.application_id}" - ] - inline = [ - "Import-Module BootStrap -Force", - "Start-AzRoninPuppet" - ] - valid_exit_codes = [ - 0, - 2 - ] - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - inline = [ - "Import-Module BootStrap -Force", - "Disable-Services" - ] - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - environment_vars = [ - "worker_pool_id=${var.worker_pool_id}", - "base_image=${var.base_image}", - "src_organisation=${var.source_organization}", - "src_Repository=${var.source_repository}", - "src_Branch=${var.source_branch}", - "deploymentId=${var.deployment_id}", - "config=${var.config}" - ] - inline = [ - "Import-Module BootStrap -Force", - "Set-PesterVersion", - "Set-YAMLModule", - "Invoke-RoninTest -Role $ENV:base_image -Config $ENV:config" - ] - valid_exit_codes = [ - 0 - ] - } - - provisioner "powershell" { - elevated_password = "" - elevated_user = "SYSTEM" - environment_vars = [ - "worker_pool_id=${var.worker_pool_id}", - "base_image=${var.base_image}", - "src_organisation=${var.source_organization}", - "src_Repository=${var.source_repository}", - "src_Branch=${var.source_branch}", - "deploymentId=${var.deployment_id}", - "lastdeployId=${var.lastdeploy_id}", - "config=${var.config}", - "client_id=${var.client_id}", - "tenant_id=${var.tenant_id}", - "application_id=${var.application_id}", - "notes=${var.notes}", - "sharedimage_version=${var.sharedimage_version}" - ] - inline = [ - "Import-Module BootStrap -Force", - "Set-MarkdownPSModule", - "Set-ReleaseNotes2 -Config $ENV:config -Version $ENV:sharedimage_version -Organization $ENV:src_organisation -Branch $ENV:src_Branch -Repository $ENV:src_Repository -DeploymentId $ENV:deploymentId -LastDeployID $ENV:lastdeployId -Notes @($env:notes -split '`n')", - "Write-Host Set-ReleaseNotes2 -Config $ENV:config -Version $ENV:sharedimage_version -Organization $ENV:src_organisation -Branch $ENV:src_Branch -Repository $ENV:src_Repository -DeploymentId $ENV:deploymentId -LastDeployID $ENV:lastdeployId" - ] - } - - provisioner "file" { - only = ["azure-arm.nonsig"] - destination = "${path.root}/${local.sbom_name}.md" - source = "C:/${local.sbom_name}.md" - direction = "download" - } - - provisioner "file" { - only = ["azure-arm.sig"] - destination = "${path.root}/${local.sbom_name}-${var.sharedimage_version}.md" - source = "C:/${local.sbom_name}-${var.sharedimage_version}.md" - direction = "download" - } - - provisioner "windows-restart" { - restart_timeout = "30m" - } - - provisioner "powershell" { - inline = [ - "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Mozilla\\ronin_puppet' -Name hand_off_ready -Type string -Value yes", - "Write-host '=== Azure image build completed successfully ==='", - "Write-host '=== Generalising the image ... ==='", - "& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /generalize /oobe /quit", - "while ($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 15 } else { break } }" - ] - } - -} - diff --git a/bin/WorkerImages/Public/New-AzSharedWorkerImage.ps1 b/bin/WorkerImages/Public/New-AzSharedWorkerImage.ps1 index 9bfd1f84..456add64 100644 --- a/bin/WorkerImages/Public/New-AzSharedWorkerImage.ps1 +++ b/bin/WorkerImages/Public/New-AzSharedWorkerImage.ps1 @@ -43,6 +43,7 @@ function New-AzSharedWorkerImage { $ENV:PKR_VAR_source_organization = $YAML.vm.tags["sourceOrganization"] $ENV:PKR_VAR_deployment_id = $YAML.vm.tags["deploymentId"] $ENV:PKR_VAR_bootstrap_script = $YAML.azure["bootstrapscript"] + $ENV:PKR_VAR_lastdeploy_id = $YAML.vm.tags["lastdeployId"] $ENV:PKR_VAR_gallery_name = $YAML.sharedimage["gallery_name"] $ENV:PKR_VAR_image_name = $YAML.sharedimage["image_name"] $ENV:PKR_VAR_sharedimage_version = $YAML.sharedimage["image_version"] @@ -54,6 +55,7 @@ function New-AzSharedWorkerImage { $ENV:PKR_VAR_oidc_request_url = $oidc_request_url $ENV:PKR_VAR_oidc_request_token = $oidc_request_token $ENV:PKR_VAR_worker_pool_id = $YAML.vm.tags["worker_pool_id"] + $ENV:PKR_VAR_notes = $YAML.notes -join "`n" switch -Wildcard ($key) { "*alpha2*" { $PackerForceBuild = $true @@ -63,6 +65,10 @@ function New-AzSharedWorkerImage { $PackerForceBuild = $true $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-alpha' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) } + "*notes*" { + $PackerForceBuild = $true + $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-alpha' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) + } "*beta*" { $PackerForceBuild = $true $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-beta' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) @@ -82,6 +88,6 @@ function New-AzSharedWorkerImage { packer build --only azure-arm.sig -force azure.pkr.hcl } else { - packer build --only azure-arm.sig azure.pkr.hcl + packer build --only azure-arm.sig azure_temp.pkr.hcl } } diff --git a/bin/WorkerImages/Public/New-AzSharedWorkerImage_temp.ps1 b/bin/WorkerImages/Public/New-AzSharedWorkerImage_temp.ps1 deleted file mode 100644 index 5a076934..00000000 --- a/bin/WorkerImages/Public/New-AzSharedWorkerImage_temp.ps1 +++ /dev/null @@ -1,98 +0,0 @@ -function New-AzSharedWorkerImage_temp { - [CmdletBinding()] - param ( - [String] - $Key, - - [String] - $Client_ID, - - [String] - $Client_Secret, - - [String] - $Application_ID, - - [String] - $oidc_request_url, - - [String] - $oidc_request_token, - - [String] - $Subscription_ID, - - [String] - $Tenant_ID - ) - - Set-PSRepository PSGallery -InstallationPolicy Trusted - Install-Module powershell-yaml -ErrorAction Stop - $YAML = Convertfrom-Yaml (Get-Content "config/$key.yaml" -raw) - $ENV:PKR_VAR_config = $key - $ENV:PKR_VAR_image_key_name = $key - $ENV:PKR_VAR_image_publisher = $YAML.image["publisher"] - $ENV:PKR_VAR_resource_group = $yaml.azure["managed_image_resource_group_name"] - $ENV:PKR_VAR_image_offer = $YAML.image["offer"] - $ENV:PKR_VAR_image_sku = $YAML.image["sku"] - $ENV:PKR_VAR_image_version = $YAML.image["version"] - $ENV:PKR_VAR_vm_size = $YAML.vm["size"] - $ENV:PKR_VAR_base_image = $YAML.vm.tags["base_image"] - $ENV:PKR_VAR_source_branch = $YAML.vm.tags["sourceBranch"] - $ENV:PKR_VAR_source_repository = $YAML.vm.tags["sourceRepository"] - $ENV:PKR_VAR_source_organization = $YAML.vm.tags["sourceOrganization"] - $ENV:PKR_VAR_deployment_id = $YAML.vm.tags["deploymentId"] - $ENV:PKR_VAR_bootstrap_script = $YAML.azure["bootstrapscript"] - $ENV:PKR_VAR_lastdeploy_id = $YAML.vm.tags["lastdeployId"] - $ENV:PKR_VAR_gallery_name = $YAML.sharedimage["gallery_name"] - $ENV:PKR_VAR_image_name = $YAML.sharedimage["image_name"] - $ENV:PKR_VAR_sharedimage_version = $YAML.sharedimage["image_version"] - $ENV:PKR_VAR_client_id = $Client_ID - $ENV:PKR_VAR_temp_resource_group_name = ('{0}-{1}-{2}-pkrtmp' -f $YAML.vm.tags["worker_pool_id"], $YAML.vm.tags["deploymentId"], (Get-Random -Maximum 999)) - $ENV:PKR_VAR_tenant_id = $Tenant_ID - $ENV:PKR_VAR_subscription_id = $Subscription_ID - $ENV:PKR_VAR_application_id = $Application_ID - $ENV:PKR_VAR_oidc_request_url = $oidc_request_url - $ENV:PKR_VAR_oidc_request_token = $oidc_request_token - $ENV:PKR_VAR_worker_pool_id = $YAML.vm.tags["worker_pool_id"] - #$ENV:PKR_VAR_notes = $YAML.notes - $ENV:PKR_VAR_notes = $YAML.notes -join "`n" - switch -Wildcard ($key) { - "*alpha2*" { - $PackerForceBuild = $true - $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-alpha2' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) - } - "*alpha*" { - $PackerForceBuild = $true - $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-alpha' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) - } - "*notes*" { - $PackerForceBuild = $true - $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-alpha' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) - } - "*beta*" { - $PackerForceBuild = $true - $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-beta' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) - } - "*next*" { - $PackerForceBuild = $true - $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-next' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku) - } - Default { - $PackerForceBuild = $false - $ENV:PKR_VAR_managed_image_name = ('{0}-{1}-{2}' -f $YAML.vm.tags["worker_pool_id"], $ENV:PKR_VAR_image_sku, $YAML.vm.tags["deploymentId"]) - } - } - Write-Host "Building $($ENV:PKR_VAR_managed_image_name) in $($ENV:PKR_VAR_temp_resource_group_name)" - packer init azure.pkr.hcl - Write-Host CHECK - Write-Host $ENV:PKR_VAR_lastdeploy_id - Write-Host Are there notes - Write-Host $ENV:PKR_VAR_notes - if ($PackerForceBuild) { - packer build --only azure-arm.sig -force azure_temp.pkr.hcl - } - else { - packer build --only azure-arm.sig azure_temp.pkr.hcl - } -} diff --git a/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes.ps1 b/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes.ps1 index fc29fbb7..27335d9b 100644 --- a/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes.ps1 +++ b/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes.ps1 @@ -1,191 +1,244 @@ function Set-ReleaseNotes { [CmdletBinding()] param ( - [String] - $Config, + [String] $Config, + [String] $Version, + [String] $Branch, + [String] $Organization, + [String] $Repository, + [String] $LastDeployID, + [String] $DeploymentId, + [String[]] $Notes + ) - [String] - $Version, + function Convert-NoteReferencesToLinks { + param ( + [string] $Note, + [string] $JiraUrlBase, + [string] $BugUrlBase + ) - [String] - $Branch, + $noteProcessed = $Note - [String] - $Organization, + # Replace Jira:RELOPS-1234 + $noteProcessed = [regex]::Replace($noteProcessed, "(?i)Jira:([A-Za-z0-9-]+)", { + "Jira: [$($args[0].Groups[1].Value)]($JiraUrlBase$($args[0].Groups[1].Value))" + }) - [String] - $Repository, + # Replace Bug:123456 or Bug123456 + $noteProcessed = [regex]::Replace($noteProcessed, "(?i)Bug:?\s?(\d+)", { + "Bug: [$($args[0].Groups[1].Value)]($BugUrlBase$($args[0].Groups[1].Value))" + }) - [String] - $DeploymentId - ) + return $noteProcessed + } - ## The config will be the name of the configuration file (win11-64-2009) without the extension - ## We'll use this to generate release notes for each OS + $repoUrl = "https://github.com/$Organization/$Repository" + $repoPath = "C:\Ronin" - Write-Log -message ('{0} :: Processing {1} {2} - {3:o}' -f $($MyInvocation.MyCommand.Name), $Config, $Version, (Get-Date).ToUniversalTime()) -severity 'DEBUG' + if (!(Test-Path $repoPath)) { + git clone -q --single-branch --branch $Branch $repoUrl $repoPath + } else { + git config --global --add safe.directory C:/ronin + } - ## Let's install markdownPS just in case it isn't installed - Set-MarkdownPSModule + Set-Location -Path $repoPath + git checkout $DeploymentId + + $commitUrlBase = "https://github.com/$Organization/$Repository/commit/" + $jiraUrlBase = "https://mozilla-hub.atlassian.net/browse/" + $bugUrlBase = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + + $commitLog = git log "$LastDeployID..$DeploymentId" --pretty=format:"Commit: %H`nAuthor: %an`nDate: %ad`n`n%s`n%b`n---" + $commitEntries = $commitLog -split "(?=Commit: )" + $commitObjects = @() + $currentCommit = $null + + foreach ($entry in $commitEntries) { + $entry = $entry.Trim() + if ($entry -eq "") { continue } + + if ($entry -match "(?i)^Commit: (?\w{40})") { + if ($null -ne $currentCommit -and ( + $Config -eq "" -or + $currentCommit.Details.Roles -icontains $Config -or + ($Config -match "win" -and $currentCommit.Details.Roles -icontains "all-win") + )) { + $commitObjects += $currentCommit + } + + $commitHash = $matches["Hash"] + $commitUrl = "$commitUrlBase$commitHash" + + $currentCommit = [PSCustomObject]@{ + URL = $commitUrl + Details = @{ + Jira = "No Ticket" + JiraURL = "" + Bug = "" + BugURL = "" + Date = "" + Message = "" + Roles = @() + Type = "Uncategorized" + } + } + continue + } - ## Let's get specific information about the OS - $OSBuild = Get-OSVersionMarkDown - if ($null -eq $OSBuild) { - $reason = "Unable to find OSBuild" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' + if ($null -ne $currentCommit) { + if ($entry -match "(?i)^Author: (?.+)") { + $author = $matches["Author"] + } elseif ($entry -match "(?i)^Date: (?.+)") { + $dateParts = $matches["Date"] -split "\s+" + $formattedDate = "$($dateParts[0]) $($dateParts[1]) $($dateParts[2]) $($dateParts[4])" + if ($author) { + $formattedDate += " by $author" + } + $currentCommit.Details.Date = $formattedDate + } + + if ($entry -match "(?im)^(?[A-Z]+:\s*Jira:[A-Za-z0-9-]+.*?MSG[:\s]+.+)$") { + $line = $matches["Line"] + if ($line -match "^(?i)(?[A-Z]+):\s*Jira:(?[A-Za-z0-9-]+).*?MSG[:\s]+(?.+)$") { + $currentCommit.Details.Type = $matches["Type"] + $currentCommit.Details.Jira = $matches["Jira"] + $currentCommit.Details.JiraURL = "$jiraUrlBase$($matches["Jira"])" + $currentCommit.Details.Message = "$($currentCommit.Details.Type) - $($matches["Message"])" + + if ($line -match "(?i)Bug(?\d{4,})") { + $bugNumber = $matches["Bug"] + $currentCommit.Details.Bug = $bugNumber + $currentCommit.Details.BugURL = "$bugUrlBase$bugNumber" + } + } + } + + if ($currentCommit.Details.Message -match "(?i)\(Bug(?\d+)\)") { + $bugNumber = $matches["Bug"] + $currentCommit.Details.Bug = $bugNumber + $currentCommit.Details.BugURL = "$bugUrlBase$bugNumber" + $currentCommit.Details.Message = $currentCommit.Details.Message -replace "(?i)\(Bug\d+\)", "" + } + + elseif ($entry -match "(?im)\broles?\s*:\s*(?[^\n\r]+)") { + $currentCommit.Details.Roles = ($matches["Roles"] -split "[,\s]+" | Where-Object { $_ -ne "" }) | ForEach-Object { $_.Trim() } + } + } } - ## Let's get all of the information about the OS - $OSVersionExtended = Get-OSVersionExtended - if ($null -eq $OSVersionExtended) { - $reason = "Unable to find OSVersionExtended" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' + if ($null -ne $currentCommit -and ( + $Config -eq "" -or + $currentCommit.Details.Roles -icontains $Config -or + ($Config -match "win" -and $currentCommit.Details.Roles -icontains "all-win") + )) { + $commitObjects += $currentCommit } - ## Just return the OS version for manipulating the markdown header - $OSVersion = Get-OSVersion - if ($null -eq $OSVersion) { - $reason = "Unable to find OSVersion" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - } + Write-Log -message ('{0} :: Processing {1} {2} - {3:o}' -f $($MyInvocation.MyCommand.Name), $Config, $Version, (Get-Date).ToUniversalTime()) -severity 'DEBUG' + Set-MarkdownPSModule - ## Let's get the installed software installed on the OS + $OSBuild = Get-OSVersionMarkDown + $OSVersionExtended = Get-OSVersionExtended + $OSVersion = Get-OSVersion $InstalledSoftware = Get-InstalledSoftware | Where-Object { ($psitem.DisplayName -match "\D") -and ($null -ne $psitem.DisplayVersion) } - if ($null -eq $InstalledSoftware) { - $reason = "Unable to find Installed Software" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - } - ## Let's get speciifc information about the Mozilla Build environment $mozillabuild = Get-WinFactsMozillaBuild - if ($null -eq $mozillabuild) { - $reason = "Unable to find facts for win mozilla build" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - } - - ## Let's also get the python packages inside the Mozilla Build environment $pythonPackages = Get-MozillaBuildPythonPackages -RequirementsFile "C:\requirements.txt" - if ($null -eq $pythonPackages) { - $reason = "Unable to find python packges in c:\requirements.txt" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - } - ## Now let's list out all software that isn't published by Microsoft $InstalledSoftware_NotMicrosoft = $InstalledSoftware | Where-Object { $PSItem.Publisher -notmatch "Microsoft" } | ForEach-Object { - [PSCustomObject]@{ - Name = $PSItem.DisplayName - Version = $PSItem.DisplayVersion - } - } | Sort-Object -Property Name | Sort-Object Name, Version | Group-Object Name, Version | ForEach-Object { $_.Group[0] } + [PSCustomObject]@{ Name = $PSItem.DisplayName; Version = $PSItem.DisplayVersion } + } | Sort-Object Name, Version | Group-Object Name, Version | ForEach-Object { $_.Group[0] } - ## And now all software that is published by Microsoft $InstalledSoftware_Microsoft = $InstalledSoftware | Where-Object { $PSItem.Publisher -match "Microsoft" } | ForEach-Object { - [PSCustomObject]@{ - Name = $PSItem.DisplayName - Version = $PSItem.DisplayVersion - } - } | Sort-Object -Property Name | Sort-Object Name, Version | Group-Object Name, Version | ForEach-Object { $_.Group[0] } + [PSCustomObject]@{ Name = $PSItem.DisplayName; Version = $PSItem.DisplayVersion } + } | Sort-Object Name, Version | Group-Object Name, Version | ForEach-Object { $_.Group[0] } - ## Let's create the markdown file $markdown = "" - - ## Start with the OS Information switch -Wildcard ($OSVersion) { - "*win_10_*" { - $Header = "Windows 10" - } - "*win_11_*" { - $Header = "Windows 11" - } - "*win_2022_*" { - $Header = "Windows 2022" - } - default { - $null - } - } - - if ($null -eq $OSVersion) { - $reason = "Unable to determine OSVersion" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' + "*win_10_*" { $OSHeader = "Windows 10" } + "*win_11_*" { $OSHeader = "Windows 11" } + "*win_2022_*"{ $OSHeader = "Windows 2022" } + default { $null } } + $Header = "$OSHeader Image Build $Version" $markdown += New-MDHeader -Text $Header -Level 1 $markdown += "`n" + $lines = @( "Config: $($Config)", "OS Name: $($Header) $($OSVersionExtended.DisplayVersion)", "OS Version: $($OSBuild)", "Organization: $($Organization)", - "Repository: $($Repository)" + "Repository: $($Repository)", "Branch: $($Branch)", "DeploymentId: $($DeploymentId)" ) - + $markdown += New-MDList -Lines $lines -Style Unordered - + + # NOTES + if ($Notes -and $Notes.Count -gt 0) { + $markdown += New-MDHeader "Notes" -Level 2 + $markdown += "`n" + + $cleanNotes = $Notes -join "`n" -split "`r?\n" | + ForEach-Object { $_.Trim() } | + Where-Object { $_ -ne "" } | + ForEach-Object { Convert-NoteReferencesToLinks -Note $_ -JiraUrlBase $jiraUrlBase -BugUrlBase $bugUrlBase } + + $markdown += New-MDList -Lines $cleanNotes -Style Unordered + $markdown += "`n" + } + + $markdown += New-MDHeader "Change Log" -Level 2 + + foreach ($commit in $commitObjects) { + $markdown += "[$($commit.Details.Message)]($($commit.URL))`n" + if ($commit.Details.Jira -ne "No Ticket") { + $markdown += " **Jira:** [$($commit.Details.Jira)]($($commit.Details.JiraURL))`n" + } + if ($commit.Details.Bug -ne "") { + $markdown += " **Bug:** [$($commit.Details.Bug)]($($commit.Details.BugURL))`n" + } + $markdown += " **Date:** $($commit.Details.Date)`n`n" + } + + $markdown += New-MDHeader "Software Bill of Materials" -Level 2 $markdown += New-MDHeader "Mozilla Build" -Level 2 $markdown += "`n" - $lines2 = @( - "Find more information about Mozilla Build on [Wiki](https://wiki.mozilla.org/MozillaBuild#Technical_Details)" - ) - $markdown += New-MDAlert -Lines $lines2 -Style Important - - $lines3 = @( - "Mozilla Build: $($mozillabuild.custom_win_mozbld_version)" - ) - - $markdown += New-MDList -Lines $lines3 -Style Unordered - + $markdown += New-MDAlert -Lines @("Find more information about Mozilla Build on [Wiki](https://wiki.mozilla.org/MozillaBuild#Technical_Details)") -Style Important + $markdown += New-MDList -Lines @("Mozilla Build: $($mozillabuild.custom_win_mozbld_version)") -Style Unordered $markdown += New-MDHeader "Taskcluster Packages Installed" -Level 3 $markdown += "`n" $markdown += Show-TaskclusterBinaries | New-MDTable $markdown += "`n" - $markdown += New-MDHeader "Python Packages" -Level 3 $markdown += "`n" $markdown += $pythonPackages | New-MDTable $markdown += "`n" - $markdown += New-MDHeader "Installed Software (Not Microsoft)" -Level 2 $markdown += "`n" $markdown += $InstalledSoftware_NotMicrosoft | New-MDTable $markdown += "`n" - $markdown += New-MDHeader "Installed Software (Microsoft)" -Level 2 $markdown += "`n" $markdown += $InstalledSoftware_Microsoft | New-MDTable - - $markdown | Out-File "C:\software_report.md" - $markdown_content = Get-Content -Path "C:\software_report.md" - if ($null -eq $markdown_content) { - $reason = "Unable to find software_report.md" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - } + $markdown | Out-File "C:\software_report.md" - ## output the contents of the markdown file Get-Content -Path "C:\software_report.md" - if (-Not (Test-Path "C:\software_report.md")) { - $reason = "Unable to find software_report.md after copy-item" - Write-Log -message ('{0} :: {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), $reason, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - } - if ($Version) { - Write-Log -message ('{0} :: Copying software_report.md to {1} - {2:o}' -f $($MyInvocation.MyCommand.Name), "(C:\$($Config)-$($Version).md)", (Get-Date).ToUniversalTime()) -severity 'DEBUG' - ## Now copy the software markdown file elsewhere to prep for uploading to azure Copy-Item -Path "C:\software_report.md" -Destination "C:\$($Config)-$($Version).md" - } - else { - ## Now copy the software markdown file elsewhere to prep for uploading to azure + } else { Copy-Item -Path "C:\software_report.md" -Destination "C:\$($Config).md" } - -} \ No newline at end of file +} diff --git a/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes2.ps1 b/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes2.ps1 deleted file mode 100644 index 73890e40..00000000 --- a/scripts/windows/CustomFunctions/Bootstrap/Public/Set-ReleaseNotes2.ps1 +++ /dev/null @@ -1,244 +0,0 @@ -function Set-ReleaseNotes2 { - [CmdletBinding()] - param ( - [String] $Config, - [String] $Version, - [String] $Branch, - [String] $Organization, - [String] $Repository, - [String] $LastDeployID, - [String] $DeploymentId, - [String[]] $Notes - ) - - function Convert-NoteReferencesToLinks { - param ( - [string] $Note, - [string] $JiraUrlBase, - [string] $BugUrlBase - ) - - $noteProcessed = $Note - - # Replace Jira:RELOPS-1234 - $noteProcessed = [regex]::Replace($noteProcessed, "(?i)Jira:([A-Za-z0-9-]+)", { - "Jira: [$($args[0].Groups[1].Value)]($JiraUrlBase$($args[0].Groups[1].Value))" - }) - - # Replace Bug:123456 or Bug123456 - $noteProcessed = [regex]::Replace($noteProcessed, "(?i)Bug:?\s?(\d+)", { - "Bug: [$($args[0].Groups[1].Value)]($BugUrlBase$($args[0].Groups[1].Value))" - }) - - return $noteProcessed - } - - $repoUrl = "https://github.com/$Organization/$Repository" - $repoPath = "C:\Ronin" - - if (!(Test-Path $repoPath)) { - git clone -q --single-branch --branch $Branch $repoUrl $repoPath - } else { - git config --global --add safe.directory C:/ronin - } - - Set-Location -Path $repoPath - git checkout $DeploymentId - - $commitUrlBase = "https://github.com/$Organization/$Repository/commit/" - $jiraUrlBase = "https://mozilla-hub.atlassian.net/browse/" - $bugUrlBase = "https://bugzilla.mozilla.org/show_bug.cgi?id=" - - $commitLog = git log "$LastDeployID..$DeploymentId" --pretty=format:"Commit: %H`nAuthor: %an`nDate: %ad`n`n%s`n%b`n---" - $commitEntries = $commitLog -split "(?=Commit: )" - $commitObjects = @() - $currentCommit = $null - - foreach ($entry in $commitEntries) { - $entry = $entry.Trim() - if ($entry -eq "") { continue } - - if ($entry -match "(?i)^Commit: (?\w{40})") { - if ($null -ne $currentCommit -and ( - $Config -eq "" -or - $currentCommit.Details.Roles -icontains $Config -or - ($Config -match "win" -and $currentCommit.Details.Roles -icontains "all-win") - )) { - $commitObjects += $currentCommit - } - - $commitHash = $matches["Hash"] - $commitUrl = "$commitUrlBase$commitHash" - - $currentCommit = [PSCustomObject]@{ - URL = $commitUrl - Details = @{ - Jira = "No Ticket" - JiraURL = "" - Bug = "" - BugURL = "" - Date = "" - Message = "" - Roles = @() - Type = "Uncategorized" - } - } - continue - } - - if ($null -ne $currentCommit) { - if ($entry -match "(?i)^Author: (?.+)") { - $author = $matches["Author"] - } elseif ($entry -match "(?i)^Date: (?.+)") { - $dateParts = $matches["Date"] -split "\s+" - $formattedDate = "$($dateParts[0]) $($dateParts[1]) $($dateParts[2]) $($dateParts[4])" - if ($author) { - $formattedDate += " by $author" - } - $currentCommit.Details.Date = $formattedDate - } - - if ($entry -match "(?im)^(?[A-Z]+:\s*Jira:[A-Za-z0-9-]+.*?MSG[:\s]+.+)$") { - $line = $matches["Line"] - if ($line -match "^(?i)(?[A-Z]+):\s*Jira:(?[A-Za-z0-9-]+).*?MSG[:\s]+(?.+)$") { - $currentCommit.Details.Type = $matches["Type"] - $currentCommit.Details.Jira = $matches["Jira"] - $currentCommit.Details.JiraURL = "$jiraUrlBase$($matches["Jira"])" - $currentCommit.Details.Message = "$($currentCommit.Details.Type) - $($matches["Message"])" - - if ($line -match "(?i)Bug(?\d{4,})") { - $bugNumber = $matches["Bug"] - $currentCommit.Details.Bug = $bugNumber - $currentCommit.Details.BugURL = "$bugUrlBase$bugNumber" - } - } - } - - if ($currentCommit.Details.Message -match "(?i)\(Bug(?\d+)\)") { - $bugNumber = $matches["Bug"] - $currentCommit.Details.Bug = $bugNumber - $currentCommit.Details.BugURL = "$bugUrlBase$bugNumber" - $currentCommit.Details.Message = $currentCommit.Details.Message -replace "(?i)\(Bug\d+\)", "" - } - - elseif ($entry -match "(?im)\broles?\s*:\s*(?[^\n\r]+)") { - $currentCommit.Details.Roles = ($matches["Roles"] -split "[,\s]+" | Where-Object { $_ -ne "" }) | ForEach-Object { $_.Trim() } - } - } - } - - if ($null -ne $currentCommit -and ( - $Config -eq "" -or - $currentCommit.Details.Roles -icontains $Config -or - ($Config -match "win" -and $currentCommit.Details.Roles -icontains "all-win") - )) { - $commitObjects += $currentCommit - } - - Write-Log -message ('{0} :: Processing {1} {2} - {3:o}' -f $($MyInvocation.MyCommand.Name), $Config, $Version, (Get-Date).ToUniversalTime()) -severity 'DEBUG' - Set-MarkdownPSModule - - $OSBuild = Get-OSVersionMarkDown - $OSVersionExtended = Get-OSVersionExtended - $OSVersion = Get-OSVersion - $InstalledSoftware = Get-InstalledSoftware | Where-Object { - ($psitem.DisplayName -match "\D") -and ($null -ne $psitem.DisplayVersion) - } - - $mozillabuild = Get-WinFactsMozillaBuild - $pythonPackages = Get-MozillaBuildPythonPackages -RequirementsFile "C:\requirements.txt" - - $InstalledSoftware_NotMicrosoft = $InstalledSoftware | Where-Object { - $PSItem.Publisher -notmatch "Microsoft" - } | ForEach-Object { - [PSCustomObject]@{ Name = $PSItem.DisplayName; Version = $PSItem.DisplayVersion } - } | Sort-Object Name, Version | Group-Object Name, Version | ForEach-Object { $_.Group[0] } - - $InstalledSoftware_Microsoft = $InstalledSoftware | Where-Object { - $PSItem.Publisher -match "Microsoft" - } | ForEach-Object { - [PSCustomObject]@{ Name = $PSItem.DisplayName; Version = $PSItem.DisplayVersion } - } | Sort-Object Name, Version | Group-Object Name, Version | ForEach-Object { $_.Group[0] } - - $markdown = "" - switch -Wildcard ($OSVersion) { - "*win_10_*" { $OSHeader = "Windows 10" } - "*win_11_*" { $OSHeader = "Windows 11" } - "*win_2022_*"{ $OSHeader = "Windows 2022" } - default { $null } - } - - $Header = "$OSHeader Image Build $Version" - $markdown += New-MDHeader -Text $Header -Level 1 - $markdown += "`n" - - $lines = @( - "Config: $($Config)", - "OS Name: $($Header) $($OSVersionExtended.DisplayVersion)", - "OS Version: $($OSBuild)", - "Organization: $($Organization)", - "Repository: $($Repository)", - "Branch: $($Branch)", - "DeploymentId: $($DeploymentId)" - ) - - $markdown += New-MDList -Lines $lines -Style Unordered - - # NOTES - if ($Notes -and $Notes.Count -gt 0) { - $markdown += New-MDHeader "Notes" -Level 2 - $markdown += "`n" - - $cleanNotes = $Notes -join "`n" -split "`r?\n" | - ForEach-Object { $_.Trim() } | - Where-Object { $_ -ne "" } | - ForEach-Object { Convert-NoteReferencesToLinks -Note $_ -JiraUrlBase $jiraUrlBase -BugUrlBase $bugUrlBase } - - $markdown += New-MDList -Lines $cleanNotes -Style Unordered - $markdown += "`n" - } - - $markdown += New-MDHeader "Change Log" -Level 2 - - foreach ($commit in $commitObjects) { - $markdown += "[$($commit.Details.Message)]($($commit.URL))`n" - if ($commit.Details.Jira -ne "No Ticket") { - $markdown += " **Jira:** [$($commit.Details.Jira)]($($commit.Details.JiraURL))`n" - } - if ($commit.Details.Bug -ne "") { - $markdown += " **Bug:** [$($commit.Details.Bug)]($($commit.Details.BugURL))`n" - } - $markdown += " **Date:** $($commit.Details.Date)`n`n" - } - - $markdown += New-MDHeader "Software Bill of Materials" -Level 2 - $markdown += New-MDHeader "Mozilla Build" -Level 2 - $markdown += "`n" - $markdown += New-MDAlert -Lines @("Find more information about Mozilla Build on [Wiki](https://wiki.mozilla.org/MozillaBuild#Technical_Details)") -Style Important - $markdown += New-MDList -Lines @("Mozilla Build: $($mozillabuild.custom_win_mozbld_version)") -Style Unordered - $markdown += New-MDHeader "Taskcluster Packages Installed" -Level 3 - $markdown += "`n" - $markdown += Show-TaskclusterBinaries | New-MDTable - $markdown += "`n" - $markdown += New-MDHeader "Python Packages" -Level 3 - $markdown += "`n" - $markdown += $pythonPackages | New-MDTable - $markdown += "`n" - $markdown += New-MDHeader "Installed Software (Not Microsoft)" -Level 2 - $markdown += "`n" - $markdown += $InstalledSoftware_NotMicrosoft | New-MDTable - $markdown += "`n" - $markdown += New-MDHeader "Installed Software (Microsoft)" -Level 2 - $markdown += "`n" - $markdown += $InstalledSoftware_Microsoft | New-MDTable - - $markdown | Out-File "C:\software_report.md" - - Get-Content -Path "C:\software_report.md" - - if ($Version) { - Copy-Item -Path "C:\software_report.md" -Destination "C:\$($Config)-$($Version).md" - } else { - Copy-Item -Path "C:\software_report.md" -Destination "C:\$($Config).md" - } -} diff --git a/scripts/windows/CustomFunctions/Bootstrap/Public/Set-RoninRegOptions.ps1 b/scripts/windows/CustomFunctions/Bootstrap/Public/Set-RoninRegOptions.ps1 deleted file mode 100644 index a168de80..00000000 --- a/scripts/windows/CustomFunctions/Bootstrap/Public/Set-RoninRegOptions.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -function Set-RoninRegOptions { - param ( - [string] $mozilla_key = "HKLM:\SOFTWARE\Mozilla\", - [string] $ronin_key = "$mozilla_key\ronin_puppet", - [string] $source_key = "$ronin_key\source", - [string] $Image_Provisioner = "azure", - [string] $Worker_Pool_Id = $ENV:worker_pool_id, - [string] $base_image = $ENV:base_image, - [string] $src_Organisation = $ENV:src_organisation, - [string] $src_Repository = $ENV:src_Repository, - [string] $src_Branch = $ENV:src_Branch - ) - begin { - Write-Log -message ('{0} :: begin - {1:o}' -f $($MyInvocation.MyCommand.Name), (Get-Date).ToUniversalTime()) -severity 'DEBUG' - Write-Host ('{0} :: begin - {1:o}' -f $($MyInvocation.MyCommand.Name), (Get-Date).ToUniversalTime()) - } - process { - If (-Not ( Test-path $ronin_key)) { - New-Item -Path "HKLM:\SOFTWARE" -Name "Mozilla" -force | Out-Null - New-Item -Path $mozilla_key -name "ronin_puppet" -force | Out-Null - } - - New-Item -Path $ronin_key -Name source -force | Out-Null - New-ItemProperty -Path $ronin_key -Name 'image_provisioner' -Value $image_provisioner -PropertyType String -force | Out-Null - New-ItemProperty -Path $ronin_key -Name 'worker_pool_id' -Value $worker_pool_id -PropertyType String -force | Out-Null - New-ItemProperty -Path $ronin_key -Name 'role' -Value $base_image -PropertyType String -force | Out-Null - New-ItemProperty -Path $ronin_key -Name 'inmutable' -Value 'false' -PropertyType String -force | Out-Null - New-ItemProperty -Path $ronin_key -Name 'last_run_exit' -Value '0' -PropertyType Dword -force | Out-Null - New-ItemProperty -Path $ronin_key -Name 'bootstrap_stage' -Value 'setup' -PropertyType String -force | Out-Null - New-ItemProperty -Path $source_key -Name 'Organisation' -Value $src_Organisation -PropertyType String -force | Out-Null - New-ItemProperty -Path $source_key -Name 'Repository' -Value $src_Repository -PropertyType String -force | Out-Null - New-ItemProperty -Path $source_key -Name 'Branch' -Value $src_Branch -PropertyType String -force | Out-Null - } - end { - Write-Log -message ('{0} :: end - {1:o}' -f $($MyInvocation.MyCommand.Name), (Get-Date).ToUniversalTime()) -severity 'DEBUG' - Write-Host ('{0} :: end - {1:o}' -f $($MyInvocation.MyCommand.Name), (Get-Date).ToUniversalTime()) - } -}