Skip to content

Commit

Permalink
Packer Integrations (#1851)
Browse files Browse the repository at this point in the history
* Adds in Packer config

* Prepare Packer Plugin Redirects (#2100)

* Redirects setup WIP

* Adds Azure

* Adds chef

* Adds CloudStack

* Adds converge & digitalocean

* Adds Docker

* Adds External

* Adds git

* Adds GridScale

* Adds a few integrations

* Adds some more integrations

* Adds a few more integrations

* Some more integrations

* qemu, salt

* Few more integrations

* Triton, UCloud, UpCloud

* Vagrant, VirtualBox

* vmware, volcengine

* VmWare, Vultr, Yandex

* Enable redirects

* Adds GCP Redirects

* Enable HashiCups redirects

* Adds libvirt

* Just redirect archived plugins to GitHub repos

* Adds Plugin landing page redirect to Integrations

* Remove Plugins from Sidebar / Nav

* Update orgs, disable non-hashicorp mirations

* Add back plugins to nav so it builds appropriately

* Shut off migrated Packer Plugins

* Update GitHub link to link to docs from .web-docs

* Also search integrations against slug

* Introduce index to sidecar items key

* Apply suggestions from code review
  • Loading branch information
Brandon Romano authored Aug 31, 2023
1 parent 044b580 commit ba9d120
Show file tree
Hide file tree
Showing 8 changed files with 976 additions and 8 deletions.
896 changes: 896 additions & 0 deletions build-libs/integration-packer-redirects.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions build-libs/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { getTutorialRedirects } = require('./tutorial-redirects')
const {
integrationMultipleComponentRedirects,
} = require('./integration-multiple-component-redirects')
const { packerPluginRedirects } = require('./integration-packer-redirects')

require('isomorphic-unfetch')

Expand Down Expand Up @@ -297,6 +298,11 @@ async function buildDevPortalRedirects() {
* Further details in the file this is imported from.
*/
...integrationMultipleComponentRedirects,
/**
* Redirects from our former Packer Plugin library to our
* new integrations library for Packer,
*/
...packerPluginRedirects,
]
}

Expand Down
2 changes: 1 addition & 1 deletion config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"clientToken": "pubd5cf774aa1cbbd001accd50cb463925b",
"service": "non-prod.developer.hashicorp.com"
},
"product_slugs_with_integrations": ["vault", "waypoint", "nomad"]
"product_slugs_with_integrations": ["vault", "waypoint", "nomad", "packer"]
},
"learn": {
"max_static_paths": 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import type { OutlineLinkItem } from 'components/outline-nav/types'
function OutlineListItems({ items }: { items: OutlineLinkItem[] }) {
return (
<>
{items.map((item: OutlineLinkItem) => {
{items.map((item: OutlineLinkItem, index: number) => {
return (
<li key={item.url}>
<li key={`${index}-${item.url}`}>
{'items' in item ? (
<OutlineLinkWithNesting {...item} />
) : (
Expand Down
7 changes: 5 additions & 2 deletions src/data/packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"expirationDate": ""
},
"version": "1.7.10",
"basePaths": ["docs", "guides", "intro", "plugins", "downloads"],
"basePaths": ["docs", "guides", "intro", "downloads"],
"rootDocsPaths": [
{
"iconName": "docs",
Expand All @@ -46,5 +46,8 @@
"name": "Plugins",
"path": "plugins"
}
]
],
"integrationsConfig": {
"description": "A curated collection of official, partner, and community Packer Integrations."
}
}
11 changes: 10 additions & 1 deletion src/layouts/product-integration-layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,16 @@ export default function ProductIntegrationLayout({
{
text: 'GitHub',
href: integration.subdirectory
? `${integration.repo_url}/tree/main${integration.subdirectory}`
? `${
integration.repo_url
}/tree/main${integration.subdirectory.replace(
// Some Packer Plugins have an exception where we compile their
// `docs` folder to `.web-docs` to be integrations-format-compliant.
// The directory in which we want to redirect users here is actually
// simply just `docs`, as that's where users would go to make edits.
'.web-docs',
'docs'
)}`
: integration.repo_url,
icon: <IconGithub16 />,
},
Expand Down
55 changes: 54 additions & 1 deletion src/views/packer-plugins/utils/resolve-nav-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,52 @@ import { resolvePluginDocs } from '@hashicorp/platform-packer-plugins'
import fetchGithubFile from 'lib/fetch-github-file'
import { isDeployPreview } from 'lib/env-checks'

// An array of plugins that have been migrated over from
// the Plugin Portal to the Integrations library. Adding
// a plugins 'path' to this array will make it so it will
// no longer render in the Plugin portal.
//
// This is a little duplicative of our redirects, but really
// we only need this to work until we migrate the remaining
// plugins to the integrations library before we can delete
// this entire Packer Plugin portion of the codebase.
const migratedPlugins = [
'alicloud',
'amazon',
'ansible',
'azure',
'chef',
'cloudstack',
'converge',
'docker',
'googlecompute',
'hashicups',
'hetzner-cloud',
'hyperone',
'hyperv',
'inspec',
'jdcloud',
'lxc',
'lxd',
'ncloud',
'oneandone',
'openstack',
'oracle',
'parallels',
'profitbricks',
'proxmox',
'puppet',
'qemu',
'salt',
'tencentcloud',
'triton',
'vagrant',
'virtualbox',
'vmware',
'vsphere',
'yandex',
]

/**
* Resolves nav-data from file with
* resolution of remote plugin docs entries
Expand Down Expand Up @@ -68,7 +114,14 @@ export async function appendRemotePluginsNavData(
})
}

const pluginEntries = JSON.parse(remotePluginsContent)
const pluginEntries = JSON.parse(remotePluginsContent).filter((entry) => {
// Filter out integrations
if (migratedPlugins.includes(entry.path)) {
return false
}
return true
})

// Add navData for each plugin's component.
// Note that leaf nodes include a remoteFile property object with the full MDX fileString
const pluginEntriesWithFiles = await resolvePluginDocs(pluginEntries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const getFilteredIntegrations = ({
.includes(filterQuery.toLowerCase()) ||
integration.organization.slug
.toLowerCase()
.includes(filterQuery.toLowerCase())
.includes(filterQuery.toLowerCase()) ||
integration.slug.toLowerCase().includes(filterQuery.toLowerCase())
)
})
}
Expand Down

1 comment on commit ba9d120

@vercel
Copy link

@vercel vercel bot commented on ba9d120 Aug 31, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.