refactor to mdx remote

This commit is contained in:
Jeff Escalante 2020-12-04 16:00:53 -05:00
parent 568916067e
commit 2de270341c
No known key found for this signature in database
GPG Key ID: 32D23C61AB5450DB
637 changed files with 6590 additions and 6560 deletions

View File

@ -1,8 +0,0 @@
{
"ignore": {
"marked": {
"versions": "0.8.2",
"reason": "IE breaks"
}
}
}

View File

@ -0,0 +1,13 @@
// This script removes the "sidebar_current" key from frontmatter, as it is
// no longer needed.
const glob = require('glob')
const path = require('path')
const fs = require('fs')
const matter = require('gray-matter')
glob.sync(path.join(__dirname, './content/**/*.mdx')).map((fullPath) => {
let { content, data } = matter.read(fullPath)
delete data.layout
fs.writeFileSync(fullPath, matter.stringify(content, data))
})

View File

@ -1,4 +0,0 @@
module.exports = {
presets: ['next/babel'],
plugins: ['import-glob-array'],
}

View File

@ -0,0 +1,22 @@
# `<MarkdownPage />`
This component renders a single page built from a separate markdown file.
## Usage
```jsx
import MarkdownPage from '@hashicorp/react-markdown-page'
import generateStaticProps from '@hashicorp/react-markdown-page/server'
export default function MyPage({ staticProps }) {
return <MarkdownPage {...staticProps} />
}
export function getStaticProps() {
return generateStaticProps({
pagePath: 'content/test-page.mdx', // resolved from project root
})
}
```
If the specified page contains front matter, the `page_title` and `description` keys will be added as the title and description the the `<head>` of the page.

View File

@ -0,0 +1,17 @@
import s from './style.module.css'
import hydrate from 'next-mdx-remote/hydrate'
import Head from 'next/head'
import HashiHead from '@hashicorp/react-head'
import Content from '@hashicorp/react-content'
export default function MarkdownPage({ head, mdxSource }) {
const content = hydrate(mdxSource)
return (
<>
<HashiHead is={Head} {...head} />
<main className={s.root}>
<Content content={content} />
</main>
</>
)
}

View File

@ -0,0 +1,27 @@
import fs from 'fs'
import path from 'path'
import renderToString from 'next-mdx-remote/render-to-string'
import markdownDefaults from '@hashicorp/nextjs-scripts/markdown'
import matter from 'gray-matter'
export default function generateGetStaticProps({
pagePath,
includesRoot = path.join(process.cwd(), 'content/partials'),
}) {
return async function getStaticProps() {
const filePath = path.join(process.cwd(), pagePath)
const fileContent = fs.readFileSync(filePath, 'utf8')
const { data, content } = matter(fileContent)
const mdxSource = await renderToString(content, {
mdxOptions: markdownDefaults({ resolveIncludes: includesRoot }),
})
return {
props: {
staticProps: {
mdxSource,
head: { title: data.page_title, description: data.description },
},
},
}
}
}

View File

@ -0,0 +1,11 @@
.root {
composes: g-grid-container from global;
margin-top: 75px;
margin-bottom: 75px;
& article {
padding-left: 0;
max-width: 875px;
margin-left: 0;
}
}

View File

@ -1,5 +1,4 @@
---
layout: index
page_title: Community vs HashiCorp Maintained Plugins
description: Packer maintains these core plugins.
---

View File

@ -1,7 +1,6 @@
---
layout: index
page_title: Download Packer Community Projects
description: |-
description:
Packer has a vibrant community of contributors who have built a number of
great tools on top of Packer. There are also quite a few projects
demonstrating the power of Packer templates.

View File

@ -48,6 +48,7 @@ builder.
@include 'packer-plugin-sdk/communicator/SSH-Agent-Auth-not-required.mdx'
# Disk Devices Configuration:
@include 'builder/alicloud/ecs/AlicloudDiskDevice-not-required.mdx'
## Basic Example

View File

@ -256,7 +256,6 @@ For debian based distributions you can setup a
file which will prevent packages installed by your provisioners from starting
services:
<Tabs>
<Tab heading="JSON">

View File

