packer-cn/packer
Wilken Rivera f48583c57e github/getter: Adds a hostname check to Get function
This change adds a simple hostname validation check to validate that a
plugins source address is github.com before continuing with the Get
call. An issue was encountered when using a hostname different from
github.com, where the getter would continue to pull a plugin from GitHub
even if the hostname was something like "example.com". See log details
below.

Before change
```
2021/02/16 12:49:41 [TRACE] fetching checksums file for the "0.0.2" version of the example.com/hashicorp/docker plugin in
"/home/wilken/.packer.d/plugins/example.com/hashicorp/docker"...

2021/02/16 12:49:41 [DEBUG] github-getter: getting "https://github.com/hashicorp/packer-plugin-docker/releases/download/v0.0.2/packer-plugin-docker_v0.0.2_SHA256SUMS"
2021/02/16 12:49:42 [TRACE] Ignoring remote binary packer-plugin-docker_v0.0.2_x5.0_linux_arm64.zip, wrong system, expected
2021/02/16 12:49:42 [TRACE] About to get: packer-plugin-docker_v0.0.2_x5.0_linux_amd64.zip
2021/02/16 12:49:42 [DEBUG] github-getter: getting "https://github.com/hashicorp/packer-plugin-docker/releases/download/v0.0.2/packer-plugin-docker_v0.0.2_x5.0_linux_amd64.zip"
```

After change
```
2021/02/16 13:36:32 [TRACE] for plugin example.com/hashicorp/docker found 0 matching installation(s)
2021/02/16 13:36:32 [TRACE] getting available versions for the the example.com/hashicorp/docker plugin
2021/02/16 13:36:32 [TRACE] &{%!q(*github.Client=<nil>) "packer-getter-github-1.7.0-dev"} getter could not get release: example.com/hashicorp/docker doesn't appear to be a valid github.com source address; check source and try again.
2021/02/16 13:36:32 [DEBUG] will try to install: []
2021/02/16 13:36:32 [INFO] (telemetry) Finalizing.  no release version found for the example.com/hashicorp/docker plugin matching the constraint(s): ">=v0.0.2"
2021/02/16 13:36:32 waiting for all plugin processes to complete...
```
2021-02-16 13:38:57 -05:00
..
plugin-getter github/getter: Adds a hostname check to Get function 2021-02-16 13:38:57 -05:00
test-fixtures fix tests by moving mock hooks and communicators, and BasicUi definition, into SDK 2020-11-30 14:30:30 -08:00
build.go remove sdk 2020-12-17 13:29:25 -08:00
build_test.go remove sdk 2020-12-17 13:29:25 -08:00
builder_test.go packer: builder prepare can return warnings 2013-11-02 22:31:12 -05:00
client_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_builder.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_builder_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_datasource.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_datasource_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_hook.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_hook_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_post_processor.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_post_processor_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_provisioner.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
cmd_provisioner_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
core.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
core_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
fixconfigmode_enumer.go fix enum 2020-05-08 16:54:44 +02:00
maps.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
packer_test.go packer: Core, and template validate 2015-05-23 14:48:07 -07:00
plugin.go Multi plugin naming (#10608) 2021-02-15 11:10:43 +01:00
plugin_client.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
plugin_discover_test.go Multi plugin naming (#10608) 2021-02-15 11:10:43 +01:00
plugin_folders.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
plugin_test.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
post_processor_mock.go remove sdk 2020-12-17 13:29:25 -08:00
post_processor_mock.hcl2spec.go remove sdk 2020-12-17 13:29:25 -08:00
progressbar.go noop progress bar is nil progress bar 2020-09-24 12:26:09 +02:00
progressbar_solaris.go remove sdk 2020-12-17 13:29:25 -08:00
progressbar_test.go Switch to explicitly declaring TrackProgress on UI, using an underlying progress bar specifically stored on the struct. Export UiProgressTracker. These changes allow us to optionaly switch to the NoopProgressTracker when no TTY is set. 2020-09-21 16:05:14 -07:00
provisioner.go remove sdk 2020-12-17 13:29:25 -08:00
provisioner_test.go remove sdk 2020-12-17 13:29:25 -08:00
provisioner_timeout.go remove sdk 2020-12-17 13:29:25 -08:00
run_interfaces.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
telemetry.go remove sdk 2020-12-17 13:29:25 -08:00
telemetry_test.go add config key reporting 2017-11-14 16:30:44 -08:00
testing.go HCL2 Parse packer.required_plugins block + packer init (#10304) 2021-02-02 18:05:04 +01:00
ui.go remove sdk 2020-12-17 13:29:25 -08:00
ui_test.go remove sdk 2020-12-17 13:29:25 -08:00