Skip to content

Fix filename completion for commands with path arguments - #13733

Merged
tanmay-hc merged 1 commit into
hashicorp:mainfrom
akasakariko:fix/12466-filename-completion
Oct 27, 2026
Merged

tanmay-hc merged 1 commit into
hashicorp:mainfrom
akasakariko:fix/12466-filename-completion

Conversation

@akasakariko

@akasakariko akasakariko commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Restore filename completion after packer -autocomplete-install by using complete.PredictFiles("*") for commands with positional path arguments instead of complete.PredictNothing

  • Complete both files and directories for build, console, fix, fmt, hcl2_upgrade, init, inspect, validate, and verify-attestation
  • Preserve existing command and flag completion without changing template parsing or command execution
  • Add one shared regression test and a changelog entry

Resolved Issues

Closes #12466

Validation

Reproduced the reported behavior with Packer 1.9.1 in interactive Bash 3.2.57 and 5.3.20 using the same complete -C registration generated by the installer

The patched binary completes packer build ubuntu-arm64.qemu<Tab> to ubuntu-arm64.qemu.pkr.hcl in both shells while preserving packer bui<Tab>

Passed locally with Go 1.26.10 on macOS arm64

  • go test ./command -run '^TestAutocompleteArgs$' -count=1
  • TEST=./command/... VET=./command/... make test including vet
  • go build -o bin/packer .
  • make fmt and make fmt-check
  • make ci-lint
  • git diff --cached --check
  • CLI completion smoke checks for all nine commands, directories, command names, flag names, and -var-file values

Unfiltered golangci-lint run ./command/... reports 90 existing findings
Running the same check against a clean source snapshot of base commit 5f7680f77c9fcacff909f1dfdfa20113e03deee1 produced the same 90 findings with no added or removed diagnostics

GitHub Actions currently reports action_required for both Go Test and Go Validate with no jobs executed
Remote CI results are pending maintainer action

Cloud acceptance tests were not run
Code generation is not applicable because no configuration structs or generated sources changed

Rollback Plan

Revert this change

Changes to Security Controls

None

@akasakariko
akasakariko requested a review from a team as a code owner October 27, 2026 00:36

@tanmay-hc tanmay-hc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising the PR. I've tested them and changes looks good to me.