@ -226,7 +226,7 @@ configuration of `launch_block_device_mappings` will expand the root volume
```json
{
"builders": [
{
{
"type": "amazon-ebs",
"region": "us-east-1",
"source_ami": "ami-fce3c696",
@ -593,7 +593,6 @@ build {
</Tab>
</Tabs>
## Windows 2016 Sysprep Commands - For Amazon Windows AMIs Only
For Amazon Windows 2016 AMIs it is necessary to run Sysprep commands which can
@ -627,5 +626,4 @@ provisioner "powershell" {
</Tab>
</Tabs>
@include 'builders/aws-ssh-differentiation-table.mdx'

View File

@ -161,7 +161,6 @@ source "amazon-ebs" "basic-example" {
</Tab>
</Tabs>
### IAM Task or Instance Role
Finally, Packer will use credentials provided by the task's or instance's IAM

View File

@ -111,6 +111,7 @@ This method will skip all other options provided and only use the credentials th
Works with both normal user (`az login`) as well as service principal (`az login --service-principal --username APP_ID --password PASSWORD --tenant TENANT_ID`).
To enable az cli authentication, use the following:
- `"use_azure_cli_auth": true`
This mode will use the `tenant_id` and `subscription_id` from the current active az session which can be found by running: `az account show`

View File

@ -223,7 +223,7 @@ for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL
The generated variable available for this builder is:
- `ImageSha256` - When committing a container to an image, this will give the image SHA256. Because the image is not available at the provision step,
this variable is only available for post-processors.
this variable is only available for post-processors.
## Using the Artifact: Export

View File

@ -40,7 +40,6 @@ You don't need to specify an _account file_ if you are using this method. Your u
must have at least `Compute Instance Admin (v1)` & `Service Account User` roles
to use Packer succesfully.
### Running on Google Cloud
If you run the `googlecompute` Packer builder on GCE or GKE, you can
@ -50,9 +49,10 @@ Packer to authenticate to Google Cloud without having to bake in a separate
credential/authentication file.
It is recommended that you create a custom service account for Packer and assign it
`Compute Instance Admin (v1)` & `Service Account User` roles.
`Compute Instance Admin (v1)` & `Service Account User` roles.
For `gcloud`, you can run the following commands:
```shell-session
$ gcloud iam service-accounts create packer \
--project YOUR_GCP_PROJECT \
@ -98,7 +98,7 @@ straightforwarded, it is documented here.
5. Generate a JSON Key and save it in a secure location.
5. Set the Environment Variable `GOOGLE_APPLICATION_CREDENTIALS` to point to the path of the service account key.
6. Set the Environment Variable `GOOGLE_APPLICATION_CREDENTIALS` to point to the path of the service account key.
### Precedence of Authentication Methods
@ -401,7 +401,6 @@ The GCS location must be writeable by the service account of the instance that P
@include 'packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx'
### Gotchas
CentOS and recent Debian images have root ssh access disabled by default. Set

View File

