-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
258 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PowerShell ^ | ||
-NoLogo ^ | ||
-NoProfile ^ | ||
-ExecutionPolicy Bypass ^ | ||
-File provision-local-hyperv.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# this has access to the following environment variables (this | ||
# also shows example values): | ||
# | ||
# PACKER_VERSION 1.6.0 | ||
# PACKER_VM_NAME packer-ubuntu-20.04-amd64-hyperv | ||
# PACKER_BUILD_NAME ubuntu-20.04-amd64-hyperv | ||
# PACKER_BUILDER_TYPE hyperv-iso | ||
# PACKER_HTTP_ADDR 10.0.0.123:1 | ||
# PACKER_HTTP_IP 10.0.0.123 | ||
# PACKER_HTTP_PORT 1 | ||
|
||
Set-StrictMode -Version Latest | ||
$ProgressPreference = 'SilentlyContinue' | ||
$ErrorActionPreference = 'Stop' | ||
trap { | ||
Write-Output "ERROR: $_" | ||
Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1') | ||
Write-Output (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1') | ||
Exit 1 | ||
} | ||
|
||
Import-Module Hyper-V | ||
|
||
# NB Trim is needed because something is adding a | ||
# trailing space to the value. | ||
$vmName = $env:PACKER_VM_NAME.Trim() | ||
|
||
# update the vm notes. | ||
$notes = (Get-VM $vmName).Notes | ||
$notes += "---`n" | ||
$notes += "packer_version: $env:PACKER_VERSION`n" | ||
$notes += "git_url: $(git config --get remote.origin.url)`n" | ||
$notes += "git_branch: $(git rev-parse --abbrev-ref HEAD)`n" | ||
$notes += "git_revision: $(git rev-parse HEAD)`n" | ||
Set-VM $vmName -Notes $notes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.