Commit Graph
18470 Commits
Author SHA1 Message Date
Lucas Bajolet 64ae3e8ea4 packer: alias version as goversion for getter
Since we named the version from the getter `version', this means we have
a naming conflict inside the loop that attempts to install a versioned
candidate for a plugin, making it impossible to invoke something from
the go-version package.

Since we'll introduce a change that needs the latter capability, we must
either rename the local variable to something else than `version', or we
need to alias the package locally.

This commit implements the latter, opting to call the package goversion.
2024-05-08 16:01:29 -04:00
Lucas Bajolet d40df8e899 packer: check if errs is nil before getting length
When installing a remote plugin, and after we've either successfully
installed a binary, or exhausted all the possible sources, we print a
final error message if nothing was reported.

However, given that errs is a pointer to a structure, and if no errors
were produced, the the error list could be nil, leading to the call to
`Len()' to crash Packer.

This is exceedingly rare as in general the code attempts to read
multiple sources from Github, and therefore we almost always get some
error reported, but while changing the function's code, I managed to
make it crash while removing/changing some error statements.

Therefore to avoid future surprises, we first check that `errs' is not
nil before invoking `Len()' on it, as no errors and no plugins installed
mean that something went wrong all the same.
2024-05-08 16:01:29 -04:00
Lucas Bajolet 56fab30fa1 plugin: factorise calling describe on binaries
Given that calling the describe command on plugins and deserialising the
output as a plugin description is something done in multiple places in
the code, we factorise this operation so we don't need to copy/paste the
code around.
2024-05-08 16:01:29 -04:00
Lucas Bajolet 747cb00cdc packer: remove temp zipfile after installation
The zipfile containing the binaries we attempt to install from a remote
source is placed in the temporary directory of the host.
In general it is wiped automatically by the OS, but in some cases
(windows typically), it isn't.

To avoid cluttering the temporary directory, we clean-up after
ourselves, and remove the temporary zip file that we create when
attempting to install a plugin, regardless of it succeeding or not.
2024-05-08 16:01:29 -04:00
Wilken Rivera 61199aed0d Update internal HashiCorp actions to address Node 20 deprecation 2024-05-08 15:08:16 -04:00
Wilken Rivera 5e043ab3a0 Bump required actions to address Node.js 16 deprecation issue (#12958)
* Bump required actions to address Node.js 16 deprecation issue

* Update all tsccr approved actions

```shell
tsccr-helper gha update -latest .
```
2024-05-07 12:59:45 -04:00
Wilken Rivera 1a79aab50e Bump actions/setup-go to address Node.js 16 deprecation issues (#12957) 2024-05-07 10:50:00 -04:00
Wilken Rivera 5f47c99ec4 Bump actions/checkout to address Node.js 16 deprecation issues 2024-05-07 10:39:37 -04:00
Devashish 403e35d2ff Add thread-safe add and get methods for plugin storage
* Add general code improvements
2024-05-01 16:19:30 -04:00
dependabot[bot] 26b2bb8dbf build(deps): bump github.com/hashicorp/hcp-sdk-go from 0.92.0 to 0.93.0 (#12942)
Bumps [github.com/hashicorp/hcp-sdk-go](https://github.com/hashicorp/hcp-sdk-go) from 0.92.0 to 0.93.0.
- [Release notes](https://github.com/hashicorp/hcp-sdk-go/releases)
- [Changelog](https://github.com/hashicorp/hcp-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/hcp-sdk-go/compare/v0.92.0...v0.93.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-30 09:52:54 -04:00
Lucas Bajolet 6fc1d154bd packer: relax constraints on sources
The source parsing logic was heavily directed towards Github compatible
source URIs, however if we want to support more cases, we need to make
sure we are able to specify those URIs, and to load plugins installed
from those sources.

Right now, since the getters available are only github.com, we will not
support remotely instlling plugins from sources other than github.com,
with the same set of constraints as before. However, we do support now
installing from a local plugin binary to any kind of source, and we
support loading them, including if a template wants this plugin
installed locally with version constraints.
2024-04-29 14:28:24 -04:00
Lucas Bajolet 1bf3e86ee1 hcl2template: fix invalid_inexplicit_source_2 test
The invalid_inexplicit_source_2 subtest for parse used to fail in
previous versions of Packer, but with the latest changes to plugin
source management, it won't, at least at parsing time, instead it fails
later when the Github getter (the only available for now) cannot get the
plugin binary from the source, as the source is not a valid Github URI.
2024-04-29 14:28:24 -04:00
Jiaqi Liu 00f39e72d3 Add missing option doc for 'packer fmt' (#12944) 2024-04-29 10:04:20 -04:00
Lucas Bajolet 410e59f141 version: compute SemVer from rawVersion
A bug in the SDK prevents us from calling SemVer on the PluginVersion
derived from the rawVersion, as when doing so, we reset the semVer
attribute to only use the core part of the version, thereby dropping any
information on pre-release/metadata.

This is not ideal, and arguably not wanted. So in order to not lose this
information, we re-compute the SemVer from rawVersion, this way we don't
overwrite it for both structures.
2024-04-23 11:10:43 -04:00
Wilken Rivera f767d06f93 Dockerfile: Add Product directory to /usr/share/doc directory
Closes: #12939
2024-04-23 09:28:35 -04:00
Wilken Rivera 094e00ebd2 Update CHANGELOG 2024-04-23 09:26:25 -04:00
Wilken Rivera baa67010de Add CHANGELOG entries for 1.10.3 2024-04-23 09:15:23 -04:00
dependabot[bot] 7526cd6e76 build(deps): bump github.com/hashicorp/hcp-sdk-go from 0.90.0 to 0.92.0 (#12935)
Bumps [github.com/hashicorp/hcp-sdk-go](https://github.com/hashicorp/hcp-sdk-go) from 0.90.0 to 0.92.0.
- [Release notes](https://github.com/hashicorp/hcp-sdk-go/releases)
- [Changelog](https://github.com/hashicorp/hcp-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/hcp-sdk-go/compare/v0.90.0...v0.92.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-17 22:33:36 -04:00
Lucas Bajolet cdaad0cde2 version: up version handling code for SDK update
Since the SDK was updated and now accepts raw version strings in
addition to also supporting metadata officially, we can start using
those functions in our version package as well.
2024-04-16 14:27:05 -04:00
Lucas Bajolet 33d9550903 packer: make Ui implementations match new SDK's
The SDK's Ui interface has had some additions recently for supporting
format-strings and their arguments as paramereters to Say, Ask and
Error.

These changes to the interface means that all the implementations of
that interface need to match the definition, so in this case the
implementations we had in packer/ui.go need to be updated to support
those functions.
2024-04-16 14:27:05 -04:00
Wilken Rivera 0b00f52653 Copy license into zip with txt extension 2024-04-16 13:04:48 -04:00
Wilken Rivera 98fd73ad74 Add LICENSE to Linux packages 2024-04-16 13:04:48 -04:00
Wilken Rivera c37a892665 Add LICENSE details to Docker release binaries 2024-04-16 13:04:48 -04:00
Wilken Rivera 72a2604b34 Add LICENSE to zipped Go binaries 2024-04-16 13:04:48 -04:00
Lucas Bajolet f05124e2a4 version: set version to 1.11.0-dev
Since we set the raw version string from version/VERSION now, we change
its information to point to 1.11.0-dev until we're ready to release.
2024-04-16 10:19:17 -04:00
Lucas Bajolet 93bec31ec9 version: embed version/VERSION as version string
Since we have both version/version.go and version/VERSION to specify
version strings, both are a bit redundant.

As version/VERSION is supposed to be the source of truth now, we are
using it to derive the version informaiton we used to rely on in Packer
and its subcommands.

Note: doing this prevents us from changing the version/prerelease
through ldflags though as we derive Version/VersionPrerelease from the
rawVersion variable.
2024-04-16 10:19:17 -04:00
Lucas Bajolet 27538f377b release/ci: remove trailing whitespace 2024-04-16 10:13:29 -04:00
Lucas Bajolet 55a11fe7f4 release/ci: disable automatic version bump 2024-04-16 10:13:29 -04:00
Lucas Bajolet 3f083fe8ea github: only publish latest release images
When building the container images for Packer (light and full), we
should only publish them in the version being built is a release, and
not a pre-release.

Changing this means that both light and full latest will always be only
a final release at any time.
2024-04-16 10:13:29 -04:00
Wilken Rivera fed91012ab Bump golang.org/x/net to v0.24.0 to address GO-2024-2687 2024-04-15 18:18:44 -04:00