@ -58,9 +58,7 @@ builder.
```json
{
"image_filter": {
"with_selector": [
"name==my-image"
],
"with_selector": ["name==my-image"],
"most_recent": true
}
}

View File

@ -37,6 +37,7 @@ are given below:
- `subnet_id` (string) - An instance is supposed to exists in an subnet, if not specified , we will create new one for you
In addition to the above configuration options, a communicator can be configured for this builder:
### Communicator Configuration
#### Optional:

View File

@ -183,7 +183,6 @@ If this is set, a few more options become available.
variables: `{{ .Username }}`, `{{ .Password }}`, `{{ .AccountID }}`,
`{{ .ImageFile }}`, and `{{ .SegmentPath }}`.
### Communicator Configuration
The `builder_communicator` has the following options:

View File

@ -74,17 +74,19 @@ can also be supplied to override the typical auto-generated key:
the user can supply search criteria, and Packer will use the the most recent image that meets
all search criteria. If no image meets all search criteria, Packer returns an error. The
following fields, if specified, must match exactly:
- `compartment_id` - The OCID of the compartment to find the image. If not specified, will use `compartment_ocid`
used for the instance.
- `display_name` - The full name of the image, e.g., `Oracle-Linux-7.8-2020.05.26-0`
- `operating_system` - The operating system used on the image, e.g., `Oracle Linux`
- `operating_system_version` - The version of the operating system on the image, e.g., `7.8`
- `shape` - A shape that the image supports. If not specified, will use `shape` used for the instance
- `compartment_id` - The OCID of the compartment to find the image. If not specified, will use `compartment_ocid`
used for the instance.
- `display_name` - The full name of the image, e.g., `Oracle-Linux-7.8-2020.05.26-0`
- `operating_system` - The operating system used on the image, e.g., `Oracle Linux`
- `operating_system_version` - The version of the operating system on the image, e.g., `7.8`
- `shape` - A shape that the image supports. If not specified, will use `shape` used for the instance
Additionally, the following field takes a regular expression:
- `display_name_search` - a regular expression for the display name, e.g., `^Oracle-Linux`. This
is ignored if `display_name` is also specified under `base_image_filter`. If no images match
the expression, Packer returns an error. If multiple images match, the most recent is used.
- `display_name_search` - a regular expression for the display name, e.g., `^Oracle-Linux`. This
is ignored if `display_name` is also specified under `base_image_filter`. If no images match
the expression, Packer returns an error. If multiple images match, the most recent is used.
`base_image_filter` is ignored if `base_image_ocid` is also specified.
@ -288,6 +290,7 @@ Build 'oracle-oci' finished.
```
## Assigning Tags and Network Security Groups to the Instance
Tags are useful for breaking down costs and usage. The keys `instance_tags`
and `instance_defined_tags` are assigned to the temporary instance,
whereas `tags` and `defined_tags` are assigned to the resulting image.
@ -297,19 +300,20 @@ to the instance. Depending on network (VCN and subnet) setup, this may be
required for Packer to successfully SSH into the instance. NSGs are a property
of the virtual network interface card (VNIC) attached to the instance, and
are listed in `nsg_ids` under `create_vnic_details`.
```json
{
"name": "base-image-{{isotime \"20060102030405\"}}",
"type": "oracle-oci",
"name": "base-image-{{isotime \"20060102030405\"}}",
"type": "oracle-oci",
"availability_domain": "aaaa:PHX-AD-1",
"base_image_ocid": "ocid1.image.oc1.iad.aaa",
"compartment_ocid": "ocid1.compartment.oc1..aaa",
"image_name": "my-image-{{isotime \"20060102030405\"}}",
"shape": "VM.Standard.E2.1",
"subnet_ocid": "ocid1.subnet.oc1.iad.aaa",
"use_private_ip": "true",
"instance_name": "packer-build-{{isotime \"20060102030405\"}}",
"instance_tags": { "testing": "yes" },
"base_image_ocid": "ocid1.image.oc1.iad.aaa",
"compartment_ocid": "ocid1.compartment.oc1..aaa",
"image_name": "my-image-{{isotime \"20060102030405\"}}",
"shape": "VM.Standard.E2.1",
"subnet_ocid": "ocid1.subnet.oc1.iad.aaa",
"use_private_ip": "true",
"instance_name": "packer-build-{{isotime \"20060102030405\"}}",
"instance_tags": { "testing": "yes" },
"instance_defined_tags": {
"Operations": {
"Team": "CostCenter",
@ -322,16 +326,18 @@ are listed in `nsg_ids` under `create_vnic_details`.
"nsg_ids": ["ocid1.networksecuritygroup.oc1.iad.aaa"]
},
"tags": {
"CreationDate": "{{isotime \"20060102 03:04:05 MST\"}}"
"CreationDate": "{{isotime \"20060102 03:04:05 MST\"}}"
}
}
```
## Base Image Filter Example
Note that `base_image_filter` gets passed as a string, then interpreted as a
regular expression. This means that all back-slashes must be doubled, e.g.,
use `\\w+` to mean `\w+`, and `\\\\` to create the regular expression equivalent
of `\\` (which will search for a literal back-slash).
```json
{
"name": "base-image-{{isotime \"20060102030405\"}}",
@ -344,3 +350,4 @@ of `\\` (which will search for a literal back-slash).
}
...
}
```

View File

