Skip to content

Breaking syntax changes in Packer v1.13 for Windows build templates #12318

Closed
@angaaruriakhil

Description

@angaaruriakhil

Description

We perform builds of these images using agents that have the latest version of Packer installed (via install-packer.sh).

We recently upgraded to Packer v1.13.

This has broken our Windows builds using the packer templates present in this repository. It fails on the very first step:

Code

  provisioner "powershell" {
    inline = [
      "New-Item -Path ${var.image_folder} -ItemType Directory -Force",
      "New-Item -Path ${var.temp_dir} -ItemType Directory -Force"
    ]
  }

Error

==> azure-arm.build_vhd: Provisioning with powershell script: /tmp/powershell-provisioner534343087
==> azure-arm.build_vhd:
==> azure-arm.build_vhd: C:\Windows\Temp\script-68403835-d153-9b9c-b9f3-59412845eb52.ps1 : An error occurred: Cannot bind parameter because
==> azure-arm.build_vhd: parameter 'Path' is specified more than once. To provide multiple values to parameters that can accept multiple
==> azure-arm.build_vhd: values, use the array syntax. For example, "-parameter value1,value2,value3".
==> azure-arm.build_vhd:     + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
==> azure-arm.build_vhd:     + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,script-68403835-d153-9b9c-b9f3-5941284
==> azure-arm.build_vhd:    5eb52.ps1
==> azure-arm.build_vhd:

If we look at the release notes for v1.13 we can see that some changes were made to the syntax required for uploading directories.

core: Updated the documentation to explicitly state that a trailing slash is required when uploading directories, regardless of the guest OS.
This clarification is intended to ensure consistent behavior and prevent confusion, especially for Windows users.
https://github.com/hashicorp/packer/pull/13309

I'm not sure if the above is the breaking change or there is a bug in the new Packer version.

As a workaround we are installing Packer v1.12 in our pipelines and removing 1.13.

If the changes are intentional from Packer's side, are there plans to update the syntax of the Windows templates to be compatible with Packer v1.13 so that builds can continue to be executed?

Thanks!

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

N/A - Building image from this repo

Is it regression?

Yes

Expected behavior

First step of Windows build should pass with:

=> azure-arm.build_vhd: Provisioning with powershell script: /tmp/powershell-provisioner3329247378
    azure-arm.build_vhd:
    azure-arm.build_vhd:
    azure-arm.build_vhd:     Directory: C:\
    azure-arm.build_vhd:
    azure-arm.build_vhd:
    azure-arm.build_vhd: Mode                 LastWriteTime         Length Name
    azure-arm.build_vhd: ----                 -------------         ------ ----
    azure-arm.build_vhd: d-----          6/4/2025  12:55 PM                image
    azure-arm.build_vhd:
    azure-arm.build_vhd:
    azure-arm.build_vhd:     Directory: C:\Users\packer\AppData\Local
    azure-arm.build_vhd:
    azure-arm.build_vhd:
    azure-arm.build_vhd: Mode                 LastWriteTime         Length Name
    azure-arm.build_vhd: ----                 -------------         ------ ----
    azure-arm.build_vhd: d-----          6/4/2025  12:55 PM                Temp

Actual behavior

Error

==> azure-arm.build_vhd: Provisioning with powershell script: /tmp/powershell-provisioner534343087
==> azure-arm.build_vhd:
==> azure-arm.build_vhd: C:\Windows\Temp\script-68403835-d153-9b9c-b9f3-59412845eb52.ps1 : An error occurred: Cannot bind parameter because
==> azure-arm.build_vhd: parameter 'Path' is specified more than once. To provide multiple values to parameters that can accept multiple
==> azure-arm.build_vhd: values, use the array syntax. For example, "-parameter value1,value2,value3".
==> azure-arm.build_vhd:     + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
==> azure-arm.build_vhd:     + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,script-68403835-d153-9b9c-b9f3-5941284
==> azure-arm.build_vhd:    5eb52.ps1
==> azure-arm.build_vhd:

Repro steps

Clone down runner images repo
Run packer build of any Windows OS with build agent that has Packer v1.13 installed

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions