guides section nav

This commit is contained in:
Jeff Escalante 2020-03-24 18:36:27 -04:00
parent 2330936035
commit 02e297b034
No known key found for this signature in database
GPG Key ID: 32D23C61AB5450DB
20 changed files with 86 additions and 50 deletions

View File

@ -5,4 +5,31 @@
// - All directories must have an "index.mdx" file to serve as
// the landing page for the category
export default []
export default [
{
category: 'hcl',
content: ['from-json-v1', 'variables', 'component-object-spec']
},
{
category: 'automatic-operating-system-installs',
content: ['autounattend_windows', 'preseed_ubuntu']
},
{
category: 'workflow-tips-and-tricks',
content: [
'isotime-template-function',
'veewee-to-packer',
'use-packer-with-comment'
]
},
{
category: 'packer-on-cicd',
content: [
'build-image-in-cicd',
'build-virtualbox-image',
'upload-images-to-artifact',
'trigger-tfe'
]
}
]

View File

@ -5,6 +5,11 @@ export default [
url: '/intro',
type: 'inbound'
},
{
text: 'Guides',
url: '/guides',
type: 'inbound'
},
{
text: 'Docs',
url: '/docs',

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: automatic-operating-system-installs-unattended-installation-windows
page_title: Unattended Windows Installation
sidebar_title: 'Unattended Installation for Windows'
description: |-
Learn how to use an autounattend file to automatically answer installation
questions and enable Packer to connect to your windows instnace.
@ -69,13 +69,11 @@ disconnections can fail a build.
The chef-maintained bento boxes are a great example of a windows build that
sets up openssh as part of the unattended installation so that Packer can
connect using the ssh communicator. They functioning answer files for every
modern Windows version.
https://github.com/chef/bento/tree/master/packer_templates/windows/answer_files
modern Windows version can be found [here](https://github.com/chef/bento/tree/master/packer_templates/windows/answer_files).
Stefan Scherer's packer-windows repo is a great example of windows builds that
set up WinRM as part of the unattended installation so that Packer can connect
using the winrm communicator:
https://github.com/StefanScherer/packer-windows
Stefan Scherer's [packer-windows repo](https://github.com/StefanScherer/packer-windows)
is a great example of windows builds that set up WinRM as part of the unattended
installation so that Packer can connect using the winrm communicator:
```json
{

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: automatic-operating-system-installs
page_title: Automatic OS Installs
sidebar_title: 'Automatic OS Installs'
description: |-
Learn how to use preseed, kickstart, and autounattend files to automatically
answer installation questions and enable Packer to connect to your instnace.

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: automatic-operating-system-installs-unattended-installation-debian
page_title: Unattended Debian/Ubuntu Installation
sidebar_title: 'Unattended Installation for Debian'
description: |-
Learn how to use a preseed file to automatically answer installation
questions and enable Packer to connect to your Debian instnace.

View File

@ -1,7 +1,7 @@
---
layout: guides
page_title: Generating code for config spec.
sidebar_current: hcl-component-object-spec
sidebar_title: 'Making a plugin HCL2 enabled'
description: Learn how to generate the HCL2 configuration of your component easily.
---
@ -33,11 +33,11 @@ follow to make it HCL2 enabled:
- Now we only need to make Builder implement the interface by adding the
following snippet:
```go
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
```
```go
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
```
From now on every time you add or change a field of Config you will need to
run the `go generate` command again.
From now on every time you add or change a field of Config you will need to
run the `go generate` command again.
A good example of this is the [Config struct of the amazon-ebs builder](https://github.com/hashicorp/packer/blob/master/builder/amazon/ebs/builder.go)

View File

@ -1,7 +1,7 @@
---
layout: guides
page_title: Transforming Packer v1 files for Packer v1.5.0
sidebar_current: hcl-from-json-v1
sidebar_title: 'From JSON v1'
description: |-
Learn how to manually move from a Packer v1 working JSON build file to a
working v1.5.0 HCL file.
@ -101,22 +101,24 @@ All fields of builders, provisioners and post-processors have a 1:1
correspondance except for the following:
- builders:
- aws ami_block_device_mappings
- aws launch_block_device_mappings
- aws run_volume_tags
- alicloud image_disk_mappings
- osc omi_block_device_mappings
- osc launch_block_device_mappings
- proxmox network_adapters
- proxmox disks
- tencentcloud data_disks
- ucloud image_copy_to_mappings
* provisioner:
* converge module_dirs
- aws ami_block_device_mappings
- aws launch_block_device_mappings
- aws run_volume_tags
- alicloud image_disk_mappings
- osc omi_block_device_mappings
- osc launch_block_device_mappings
- proxmox network_adapters
- proxmox disks
- tencentcloud data_disks
- ucloud image_copy_to_mappings
* post-processor:
* alicloud-import image_disk_mappings
- provisioner:
- converge module_dirs
- post-processor:
- alicloud-import image_disk_mappings
One could think that these are defined as "arrays of blocks" - they are in fact
repeatable blocks with the same identifier. For example:

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: hcl
page_title: Getting started configuring Packer with HCL2 files
sidebar_title: 'HCL guides'
---
# Introduction to Packer HCL2

View File

@ -1,7 +1,7 @@
---
layout: guides
page_title: Input and Local Variables guide
sidebar_current: hcl-configuration-variables
sidebar_title: 'Variables'
description: |-
This page introduces input variables and local variables as a way to
parameterize a configuration.

View File

@ -1,6 +1,5 @@
---
layout: guides
sidebar_current: guides
page_title: Guides
description: |-
Welcome to the Packer guides. If you are just getting started with Packer,

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: guides-packer-on-cicd-build-image
page_title: Build Images in CI/CD
sidebar_title: 'Build Images in CI/CD'
---
# Build Images in CI/CD

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: guides-packer-on-cicd-build-virtualbox
page_title: Build a VirtualBox Image with Packer in TeamCity
sidebar_title: 'Build a VirtualBox Image with Packer in TeamCity'
---
# Build a VirtualBox Image with Packer in TeamCity
@ -109,11 +109,11 @@ In TeamCity Server, create a new build. To use the upstream Bento repository,
we'll choose _From a repository URL_, and enter
`https://github.com/chef/bento.git` as the **Repository URL**.
![TeamCity screenshot: New Build](/assets/images/guides/teamcity_create_project_from_url-1.png)
![TeamCity screenshot: New Build](/img/guides/teamcity_create_project_from_url-1.png)
Click **Proceed**.
![TeamCity screenshot: New Build](/assets/images/guides/teamcity_create_project_from_url-2.png)
![TeamCity screenshot: New Build](/img/guides/teamcity_create_project_from_url-2.png)
And **Proceed** again.
@ -122,7 +122,7 @@ steps manually_. For the _runner type_, pick **Command Line**, and enter the
following values. Make sure to click _Show advanced options_, as we need to set
the working directory.
![TeamCity screenshot: Build Step](/assets/images/guides/teamcity_build_configuration.png)
![TeamCity screenshot: Build Step](/img/guides/teamcity_build_configuration.png)
This will use the `build` command in Packer to build the image defined in
`ubuntu/ubuntu-16.04-amd64.json`. It assumes that the VCS repository you're
@ -142,8 +142,8 @@ by pressing “Run”.
The new run should be triggered and the virtual box image will be built.
![TeamCity screenshot: Build log](/assets/images/guides/teamcity_build_log.png)
![TeamCity screenshot: Build log](/img/guides/teamcity_build_log.png)
Once complete, the build status should be updated to complete and successful.
![TeamCity screenshot: Build log complete](/assets/images/guides/teamcity_build_log_complete.png)
![TeamCity screenshot: Build log complete](/img/guides/teamcity_build_log_complete.png)

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: guides-packer-on-cicd-index
page_title: Build Immutable Infrastructure with Packer in CI/CD
sidebar_title: 'Build Immutable Infrastructure with Packer in CI/CD'
---
# Build Immutable Infrastructure with Packer in CI/CD
@ -12,6 +12,6 @@ implemented with a variety of technologies. The goal of this guide is to show
how this workflow can be fully automated using Packer for building images from
a continuous integration/continuous deployment (CI/CD) pipeline.
1. [Build Images using Packer in CI/CD](/guides/packer-on-cicd/build-image-in-cicd.html)
2. [Upload the new image to S3](/guides/packer-on-cicd/upload-images-to-artifact.html) for future deployment or use during development
3. [Create new Terraform Enterprise runs](/guides/packer-on-cicd/trigger-tfe.html) to provision new instances with the images
1. [Build Images using Packer in CI/CD](/guides/packer-on-cicd/build-image-in-cicd)
2. [Upload the new image to S3](/guides/packer-on-cicd/upload-images-to-artifact) for future deployment or use during development
3. [Create new Terraform Enterprise runs](/guides/packer-on-cicd/trigger-tfe) to provision new instances with the images

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: guides-packer-on-cicd-trigger-tfe-run
page_title: Trigger Terraform Enterprise runs
sidebar_title: 'Trigger Terraform Enterprise runs'
---
# Create Terraform Enterprise Runs

View File

@ -1,7 +1,7 @@
---
layout: guides
sidebar_current: guides-packer-on-cicd-upload-image-to-artifact-store
page_title: Upload VirtualBox Image to S3
sidebar_title: 'Upload a VirtualBox Image to S3'
---
# Upload VirtualBox Image to S3

View File

@ -2,6 +2,7 @@
layout: guides
sidebar_current: workflow-tips-and-tricks
page_title: Tips and Tricks
sidebar_title: 'Workflow Tips and Tricks'
description: |-
The guides stored in this section are miscellanious tips and tricks that might
make your experience of using Packer easier

View File

@ -2,6 +2,7 @@
layout: guides
sidebar_current: workflow-tips-and-tricks-isotime-template-function
page_title: Using the isotime template function - Guides
sidebar_title: 'Isotime Template Function'
description: |-
It can be a bit confusing to figure out how to format your isotime using the
golang reference date string. Here is a small guide and some examples.

View File

@ -2,16 +2,17 @@
layout: guides
sidebar_current: workflow-tips-and-tricks-use-packer-with-comment
page_title: Use jq and Packer to comment your templates - Guides
sidebar_title: 'Use jq to strip comments from a Packer template'
description: |-
You can add detailed comments beyond the root-level underscore-prefixed field
supported by Packer, and remove them using jq.
---
#How to use jq to strip unsupported comments from a Packer template
# How to use jq to strip unsupported comments from a Packer template
One of the biggest complaints we get about packer is that json doesn't use comments. We're in the process of moving to HCL2, the same config language used by Terraform, which does allow comments. But in the meantime, you can add detailed comments beyond the root-level underscore-prefixed field supported by Packer, and remove them using jq.
Let's say we have a file named commented_template.json
Let's say we have a file named `commented_template.json`
```json
{
@ -65,7 +66,7 @@ you normally would.
If your install of jq does not have the walk function and you get an error like
```
```shell
jq: error: walk/1 is not defined at <top-level>,
```

View File

@ -2,6 +2,7 @@
layout: guides
sidebar_current: workflow-tips-and-tricks-guides-veewee-to-packer
page_title: Convert Veewee Definitions to Packer Templates - Guides
sidebar_title: 'Veewee to Packer'
description: |-
If you are or were a user of Veewee, then there is an official tool called
veewee-to-packer that will convert your Veewee definition into an equivalent

View File

@ -1 +1,2 @@
- `/intro/getting-started/install` redirects to `/intro/getting-started`
- `/guides/hcl` folders with only index changed to named individual files