@ -331,8 +331,6 @@ services:
"chmod a+x /usr/sbin/policy-rc.d"
]
},
// ...
{
"type": "shell",
"inline": ["rm -f /usr/sbin/policy-rc.d"]

View File

@ -85,7 +85,6 @@ This adds an additional layer of security, especially desirable on SecNumCloud c
You can set this certificates either by environment variables or by the static credentials inside the packer configuration file.
#### Environment variables
```bash
@ -100,11 +99,10 @@ export OUTSCALE_X509KEY="the/path/to/your/x509key"
"x509_cert_path": "the/path/to/your/x509cert",
"x509_key_path": "the/path/to/your/x509key",
"region": "cloudgouv-eu-west-1",
"type": "osc-bsu",
"type": "osc-bsu"
}
```
### Checking that system time is current
Outscale uses the current time as part of the [request signing

View File

@ -191,7 +191,7 @@ in the image's Cloud-Init settings for provisioning.
- `full_clone` (bool) - Whether to run a full or shallow clone from the base clone_vm. Defaults to `true`.
- `boot` - (string) - Override default boot order. Format example `order=virtio0;ide2;net0`.
Prior to Proxmox 6.2-15 the format was `cdn` (c:CDROM -> d:Disk -> n:Network)
Prior to Proxmox 6.2-15 the format was `cdn` (c:CDROM -> d:Disk -> n:Network)
## Example: Cloud-Init enabled Debian
@ -233,5 +233,4 @@ that there exists a Cloud-Init enabled image on the Proxmox server named
],
"description": "A template for building a base"
}
```

View File

@ -230,22 +230,23 @@ builder.
}
]
```
- `device` (string) - Bus type and bus index that the ISO will be mounted on. Can be `ideX`,
`sataX` or `scsiX`.
For `ide` the bus index ranges from 0 to 3, for `sata` form 0 to 5 and for
`scsi` from 0 to 30.
Defaults to `ide3` since `ide2` is generelly the boot drive.
Defaults to `ide3` since `ide2` is generelly the boot drive.
- `iso_file` (string) - Path to the ISO file to boot from, expressed as a
proxmox datastore path, for example
`local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso`.
Either `iso_file` OR `iso_url` must be specifed.
proxmox datastore path, for example
`local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso`.
Either `iso_file` OR `iso_url` must be specifed.
- `iso_url` (string) - URL to an ISO file to upload to Proxmox, and then
boot from. Either `iso_file` OR `iso_url` must be specifed.
boot from. Either `iso_file` OR `iso_url` must be specifed.
- `iso_storage_pool` (string) - Proxmox storage pool onto which to upload
the ISO file.
the ISO file.
- `iso_checksum` (string) - Checksum of the ISO file.
- `unmount` (bool) - If true, remove the mounted ISO from the template after finishing. Defaults to `false`.
@ -257,7 +258,7 @@ builder.
the VMs IP from. Defaults to the first non loopback interface.
- `boot` - (string) - Override default boot order. Format example `order=virtio0;ide2;net0`.
Prior to Proxmox 6.2-15 the format was `cdn` (c:CDROM -> d:Disk -> n:Network)
Prior to Proxmox 6.2-15 the format was `cdn` (c:CDROM -> d:Disk -> n:Network)
## Boot Command

View File

@ -217,4 +217,4 @@ the input file's format and file extension, and Packer will
perform a simple copy operation instead. You will also want to set
`"skip_compaction": true,` and `"disk_compression": false` to skip a final
image conversion at the end of the build. See
https://bugs.launchpad.net/qemu/+bug/1776920 for more details.
https://bugs.launchpad.net/qemu/+bug/1776920 for more details.

View File

@ -202,7 +202,6 @@ delay of 100ms between groups. The delay alleviates issues with latency and CPU
contention. If you notice missing keys, you can tune this delay by specifying
"boot_keygroup_interval" in your Packer template, for example:
<Tabs>
<Tab heading="JSON">

View File

@ -248,4 +248,3 @@ directory of the SSH user.
@include 'builder/virtualbox/common/VBoxManageConfig.mdx'
@include 'builder/virtualbox/common/VBoxManageConfig-not-required.mdx'

View File

@ -131,6 +131,7 @@ necessary for this build to succeed and can be found further down the page.
@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig-not-required.mdx'
### CD configuration
@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx'
### Shutdown configuration

View File

@ -18,8 +18,8 @@ This builder clones VMs from existing templates.
- VMware Player is not required.
- It uses the official vCenter API, and does not require ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor)
- This builder is supported for vSphere version 6.5 and greater. Builds on lower
versions may work, but some configuration options may throw errors because they
do not exist in the older versions of the vSphere API.
versions may work, but some configuration options may throw errors because they
do not exist in the older versions of the vSphere API.
## Examples

