Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/packer-plugin-azure
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: hashicorp/packer-plugin-azure
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.4.0
Choose a head ref
Loading
Showing with 3,596 additions and 746 deletions.
  1. +5 −106 .circleci/config.yml
  2. +1 −1 .github/CONTRIBUTING.md
  3. +43 −0 .github/workflows/go-test-darwin.yml
  4. +41 −0 .github/workflows/go-test-linux.yml
  5. +42 −0 .github/workflows/go-test-windows.yml
  6. +83 −0 .github/workflows/go-validate.yml
  7. +0 −16 .github/workflows/issues-opened.yml
  8. +86 −0 .github/workflows/jira.yml
  9. +1 −0 .gitignore
  10. +2 −0 .go-version
  11. +0 −2 .golangci.yml
  12. +38 −9 .goreleaser.yml
  13. +4 −1 CHANGELOG.md
  14. +2 −0 LICENSE
  15. +1 −1 README.md
  16. +68 −17 builder/azure/arm/artifact.go
  17. +83 −0 builder/azure/arm/artifact_test.go
  18. +88 −20 builder/azure/arm/builder.go
  19. +2 −6 builder/azure/arm/builder_acc_test.go
  20. +6 −1 builder/azure/arm/builder_test.go
  21. +105 −14 builder/azure/arm/config.go
  22. +34 −0 builder/azure/arm/config.hcl2spec.go
  23. +226 −0 builder/azure/arm/config_test.go
  24. +10 −4 builder/azure/arm/step_capture_image.go
  25. +1 −0 builder/azure/arm/step_capture_image_test.go
  26. +12 −10 builder/azure/arm/step_certificate_in_keyvault.go
  27. +2 −2 builder/azure/arm/step_certificate_in_keyvault_test.go
  28. +0 −118 builder/azure/arm/step_delete_additional_disks.go
  29. +0 −227 builder/azure/arm/step_delete_additional_disks_test.go
  30. +18 −5 builder/azure/arm/step_deploy_template.go
  31. +7 −3 builder/azure/arm/step_deploy_template_test.go
  32. +36 −11 builder/azure/arm/step_publish_to_shared_image_gallery.go
  33. +38 −6 builder/azure/arm/step_publish_to_shared_image_gallery_test.go
  34. +57 −17 builder/azure/arm/template_factory.go
  35. +29 −1 builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json
  36. +30 −1 builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json
  37. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json
  38. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json
  39. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json
  40. +28 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json
  41. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json
  42. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json
  43. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json
  44. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json
  45. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json
  46. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json
  47. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment13.approved.json
  48. +23 −1 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment14.approved.json
  49. +209 −0 builder/azure/arm/template_factory_test.TestVirtualMachineDeployment15.approved.json
  50. +204 −0 builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType01.approved.json
  51. +205 −0 builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType02.approved.json
  52. +56 −4 builder/azure/arm/template_factory_test.go
  53. +1 −1 builder/azure/common/client/metadata.go
  54. +9 −0 builder/azure/common/constants/licenseTypes.go
  55. +2 −0 builder/azure/common/constants/stateBag.go
  56. +56 −34 builder/azure/common/template/template.go
  57. +92 −23 builder/azure/common/template/template_builder.go
  58. +250 −0 builder/azure/common/template/template_builder_test.TestBuildEncryptedWindows.approved.json
  59. +23 −1 builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json
  60. +23 −1 builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json
  61. +23 −1 builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json
  62. +23 −1 builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json
  63. +23 −1 builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json
  64. +23 −1 builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json
  65. +210 −0 builder/azure/common/template/template_builder_test.TestBuildWindows03.approved.json
  66. +22 −0 builder/azure/common/template/template_builder_test.TestCommunitySharedImageGallery00.approved.json
  67. +22 −0 builder/azure/common/template/template_builder_test.TestDirectSharedImageGallery00.approved.json
  68. +198 −0 builder/azure/common/template/template_builder_test.TestLicenseType00.approved.json
  69. +199 −0 builder/azure/common/template/template_builder_test.TestLicenseType01.approved.json
  70. +23 −1 builder/azure/common/template/template_builder_test.TestNetworkSecurityGroup00.approved.json
  71. +22 −0 builder/azure/common/template/template_builder_test.TestSetIdentity00.approved.json
  72. +22 −0 builder/azure/common/template/template_builder_test.TestSharedImageGallery00.approved.json
  73. +111 −8 builder/azure/common/template/template_builder_test.go
  74. +1 −0 builder/azure/common/template/template_parameters.go
  75. +2 −1 builder/azure/dtl/builder_acc_test.go
  76. +0 −1 builder/azure/dtl/step_deploy_template.go
  77. +35 −1 docs-partials/builder/azure/arm/Config-not-required.mdx
  78. +7 −0 docs-partials/builder/azure/arm/Spot-not-required.mdx
  79. +4 −2 docs/builders/arm.mdx
  80. +3 −3 docs/builders/dtl.mdx
  81. +3 −3 docs/builders/index.mdx
  82. +3 −3 docs/provisioners/dtlartifact.mdx
  83. +2 −2 go.mod
  84. +2 −41 go.sum
  85. +1 −1 version/version.go
