actions / runner-images

GitHub Actions runner images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Receiving error while creating windows image locally using packer and

suhas-arcadis opened this issue · comments

Description

Command executed:
GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "myTestResourceGroup" -ImageGenerationRepositoryRoot "$pwd" -ImageType Ubuntu1804 -AzureLocation "East US" -EnableHttpsTrafficOnly $true -tags @{dept="devops";env="prod"}

error:
Latest commit:
Date: Tue Aug 2 11:08:13 2022 +0000; Commit: 12138a5 - Updating readme file for win19 version 20220801.1; Author: Image generation service account no-reply@microsoft.comFailed to parse file as legacy JSON template: if you are using an HCL template, check your file extensions; they should be either *.pkr.hcl or *.pkr.json; see the docs for more details: https://www.packer.io/docs/templates/hcl_templates.
Original error: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
At line 1, column 1 (offset 1):
1: �

Am I doing something wrong? All the values supplied to the command are correct. It seems to be an encoding issue to me. I have tried this from powershell and vscode as well. Any pointers?

Platforms affected

  • Azure DevOps
  • GitHub Actions

Virtual environments affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 10.15
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

trying locally..

Is it regression?

N/A

Expected behavior

And image to be created locally

Actual behavior

Error while image generation.

Repro steps

When i execute the command provided in description, it fails with error...

Hi @suhas-arcadis

  • Whats your packer version?
  • Have you tried running packer fix?

packer version: 1.8.2
I tried packer fix, it created a new json file but still encountering same issue.

FYI - I ran 'packer fix .\images\win\windows2019.json > new.json', replaced the new content within the windows2019.json and executed the command to generate image, again with same issue.

@suhas-arcadis we do not modify encoding anyhow, try to re-fetch the repo

Feel free to ask contact us again if you have questions left.

I ran into this same issue and for anybody facing this later on, leaving out the tags from the command doesn't create the temporary Packer JSON file which has the problematic Windows CRLF end of line sequences.