From d0512c6edd07d564357bb72d474477dc2a786d4f Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Tue, 23 Mar 2021 14:14:59 -0400 Subject: [PATCH 1/6] docs/amazon: Updated generated docs --- .../builder/amazon/common/AccessConfig-not-required.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/content/partials/builder/amazon/common/AccessConfig-not-required.mdx b/website/content/partials/builder/amazon/common/AccessConfig-not-required.mdx index c0fee09e1..f002ac703 100644 --- a/website/content/partials/builder/amazon/common/AccessConfig-not-required.mdx +++ b/website/content/partials/builder/amazon/common/AccessConfig-not-required.mdx @@ -42,7 +42,7 @@ probably don't need it. This will also be read from the AWS_SESSION_TOKEN environmental variable. -- `vault_aws_engine` (VaultAWSEngineOptions) - Get credentials from Hashicorp Vault's aws secrets engine. You must +- `vault_aws_engine` (VaultAWSEngineOptions) - Get credentials from HashiCorp Vault's aws secrets engine. You must already have created a role to use. For more information about generating credentials via the Vault engine, see the [Vault docs.](https://www.vaultproject.io/api/secret/aws#generate-credentials) From 5e17dbeff299df988052d6af4d977b1f1490a58d Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Tue, 23 Mar 2021 14:39:45 -0400 Subject: [PATCH 2/6] Fix up regex in test --- hcl2template/function/datetime_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hcl2template/function/datetime_test.go b/hcl2template/function/datetime_test.go index 1d90ce53e..fca279e84 100644 --- a/hcl2template/function/datetime_test.go +++ b/hcl2template/function/datetime_test.go @@ -40,7 +40,7 @@ func TestLegacyIsotime_inputs(t *testing.T) { }, { cty.StringVal("Mon Jan 02, 2006"), - `^(Mon|Tues|Wed|Thu|Fri|Sat|Sun){1} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec){1} \d{2}, \d{4}$`, + `^(Mon|Tue|Wed|Thu|Fri|Sat|Sun){1} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec){1} \d{2}, \d{4}$`, }, } From 89931d0f2ac530bd51faea33f771ce649277a161 Mon Sep 17 00:00:00 2001 From: Zachary Shilton <4624598+zchsh@users.noreply.github.com> Date: Tue, 23 Mar 2021 16:06:50 -0400 Subject: [PATCH 3/6] website: fixes and tweaks for plugin docs (#10812) * website: sort nested plugin docs files * website: allow ignored .md files in plugin docs folders * website: allow plugin docs/README.md only as extra file * website: fix issue with latest link for plugin docs.zip --- .../utils/fetch-plugin-docs.js | 5 +++- .../utils/resolve-nav-data.js | 27 ++++++++++++++----- .../utils/validate-plugin-docs-files.js | 9 ++++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/website/components/remote-plugin-docs/utils/fetch-plugin-docs.js b/website/components/remote-plugin-docs/utils/fetch-plugin-docs.js index ee4238b3a..d86b725f1 100644 --- a/website/components/remote-plugin-docs/utils/fetch-plugin-docs.js +++ b/website/components/remote-plugin-docs/utils/fetch-plugin-docs.js @@ -13,7 +13,10 @@ const parseDocsZip = require('./parse-docs-zip') // docs files were missing or invalid, with a path to resolution async function fetchDocsFiles({ repo, tag }) { // If there's a docs.zip asset, we'll prefer that - const docsZipUrl = `https://github.com/${repo}/releases/download/${tag}/docs.zip` + const docsZipUrl = + tag === 'latest' + ? `https://github.com/${repo}/releases/latest/download/docs.zip` + : `https://github.com/${repo}/releases/download/${tag}/docs.zip` const docsZipResponse = await fetch(docsZipUrl, { method: 'GET' }) const hasDocsZip = docsZipResponse.status === 200 // Note: early return! diff --git a/website/components/remote-plugin-docs/utils/resolve-nav-data.js b/website/components/remote-plugin-docs/utils/resolve-nav-data.js index d5d21b7e3..f1a65647a 100644 --- a/website/components/remote-plugin-docs/utils/resolve-nav-data.js +++ b/website/components/remote-plugin-docs/utils/resolve-nav-data.js @@ -95,16 +95,19 @@ async function mergeRemotePlugins(remotePluginsFile, navData) { // console.log(JSON.stringify(routesWithPlugins, null, 2)) // Also, sort the child routes so the order is alphabetical routesWithPlugins.sort((a, b) => { + // ensure casing does not affect ordering + const aTitle = a.title.toLowerCase() + const bTitle = b.title.toLowerCase() // (exception: "Overview" comes first) - if (a.title == 'Overview') return -1 - if (b.title === 'Overview') return 1 + if (aTitle === 'overview') return -1 + if (bTitle === 'overview') return 1 // (exception: "Community-Supported" comes last) - if (a.title == 'Community-Supported') return 1 - if (b.title === 'Community-Supported') return -1 + if (aTitle === 'community-supported') return 1 + if (bTitle === 'community-supported') return -1 // (exception: "Custom" comes second-last) - if (a.title == 'Custom') return 1 - if (b.title === 'Custom') return -1 - return a.title < b.title ? -1 : a.title > b.title ? 1 : 0 + if (aTitle === 'custom') return 1 + if (bTitle === 'custom') return -1 + return aTitle < bTitle ? -1 : aTitle > bTitle ? 1 : 0 }) // return n return { ...n, routes: routesWithPlugins } @@ -159,6 +162,16 @@ async function resolvePluginEntryDocs(pluginConfigEntry) { } }) // + navNodes.sort((a, b) => { + // ensure casing does not affect ordering + const aTitle = a.title.toLowerCase() + const bTitle = b.title.toLowerCase() + // (exception: "Overview" comes first) + if (aTitle === 'overview') return -1 + if (bTitle === 'overview') return 1 + return aTitle < bTitle ? -1 : aTitle > bTitle ? 1 : 0 + }) + // const navNodesByComponent = navNodes.reduce((acc, navLeaf) => { const componentType = navLeaf.remoteFile.filePath.split('/')[1] if (!acc[componentType]) acc[componentType] = [] diff --git a/website/components/remote-plugin-docs/utils/validate-plugin-docs-files.js b/website/components/remote-plugin-docs/utils/validate-plugin-docs-files.js index e846092a9..d2e094919 100644 --- a/website/components/remote-plugin-docs/utils/validate-plugin-docs-files.js +++ b/website/components/remote-plugin-docs/utils/validate-plugin-docs-files.js @@ -13,15 +13,22 @@ const COMPONENT_TYPES = [ // with at least one .mdx file within it. function validatePluginDocsFiles(filePaths) { function isValidPath(filePath) { + // Allow the docs root folder const isDocsRoot = filePath === 'docs/' + // Allow component folders const isComponentRoot = COMPONENT_TYPES.reduce((acc, type) => { return acc || filePath === `docs/${type}/` }, false) + // Allow .mdx files in component folders const isComponentMdx = COMPONENT_TYPES.reduce((acc, type) => { const mdxPathRegex = new RegExp(`^docs/${type}/(.*).mdx$`) return acc || mdxPathRegex.test(filePath) }, false) - const isValidPath = isDocsRoot || isComponentRoot || isComponentMdx + // Allow docs/README.md files + const isDocsReadme = filePath == 'docs/README.md' + // Combine all allowed types + const isValidPath = + isDocsRoot || isComponentRoot || isComponentMdx || isDocsReadme return isValidPath } const invalidPaths = filePaths.filter((f) => !isValidPath(f)) From 1d5308062507c3b4469b034c080019fac0722901 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Tue, 23 Mar 2021 16:44:21 -0400 Subject: [PATCH 4/6] Update script to exit on immediate failure (#10815) --- scripts/build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index e16152e6f..337596313 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -126,7 +126,7 @@ if [ -n "${PACKER_DEV+x}" ]; then fi export CGO_ENABLED=0 -set +e + ${GOX:?command not found} \ -os="${XC_OS:-$ALL_XC_OS}" \ -arch="${XC_ARCH:-$ALL_XC_ARCH}" \ @@ -134,7 +134,6 @@ ${GOX:?command not found} \ -ldflags "${GOLDFLAGS}" \ -output "pkg/{{.OS}}_{{.Arch}}/packer" \ . -set -e # trim GOPATH to first element IFS="${PATHSEP}" From 82eedc8f0204b94a86cce1d27333fd75e2bcb929 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Tue, 23 Mar 2021 17:02:44 -0400 Subject: [PATCH 5/6] Update packer docs to latest (#10814) --- website/data/docs-remote-plugins.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/data/docs-remote-plugins.json b/website/data/docs-remote-plugins.json index ab7aecb94..b3199e499 100644 --- a/website/data/docs-remote-plugins.json +++ b/website/data/docs-remote-plugins.json @@ -3,6 +3,6 @@ "title": "Docker", "path": "docker", "repo": "hashicorp/packer-plugin-docker", - "version": "v0.0.4" + "version": "latest" } ] From 70ceed111095d041521614cab87c98f71812bd1a Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Tue, 23 Mar 2021 17:41:43 -0400 Subject: [PATCH 6/6] Update vendor modules --- go.mod | 1 + go.sum | 1 + vendor/modules.txt | 2 ++ 3 files changed, 4 insertions(+) diff --git a/go.mod b/go.mod index 415c54661..a9155c4ee 100644 --- a/go.mod +++ b/go.mod @@ -64,6 +64,7 @@ require ( github.com/mitchellh/cli v1.1.0 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed + github.com/mitchellh/gox v1.0.1 // indirect github.com/mitchellh/mapstructure v1.4.0 github.com/mitchellh/panicwrap v1.0.0 github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784 diff --git a/go.sum b/go.sum index 6452de5bd..288453a78 100644 --- a/go.sum +++ b/go.sum @@ -529,6 +529,7 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= diff --git a/vendor/modules.txt b/vendor/modules.txt index 49143ddb0..cda1c5dee 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -571,6 +571,8 @@ github.com/mitchellh/go-testing-interface github.com/mitchellh/go-vnc # github.com/mitchellh/go-wordwrap v1.0.0 github.com/mitchellh/go-wordwrap +# github.com/mitchellh/gox v1.0.1 +## explicit # github.com/mitchellh/iochan v1.0.0 github.com/mitchellh/iochan # github.com/mitchellh/mapstructure v1.4.0