111 changes: 5 additions & 106 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
orbs:
win: circleci/windows@1.0.0

version: 2.1

executors:
golang:
docker:
- image: docker.mirror.hashicorp.services/cimg/go:1.17.13
- image: docker.mirror.hashicorp.services/cimg/go:1.18
resource_class: medium+
darwin:
macos:
xcode: "13.4.1"

commands:
install-go-run-tests-unix:
parameters:
GOOS:
type: string
GOVERSION:
type: string
HOME:
type: string
default: "~"
steps:
- checkout
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.<< parameters.GOOS >>-amd64.tar.gz | tar -C << parameters.HOME >>/ -xz
- run: << parameters.HOME >>/go/bin/go test ./... -coverprofile=coverage.txt -covermode=atomic
install-go-run-tests-windows:
parameters:
GOVERSION:
type: string
steps:
- checkout
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.windows-amd64.zip --output ~/go<< parameters.GOVERSION >>.windows-amd64.zip
- run: unzip ~/go<< parameters.GOVERSION >>.windows-amd64.zip -d ~/
- run: ~/go/bin/go test ./... -coverprofile=coverage.txt -covermode=atomic
build-and-persist-plugin-binary:
parameters:
GOOS:
@@ -56,63 +28,6 @@ commands:
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
jobs:
test-linux:
executor: golang
working_directory: ~/go/src/github.com/hashicorp/packer-plugin-azure
steps:
- checkout
- run: go test -count 1 ./... -coverprofile=coverage.txt -covermode=atomic -timeout=3m
test-darwin:
executor: darwin
working_directory: ~/go/github.com/hashicorp/packer-plugin-azure
steps:
- install-go-run-tests-unix:
GOOS: darwin
GOVERSION: "1.17.13"
test-windows:
executor:
name: win/vs2019
shell: bash.exe
steps:
- install-go-run-tests-windows:
GOVERSION: "1.17.13"
check-lint:
executor: golang
steps:
- checkout
- run: git fetch --all
- run:
command: |
echo "==> Updating linter dependencies..."
curl -sSfL -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8
echo "==> Running linter on newly added Go source files..."
GO111MODULE=on golangci-lint run --new-from-rev=$(shell git merge-base origin/main HEAD) ./...
no_output_timeout: 30m
check-fmt:
executor: golang
steps:
- checkout
- run: |
go fmt ./...
echo "==> Checking that code complies with go fmt requirements..."
git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found files that are not fmt'ed."; \
echo "You can use the command: \`go fmt ./...\` to reformat code."; \
exit 1; \
fi
check-generate:
executor: golang
working_directory: ~/go/src/github.com/hashicorp/packer-plugin-azure
steps:
- checkout
- run: |
make generate
echo "==> Checking that auto-generated code is not changed..."
git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found diffs in go generated code."; \
echo "You can use the command: \`make generate\` to reformat code."; \
exit 1; \
fi
build_linux:
executor: golang
steps:
@@ -130,10 +45,6 @@ jobs:
steps:
- build-and-persist-plugin-binary:
GOOS: darwin
build_darwin_arm64:
executor: golang
working_directory: ~/go/src/github.com/hashicorp/packer-plugin-azure
steps:
- build-and-persist-plugin-binary:
GOOS: darwin
GOARCH: arm64
@@ -166,31 +77,19 @@ jobs:

workflows:
version: 2
test:
jobs:
- test-linux
- test-darwin
- test-windows
check-code:
jobs:
- check-lint
- check-fmt
- check-generate
build_plugin_binaries:
jobs:
- build_linux
- build_darwin
- build_darwin_arm64
- build_windows
- build_freebsd
- build_linux
- build_openbsd
- build_solaris
- build_windows
- store_artifacts:
requires:
- build_linux
- build_darwin
- build_darwin_arm64
- build_windows
- build_freebsd
- build_linux
- build_openbsd
- build_solaris
- build_windows
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ runtime in order to build packer with the Azure plugin.

1. This project always releases from the latest version of golang.
[Install go](https://golang.org/doc/install#install) To properly build from
source, you need to have golang >= 1.17
source, you need to have golang >= 1.18

## Setting up Azure plugin for dev

43 changes: 43 additions & 0 deletions .github/workflows/go-test-darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# This GitHub action runs Packer go tests across
# MacOS runners.
#

name: "Go Test MacOS"

on:
push:
branches:
- 'main'
pull_request:

permissions:
contents: read

jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v2
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
darwin-go-tests:
needs:
- get-go-version
runs-on: macos-latest
name: Darwin Go tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
echo "Testing with Go ${{ needs.get-go-version.outputs.go-version }}"
go test -race -count 1 ./... -timeout=3m
41 changes: 41 additions & 0 deletions .github/workflows/go-test-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# This GitHub action runs Packer go tests across
# Linux runners.
#

name: "Go Test Linux"

on:
push:
branches:
- 'main'
pull_request:

permissions:
contents: read

jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v2
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
linux-go-tests:
needs:
- get-go-version
runs-on: ubuntu-latest
name: Linux Go tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
echo "Testing with Go ${{ needs.get-go-version.outputs.go-version }}"
go test -race -count 1 ./... -timeout=3m
42 changes: 42 additions & 0 deletions .github/workflows/go-test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# This GitHub action runs Packer go tests across
# Windows runners.
#

name: "Go Test Windows"

on:
push:
branches:
- 'main'
pull_request:

permissions:
contents: read

jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v2
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
windows-go-tests:
needs:
- get-go-version
runs-on: windows-latest
name: Windows Go tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
echo "Testing with Go ${{ needs.get-go-version.outputs.go-version }}"
go test -race -count 1 ./... -timeout=3m
83 changes: 83 additions & 0 deletions .github/workflows/go-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# This GitHub action runs basic linting checks for Packer.
#

name: "Go Validate"

on:
push:
branches:
- 'main'
pull_request:

permissions:
contents: read

jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v2
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
check-mod-tidy:
needs:
- get-go-version
runs-on: ubuntu-latest
name: Go Mod Tidy
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: go mod tidy
check-lint:
needs:
- get-go-version
runs-on: ubuntu-latest
name: Lint check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- uses: golangci/golangci-lint-action@v3
with:
version: v1.47.3
only-new-issues: true
check-fmt:
needs:
- get-go-version
runs-on: ubuntu-latest
name: Gofmt check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
go fmt ./...
echo "==> Checking that code complies with go fmt requirements..."
git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found files that are not fmt'ed."; \
echo "You can use the command: \`go fmt ./...\` to reformat code."; \
exit 1; \
fi
check-generate:
needs:
- get-go-version
runs-on: ubuntu-latest
name: Generate check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
export PATH=$PATH:$(go env GOPATH)/bin
make generate
16 changes: 0 additions & 16 deletions .github/workflows/issues-opened.yml

This file was deleted.

Loading