Commit Graph
18303 Commits
Author SHA1 Message Date
Wilken Rivera a427094426 Add env for HCP_PACKER_BUILD_FINGERPRINT 2022-10-13 15:13:29 -04:00
Lucas Bajolet b3188637bf registry: load bucket slug in command/registry
Loadgin the slug from the environment within the Bucket implied that the
Bucket was successfully created, which may fail outside of a Git
directory when the iteration fingerprint is not set through environment
variables.

To make it possible to print as much information regarding the
environment to the users at once rather than stopping immediately when
this step fails, we move the logic to read the default value from the
environment to the HCP setup code.
2022-10-13 15:13:29 -04:00
Lucas Bajolet 9267d933bc command: report multiple errors in bad HCP config
When HCP is detected to be enabled, but some configuration is missing,
we returned immediately on the first error.

This commit changes this behaviour by reporting every error at once, so
users will know immediately if something is wrong when they invoke
Packer with HCP support, and one or more environment variables is not
defined as we'd expect them.
2022-10-13 15:13:29 -04:00
Lucas Bajolet ae15ed339c registry: add function to detect explicit HCP
The HCP_PACKER_REGISTRY environment variable had its behaviour changed
recently, as prior versions of Packer expected the attribute to be
forcefully set to a value that is neither "off" nor "0" in order to
get HCP integration to work, or that a "hcp_packer_registry" block was
defined in an HCL template. Now, this environment variable defaults to
not explicitely enable, but instead to explicitely disable HCP
integration, and the feature switch fall upon HCP_PACKER_BUCKET_NAME.

As an extra feature, we keep the prior behaviour alive when it is
explicitely defined as a value to enable it. That way we can report
errors if the rest is not defined, rather than silently ignore it.