@tanmay-hc
tanmay-hc merged commit 7519ede into hashicorp:main Oct 27, 2026
10 checks passed
tanmay-hc added a commit that referenced this pull request Nov 25, 2026
* hcl2template: pass user variable values to plugins as packer_user_variables (#13686)

HCL2 builds do not send the packer_user_variables config key to the
builder, provisioner and post-processor plugins. Legacy JSON builds
send this key (through CoreBuild.packerConfig()). Without the key, the
plugin SDK keeps interpolate.Context.UserVariables nil. Then the
template function {{ user "name" }} fails with 'error calling user:
test'. This failure occurs in each string that a plugin interpolates at
run time, for example the contents of the vagrant post-processor's
vagrantfile_template.

Add the function PackerConfig.userVariableValues(). This function
converts the input variable values to strings, equivalent to the legacy
user variables. The core sends the map at each plugin handoff point:
builder, provisioner, post-processor, and enforced provisioner.

The map does not contain the sensitive variables. A sensitive value
goes to a plugin only if the template refers to it explicitly. The map
does not contain values that are not primitive (lists, maps, objects).
Legacy user variables were always strings.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* Dependency upgrade (#13689)

* go.mod version upgrade

* actions upgrade

* plugin-getter: install plugins from non-GitHub HTTP sources (#13691)

Packer can only install plugins from github.com, with
releases.hashicorp.com consulted first for HashiCorp-published plugins.
This has been a long-standing gap for air-gapped and policy-restricted
environments (#11164): the source address parser already accepts any
hostname, but both existing getters reject non-github.com sources at
install time.

Add a remote plugin getter that installs plugins from the host named in
a required_plugins source address. The host serves the directory
structure of releases.hashicorp.com under the source's path: an
index.json listing versions, and per version a SHA256SUMS file, the
zips it lists, and - when the zip names carry no plugin protocol
version - the version's manifest.json. A plugin published on
releases.hashicorp.com is therefore mirrored as a verbatim copy of its
tree, with every checksum file and signature upstream-authored. A
plugin published as GitHub release assets is mirrored by copying each
release's assets into a version directory, renaming their SHA256SUMS
file to the unprefixed convention with content unchanged, and writing
an index.json listing the versions. Both kinds of content can be
served side by side by one host.

Getter selection happens per source address: github.com sources keep
the release and github getters unchanged, while any other host is
served by the remote getter over HTTPS. Sources with three or more
components are supported, up to the existing 16-component limit, so
nested artifact-repository paths and hosts that embed the upstream
origin in their path all resolve.

Version discovery, constraint solving, checksum verification, and the
binary naming rules match the existing getters. The installed filename
is rebuilt from validated checksum-file fields and never taken from the
server's response, checksum entries matching neither known naming shape
are rejected rather than guessed at, and nothing the remote metadata
supplies is used to fetch from another origin or path. index.json
parsing is covered by fixtures captured from the live releases API, so
a format change there fails tests rather than user installs.

Closes #11164

* fix: update link to CONTRIBUTING.md for consistency with main branch

* Merge pull request #13701 from hashicorp/sanya-hashicorp/fix-vuln

Module Dependency update

* build(deps): bump google.golang.org/grpc (#13704)

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.83.1 to 1.83.2.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.83.1...v1.83.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.83.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [COMPLIANCE] Add/Update Copyright Headers (#13699)

* [COMPLIANCE] Add/Update Copyright Headers

* make generate update

* make generate

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: sanya <sanya24@ibm.com>
Co-authored-by: Sanya <rajsanya2424@gmail.com>

* Packer release 1.16.1 (#13705)

* Module upgrade (#13707)

* fix(deps): bump go-m1cpu v0.1.5 to v0.2.1 for M5 fix (#13696)

Fix verified RED->GREEN. CGO SIGSEGV on Apple M5: bump go-m1cpu v0.1.5 -> v0.2.1+ at go.mod:368

* build(deps): bump go.opentelemetry.io/otel/sdk (#13709)

Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.44.0 to 1.45.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](open-telemetry/opentelemetry-go@v1.44.0...v1.45.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-version: 1.45.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sanya <rajsanya2424@gmail.com>

* Module dependency update (#13710)

* Module dependency update for otel

* module dependency update

* Changelog update

* fix: run make generate to fix test errors (#13719)

* ci: bump lock-threads to v6 so the scheduled lock job can run (#13693)

The pinned version validates its github-token input with a 100 character
cap, and the Actions token now exceeds that, so every run fails before
locking anything:

  ##[error]"github-token" length must be less than or equal to 100 characters long

v6 raised the cap to 1000 (v4 and v5.0.x both still validate max(100)).
Every input this workflow passes exists unchanged in the v6 schema, so the
pin bump is the whole fix. Pinned to the v6.0.2 release commit.

Co-authored-by: Tushar Pagar <240662211+tushardev-365@users.noreply.github.com>

* build(deps): bump the actions group across 1 directory with 7 updates (#13720)

Bumps the actions group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `6.2.3` | `6.3.0` |
| [hashicorp/actions-generate-metadata](https://github.com/hashicorp/actions-generate-metadata) | `1.1.4` | `1.3.1` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` |
| [hashicorp/actions-go-build](https://github.com/hashicorp/actions-go-build) | `1.1.2` | `1.1.3` |
| [hashicorp/actions-docker-build](https://github.com/hashicorp/actions-docker-build) | `2.2.1` | `2.3.0` |
| [github/issue-labeler](https://github.com/github/issue-labeler) | `3.4` | `3.5` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `8.0.1` | `8.0.2` |



Updates `aws-actions/configure-aws-credentials` from 6.2.3 to 6.3.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](aws-actions/configure-aws-credentials@e6de054...e125382)

Updates `hashicorp/actions-generate-metadata` from 1.1.4 to 1.3.1
- [Release notes](https://github.com/hashicorp/actions-generate-metadata/releases)
- [Commits](hashicorp/actions-generate-metadata@a43468d...aff2981)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@043fb46...cf430e0)

Updates `hashicorp/actions-go-build` from 1.1.2 to 1.1.3
- [Release notes](https://github.com/hashicorp/actions-go-build/releases)
- [Changelog](https://github.com/hashicorp/actions-go-build/blob/main/CHANGELOG.md)
- [Commits](hashicorp/actions-go-build@dd7ca5a...3f078f6)

Updates `hashicorp/actions-docker-build` from 2.2.1 to 2.3.0
- [Release notes](https://github.com/hashicorp/actions-docker-build/releases)
- [Changelog](https://github.com/hashicorp/actions-docker-build/blob/main/CHANGELOG.md)
- [Commits](hashicorp/actions-docker-build@e12557a...595f293)

Updates `github/issue-labeler` from 3.4 to 3.5
- [Release notes](https://github.com/github/issue-labeler/releases)
- [Commits](github/issue-labeler@c1b0f9f...ccca1e1)

Updates `actions/download-artifact` from 8.0.1 to 8.0.2
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@3e5f45b...9000827)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: hashicorp/actions-generate-metadata
  dependency-version: 1.3.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: hashicorp/actions-go-build
  dependency-version: 1.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: hashicorp/actions-docker-build
  dependency-version: 2.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: github/issue-labeler
  dependency-version: '3.5'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [COMPLIANCE] Add/Update Copyright Headers (#13718)

* [COMPLIANCE] Add/Update Copyright Headers

* fix: add the copyright header to the source file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Taru Garg <taru.garg@hashicorp.com>

* build(deps): bump github.com/hashicorp/hcp-sdk-go (#13722)

Bumps [github.com/hashicorp/hcp-sdk-go](https://github.com/hashicorp/hcp-sdk-go) from 0.175.0 to 0.176.0.
- [Release notes](https://github.com/hashicorp/hcp-sdk-go/releases)
- [Changelog](https://github.com/hashicorp/hcp-sdk-go/blob/main/CHANGELOG.md)
- [Commits](hashicorp/hcp-sdk-go@v0.175.0...v0.176.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/hcp-sdk-go
  dependency-version: 0.176.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update dependencies in plugin_tester module (#13728)

- Bump Go version from 1.26.8 to 1.26.10
- Upgrade github.com/hashicorp/hcl/v2 from v2.24.0 to v2.25.0
- Upgrade github.com/hashicorp/packer-plugin-sdk from v0.6.11 to v0.6.13
- Upgrade github.com/zclconf/go-cty from v1.18.1 to v1.19.0
- Add indirect dependencies for aws-sdk-go-v2 and related packages
- Upgrade various indirect dependencies including golang.org/x/crypto, golang.org/x/net, and golang.org/x/text
- Remove deprecated dependency on github.com/jmespath/go-jmespath

* changelog: update to version 1.16.2 with bug fixes, improvements, and dependency updates (#13729)

* version: update to 1.16.3-dev for development purposes (#13731)

* command: restore filename completion for path arguments (#13733)

Fixes #12466

* build(deps): bump github.com/go-jose/go-jose/v4 (#13737)

Bumps [github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose) from 4.1.4 to 4.1.6.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Commits](go-jose/go-jose@v4.1.4...v4.1.6)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v4
  dependency-version: 4.1.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump brotli version to 1.2.8 (#13739)

* hcl2template: use overridden source name for packer_build_name (#13723)

* provisioner/powershell: recreate env var reader on each upload retry (#13735)

The env var file upload reused a single strings.Reader across retry
attempts. When an attempt failed after the communicator had read some
or all of it (e.g. a transient WinRM error during winrmcp's restore or
cleanup step), the retry uploaded a truncated or empty file and
reported success, so the next script ran without its environment_vars.

Create the reader inside the retry closure so every attempt uploads the
full content, matching the script upload which rewinds its file.

* chore(deps): Bump go-jose version to v4.1.6 (#13741)

* Upload Failed Acc test logs (#13747)

* build(deps): bump go.opentelemetry.io/otel/sdk (#13743)

Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.45.0 to 1.47.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](open-telemetry/opentelemetry-go@v1.45.0...v1.47.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-version: 1.47.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci: Disable Go test result caching for acceptance tests (#13749)

* Disable JIRA workflow and Deleting Issue Migrator workflow (#13748)

* Disable JIRA workflow and Deleting Issue Migrator workflow

* Go module update

* Use a CycloneDX fixture in HCP SBOM acceptance tests (#13750)

* Add live-scanner HCP SBOM acceptance test (#13751)

* ci: install amazon plugin before acceptance tests (#13753)

* Updating go module dependencies (#13754)

* sbom: fix a crash when scanning Debian archives with negative member sizes (#13755)

* version: cut release v1.16.3 (#13756)

* Suppress CVE GO-2026-6905

* version: cut release v1.16.3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Erik Berg <github@slipsprogrammor.no>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Sanya <rajsanya2424@gmail.com>
Co-authored-by: Benjamin Holmes <benjamin.holmes@gmail.com>
Co-authored-by: elomito <omitolizatieno@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: sanya <sanya24@ibm.com>
Co-authored-by: Jeremy Schoemaker <jeremy@shoemoney.com>
Co-authored-by: Taru Garg <taru.garg@hashicorp.com>
Co-authored-by: Tushar Pagar <backendbytushar@gmail.com>
Co-authored-by: Tushar Pagar <240662211+tushardev-365@users.noreply.github.com>
Co-authored-by: Hari <hari.om2@ibm.com>
Co-authored-by: Asuka <Kayano04@outlook.jp>
Co-authored-by: somaz <112675579+somaz94@users.noreply.github.com>
Co-authored-by: Patrick Veilleux <patrix87@gmail.com>
@github-actions

Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'packer -autocomplete-install' breaks filename completion

2 participants