View File

@ -19,8 +19,8 @@ starts from an ISO file and creates new VMs from scratch.
- VMware Player is not required.
- It uses the official vCenter API, and does not require ESXi host [modification](/docs/builders/vmware-iso#building-on-a-remote-vsphere-hypervisor)
- This builder is supported for vSphere version 6.5 and greater. Builds on lower
versions may work, but some configuration options may throw errors because they
do not exist in the older versions of the vSphere API.
versions may work, but some configuration options may throw errors because they
do not exist in the older versions of the vSphere API.
## Examples

View File

@ -130,7 +130,6 @@ In configuration directives the following variables are available:
- `SourceImageFamily` - The source image family (for example `ubuntu-1604-lts`).
- `SourceImageFolderID` - The folder ID where source image located (for example `standard-images`).
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of

View File

@ -38,9 +38,9 @@ my-template.json
## Options
- `-check` - Checks if the input is formatted. Exit status will be 0 if all
input is properly formatted and non-zero otherwise.
input is properly formatted and non-zero otherwise.
- `-diff` - Display diffs of any formatting change
- `-write=false` - Don't write formatting changes to source files
(always disabled if using -check)
(always disabled if using -check)

View File

@ -56,14 +56,15 @@ locals {
`hcl2_upgrade` will do its best to transform your go _template calls_ to HCL2,
here is the list of calls that should get transformed:
- ```{{ user `my_var` }}``` becomes ```${var.my_var}```.
- ```{{ env `my_var` }}``` becomes ```${var.my_var}```. Packer HCL2 supports
environment variables through input variables. See
[docs](http://packer.io/docs/from-1.5/variables#environment-variables)
for more info.
- ```{{ timestamp }}``` becomes ```${local.timestamp}```, the local variable
will be created for all generated files.
- ```{{ build `ID` }}``` becomes ```${build.ID}```.
- `` {{ user `my_var` }} `` becomes `${var.my_var}`.
- `` {{ env `my_var` }} `` becomes `${var.my_var}`. Packer HCL2 supports
environment variables through input variables. See
[docs](http://packer.io/docs/from-1.5/variables#environment-variables)
for more info.
- `{{ timestamp }}` becomes `${local.timestamp}`, the local variable
will be created for all generated files.
- `` {{ build `ID` }} `` becomes `${build.ID}`.
The rest of the calls should remain go template calls for now, this will be
improved over time.

View File

@ -61,10 +61,9 @@ The SSH communicator has the following options:
@include "packer-plugin-sdk/communicator/SSH-not-required.mdx"
~> Note: SSH communicator options: `ssh_keypair_name`, `ssh_agent_auth`,
`temporary_key_pair_name` and `ssh_private_key_file` are also supported by
the communicator. But they may not be supported for every builder. Please check
the builder specific documentation for additional SSH supported options.
`temporary_key_pair_name` and `ssh_private_key_file` are also supported by
the communicator. But they may not be supported for every builder. Please check
the builder specific documentation for additional SSH supported options.
### SSH Communicator Details

View File

@ -90,6 +90,6 @@ about and see some examples of how to use them.
### Related
* The [`post-processors` block](/docs/from-1.5/blocks/build/post-processor)
- The [`post-processors` block](/docs/from-1.5/blocks/build/post-processor)
allows to define one or more chain of `post-processor`s that will take the
output from the build and provision steps.

View File

@ -31,7 +31,7 @@ build {
keep_input_artifact = true # keep the artifact
}
}
}
```

View File

@ -14,7 +14,7 @@ description: |-
-> **Note:** The Packer block is only available in Packer v1.6.5 and later.
The `packer` configuration block type is used to configure some
behaviors of Packer itself, such as the minimum required Packer version needed to
behaviors of Packer itself, such as the minimum required Packer version needed to
apply your configuration.
## Packer Block Syntax
@ -48,7 +48,6 @@ Use Packer version constraints in a collaborative environment to
ensure that everyone is using a specific Packer version, or using at least
a minimum Packer version that has behavior expected by the configuration.
## Version Constraints
Anywhere that Packer lets you specify a range of acceptable versions for

Some files were not shown because too many files have changed in this diff Show More