This function we add to env is the first stone to enable this behaviour.
2022-10-13 15:13:29 -04:00
Wilken Rivera 3395d84fbc Merge pull request #12047 from hashicorp/nywilken/go-2022-1059
chore: Bump golang.org/x/text to v0.3.8
2022-10-12 15:35:58 -05:00
Wilken Rivera 6eba1f598e chore: Bump golang.org/x/text to v0.3.8
Address reported vulnerability GO-2022-1059 in golang.org/x/[email protected]
2022-10-12 15:59:17 -04:00
Wilken Rivera 326dd58c59 Merge pull request #12044 from hashicorp/compliance/add-license
[COMPLIANCE] Update MPL 2.0 LICENSE
2022-10-12 14:50:04 -05:00
Wilken Rivera 35eb6875c1 Merge pull request #12046 from hashicorp/dependabot/github_actions/slackapi/slack-github-action-1.23.0
Bump slackapi/slack-github-action from 1.22.0 to 1.23.0
2022-10-12 14:48:48 -05:00
Wilken Rivera b6d16de707 Merge pull request #12037 from hashicorp/website/upgrade-next
website: upgrade next version
2022-10-12 14:31:35 -05:00
dependabot[bot] 0a6f7c5191 Bump slackapi/slack-github-action from 1.22.0 to 1.23.0
Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 1.22.0 to 1.23.0.
- [Release notes](https://github.com/slackapi/slack-github-action/releases)
- [Commits](https://github.com/slackapi/slack-github-action/compare/v1.22.0...v1.23.0)

---
updated-dependencies:
- dependency-name: slackapi/slack-github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2022-10-12 19:23:21 +00:00
Mariano Asselborn 155b335e3a Merge pull request #12042 from hashicorp/enable_ironbank_integration
Enable Iron Bank integration
2022-10-12 12:12:42 -04:00
CalebAlbers d4a2abfe8c [COMPLIANCE] Update MPL 2.0 LICENSE 2022-10-12 00:08:06 +00:00
Mariano Asselborn 08255b8ca4 Enable Iron Bank integration 2022-10-11 15:04:44 -04:00
Bryce Kalow 6d8345cbd0 Upgrade next version 2022-10-06 18:34:05 +00:00
Wilken Rivera 4bb6e52044 Skip issue creation for previously synced issues (#12035)
Assigning the sync to jira label multiple times to an issues causes
multiple Jira tickets to be created. This new change adds a ticket
search to find any previously created ticket in Jira for the labeled
issue. If a ticket already exist the action will skip the create step.
2022-10-05 18:05:35 -04:00
HashiBot eed5e48b8c chore: Update Digital Team Files (#12032)
* Update generated scripts (website-build.sh)

* Update generated scripts (should-build.sh)

* Update generated website Makefile

* Update generated scripts (website-start.sh)
2022-10-05 10:33:00 -04:00
Kevin Wang 0bd6acab07 chore: use ImageConfig (#12026) 2022-10-04 16:31:58 -04:00
Lucas Bajolet c0e7e7bd3c hcl2: report error on build without sources
When a template describes a build block without a source reference, the
build should be considered invalid as we won't have a CoreBuild produced
as a result of the need to have both.

In current versions of Packer, this will produce an error message
hinting that nothing will happen because of the lack of either build or
source block.

This commit takes the defined block, and points out to it as missing a
source block as being the reason why nothing is happening, making it
clearer what is required for an HCL2 build to be processed.
2022-09-30 15:39:27 -04:00
Lucas Bajolet 61c56e161c hcl2: add example for undefined variable set warn
When a variable is set in a pkrvars file, but isn't defined, an error
message is output, but does not deliver an example of what is expected
by Packer in order to complete a build.

To remedy that, we improve the error message by giving an example of
variable block to include in the build template.
2022-09-28 14:51:28 -04:00
Kevin Wang f6e31d3147 chore(website): nvmrc 16 (#12021)
* chore: nvmrc 16

* Node v16+
2022-09-28 10:44:28 -04:00
Wilken Rivera 6fb6ae8aee Add ppc64le to binary release matrix for Linux (#11966)
Closes #11924
2022-09-28 10:12:28 -04:00
Lucas Bajolet 73af77aeed command: enhance error message on no build to run 2022-09-23 12:07:32 -04:00
Lucas Bajolet e94b8766cb build: exit immediately if no builds and diags
When a template with some builds to run ends its GetBuilds with an
error, and no builds produced, we can exit immediately without printing
more errors.
2022-09-23 12:07:32 -04:00
Lucas Bajolet 3f6c0a5f23 command: move func to extract stdout/err in tests
In order to test the output from a test command, the commandOutput
function exists in the command_test.go file.

Since its behaviour is linked to the test meta that we produce in the
test_utils.go file, we move it there, and rename it to
`GetStdoutAndErrFromTestMeta' to make it clearer what to expect from it.
2022-09-23 12:07:32 -04:00
Wilken Rivera 6ee6091aa9 Add JIRA sync action (#12003)
In order to plan GitHub issues alongside internal JIRA issues
the Packer repository is being updated to support syncing issues from
GitHub to JIRA.
2022-09-21 15:02:20 -04:00
Wilken Rivera d028844284 Update dependency to resolve GO-2022-0969 (#12009) 2022-09-20 16:57:17 -04:00
Eng Zer Jun f5ec0f1c57 test: use T.Setenv to set env vars in tests
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <[email protected]>
2022-09-20 14:54:20 -04:00
dependabot[bot] f7ce79362d Bump github.com/hashicorp/packer-plugin-sdk from 0.3.1 to 0.3.2 (#11981)
Bumps [github.com/hashicorp/packer-plugin-sdk](https://github.com/hashicorp/packer-plugin-sdk) from 0.3.1 to 0.3.2.
- [Release notes](https://github.com/hashicorp/packer-plugin-sdk/releases)
- [Changelog](https://github.com/hashicorp/packer-plugin-sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/packer-plugin-sdk/compare/v0.3.1...v0.3.2)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/packer-plugin-sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-20 13:08:38 -04:00
Zach Shilton f9ba7dca5d fix(website): sourceBranch for anka in plugins-manifest (#12004) 2022-09-19 20:12:45 -04:00
Lucas Bajolet 779a31a25f hcp: use HCP_PACKER_REGISTRY to disable HCP
The current behaviour for HCP integration is based on the presence of
the HCP_PACKER_REGISTRY environment variable, where if it is either not
"0" or "off", the HCP integration is enabled.

This commit changes the behaviour to only use this variable to
explicitely disable HCP, and the HCP_PACKER_BUCKET_NAME variable will
condition if the HCP integration is enabled for a build or not in JSON
templates.

For HCL templates, the integration can also be disabled if the
HCP_PACKER_REGISTRY variable is set to "0" or "off", and will be
considered enabled if the HCP_PACKER_BUCKET_NAME is set, or there is a
"hcp_packer_registry" block in a build.
2022-09-19 11:22:13 -04:00
Laura PacilioandWilken Rivera d4b03769f2 Update plugin docs - devdot launch (#11978)
* Separate install instructions; add to external plugins

* Remove duplicate external plugin link; modify overiew page

* Remove unnecessary partials; clean up plugin overview page

* cleaning up plugin explanations

* final language updates

* modify external plugin overview page

* Update website/content/docs/plugins/index.mdx

Co-authored-by: Wilken Rivera <[email protected]>

* Update website/content/docs/plugins/install-plugins.mdx

Co-authored-by: Wilken Rivera <[email protected]>

* Move HCP Support to under developing plugins

* Link HCP Packer support to other dev pages; fix overviews

* clean up more language and links

* Add External Plugins link to docs sidebar under plugin section

* Update website/data/docs-nav-data.json

Co-authored-by: Wilken Rivera <[email protected]>
2022-09-15 18:12:37 -04:00
Wilken Rivera 11e71729f1 Remove Oracle plugin from the list of vendored plugins (#11983)
The latest release of the Oracle plugin for Packer removed
Solaris from its list of supported platforms. Since Packer still
releases binaries for Solaris the Oracle plugin will no longer be
bundled and distributed within the Packer binary. Practitioners relying
on the plugin can continue using the plugin by installing it manually
using either the `packer init` or `packer plugins install` commands.
2022-09-15 12:31:52 -04:00
dependabot[bot] 51980ca573 Bump actions/stale from 5.1.1 to 5.2.0 (#11989)
Bumps [actions/stale](https://github.com/actions/stale) from 5.1.1 to 5.2.0.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v5.1.1...v5.2.0)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-15 12:31:34 -04:00
Laura Pacilio 8765cd3cab Content munge devportal (#11982)
* Update content for devdot

* more edits

* Update website/content/docs/templates/hcl_templates/blocks/index.mdx

* Update website/content/docs/provisioners/index.mdx

* Update website/content/docs/datasources/index.mdx
2022-09-14 16:16:39 -04:00
Zach Shilton 379a17fdca fix(website): pin packer-plugin-outscale docs to 1.0.2 (#11986) 2022-09-14 13:35:26 -04:00
dependabot[bot] 1be3860b96 Bump slackapi/slack-github-action from 1.21.0 to 1.22.0 (#11980)
Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 1.21.0 to 1.22.0.
- [Release notes](https://github.com/slackapi/slack-github-action/releases)
- [Commits](https://github.com/slackapi/slack-github-action/compare/v1.21.0...v1.22.0)

---
updated-dependencies:
- dependency-name: slackapi/slack-github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-13 19:40:56 -04:00
Lucas Bajolet a298617ecb command/build: warn and exit when nothing to build
When a `packer build' is run on a config that does not define anything
to be built, the process would run normally, and only state that no
artifacts were produced after builds were run successfully.

This is misleading as we reach the end of the command without having a
proper warning that nothing was even attempted to be built.

This commit adds a warning when that happens, and leaves immediately
after.
2022-09-13 15:58:28 -04:00
Wilken Rivera facf007473 Merge branch 'boahc077-main' 2022-09-12 15:40:41 -04:00
Wilken Rivera 9899c666ad Remove unused action 2022-09-12 15:38:52 -04:00
Wilken Rivera 3bb02bf5dd Merge branch 'main' of github.com:boahc077/packer into boahc077-main 2022-09-12 15:38:12 -04:00
Lucas Bajolet 7091726ca6 Makefile: bump golangci-lint to 1.46.0 (#11977)
Since we moved to go 1.18, we should bump golangci-lint to a version
that supports it.

This change is motivated by the fact that some valid go code was being
rejected by the `typecheck` with aliased modules beign unrecognised,
namely the `hcl' module, imported from `hcl/v2'.

This should not cause any issues as the typechecker should be aware that
the package exported by `hcl/v2' is indeed called `hcl', but for some
reason, with version 0.42.0, it does not work.
2022-09-12 15:37:20 -04:00
Ashish Kurmi 1a71616e0a ci: add minimum GitHub token permissions for workflows
Signed-off-by: Ashish Kurmi <[email protected]>
2022-09-07 22:19:28 -07:00
Gary McDonald f56414afed Fix: Correct the spelling of recommended in the Installing Plugins installation instructions. (#11960) 2022-08-25 11:17:51 +02:00
Wilken Rivera ed72488e25 Bump golang.org/x/sys to address CVE-2022-29526 (#11953)
https://github.com/golang/go/issues/52313
2022-08-22 17:27:57 -04:00
Scott Ford 0a1b1435b4 Adds packer plugin for Mondoo (#11951)
Signed-off-by: Scott Ford <[email protected]>

Signed-off-by: Scott Ford <[email protected]>
2022-08-22 16:27:17 -04:00
Lucas BajoletandEd Eustace f4a2ac3b31 feat: support pwsh in powershell provisioner (#11950)
* set `pwsh` to true in config to run `pwsh.exe`, default is false.
* add docs

Co-authored-by: Ed Eustace <[email protected]>
2022-08-19 16:00:46 -04:00
Wilken Rivera 25e6546bb1 Update CHANGELOG 2022-08-18 09:58:36 -04:00
Wilken Rivera d7dca51108 Update Packer to use Go 1.18 (#11927)
This change updates Packer core Go version to 1.18. The move to Go 1.18 and not Go 1.19
is to allow the HCP Packer SDK time to upgrade to Go 1.18.

Changes Made:
* Bump go mod file to use Go 1.18
* Bump release pipeline to use Go 1.18
* Update plugin updater script to run go mod tidy for Go 1.18
* Update Linux job to use setup-go action
2022-08-18 09:41:29 -04:00
Michele Degges a0a9f594ca Set PRODUCT_VERSION arg in dockerfile (#11947)
### Description

In `actions-docker-build` we [pass](https://github.com/hashicorp/actions-docker-build/blob/05c370a26e61b06be46c5095d6e914c9f0ea4f3d/scripts/docker_build#L49) `PRODUCT_VERSION` to the docker build command. Since this was not set, the label did not populate properly which is used in a comparison to determine the `minor-latest` and `latest` docker image tags. A change merged in today (https://github.com/hashicorp/actions-docker-build/pull/25) checks for this value being set in the docker build action, and errors out if it does not exist. This will unfortunately cause build failures in this repo on merges to `main`. 

### Testing & Reproduction steps
To test locally:


How I expect reviewers to test this PR:
- same as above

### Links

Related [internal-only] post about this: https://hashicorp.atlassian.net/wiki/spaces/RELENG/pages/2416934922/August+17+2022-+Docker+Build+Failures
2022-08-17 20:45:26 -04:00
Wilken Rivera c9aab39d35 Add github.com/vmware-samples to list of template repositories (#11937)
* Add link to vmware-samples template repository

* Update ordering of community tools
2022-08-12 16:36:17 -04:00