Add current commit into logs for custom builds (#1419)

* Show latest commit for custom repos

* Remove unused variables from templates

* Add Get-LatestCommit function

* Fix in synopsis

* Remove SSH_Password variables from Windows Images

* Rename download-customrepo

* Fix in synopsis
This commit is contained in:
Maksim Petrov
2020-08-24 12:31:51 +03:00
committed by GitHub
parent ba17c75613
commit f97706e248
9 changed files with 39 additions and 40 deletions

View File

@@ -39,6 +39,16 @@ Function Get-PackerTemplatePath {
return $RepositoryRoot + $relativePath;
}
Function Get-LatestCommit {
[CmdletBinding()]
param()
process {
Write-Host "Latest commit:"
git log --pretty=format:"Date: %cd; Commit: %H - %s; Author: %an <%ae>" -1
}
}
Function GenerateResourcesAndImage {
<#
.SYNOPSIS
@@ -170,6 +180,8 @@ Function GenerateResourcesAndImage {
$tenantId = $sub.TenantId
# "", "Note this variable-setting script for running Packer with these Azure resources in the future:", "==============================================================================================", "`$spClientId = `"$spClientId`"", "`$ServicePrincipalClientSecret = `"$ServicePrincipalClientSecret`"", "`$SubscriptionId = `"$SubscriptionId`"", "`$tenantId = `"$tenantId`"", "`$spObjectId = `"$spObjectId`"", "`$AzureLocation = `"$AzureLocation`"", "`$ResourceGroupName = `"$ResourceGroupName`"", "`$storageAccountName = `"$storageAccountName`"", "`$install_password = `"$install_password`"", ""
Get-LatestCommit -ErrorAction SilentlyContinue
packer.exe build -on-error=ask `
-var "client_id=$($spClientId)" `
-var "client_secret=$($ServicePrincipalClientSecret)" `