hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.07k stars 3.33k forks source link

Packer is not running provisioner script and jumping to next script without completion #12654

Open paritoshdubey opened 1 year ago

paritoshdubey commented 1 year ago

Overview of the Issue

Provisoner script is not running all commands in scripts completly and jumping to another script before it gets completed

Reproduction Steps

Steps to reproduce this issue

Packer version

From version 1.9

Simplified Packer Template

[
"builders": [
"type": "googlecompute",
"image_name": "{{user instance_name"}}",
"image_family": "test",
"project_id": "",
"source_image_project_id": "",
"source_image_family": "test-windows-2019",
"instance_name": "{{user 'instance_name"}}",
"disk_size":"100",
"disk_type": "pd-ssd",
"machine_type": "n2-standard-8",
"communicator": "winrm",
"winrm_username": "packer_user",
winrm insecure": true,
"winrm_use_ssl": true,
"metadata":{
},
windows-startup-script-cmd": "reg delete HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\Windows\\WinRM\\Service\\WinRS\\
"sysprep-specialize-script-ps1": "test"
"zone":"us-east1-b",
"subnetwork": "projects//regions/us-east1/subnetworks/",
"Scopes": ["https://www.googleapis.com/auth/cloud-platform"],
"omit_external_ip": true,
"use_internal_ip": true,
"service_account_email": "test",
"state_timeout": "10m"
"provisioners":[
{
"type": "powershell",
"environment_vars": [
1,
"package_version={{user package_version"}}"
"scripts": [
"/resources/test/Invoke-Install Features.ps1"
]
},
{
"type":"powershell",
"inline":["GCESysprep - NoShutdown"]
}
]
}

Operating system and Environment details

OS, Architecture, and any other information you can provide about the environment.

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

codefox42 commented 2 weeks ago

Today we also spotted a packer run that seems to have skipped one of several scripts passed to the powershell provisioner (packer-1.11.2). :-(