From 02e297b03411588b963b68a3a0ee801ca4e010e9 Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Tue, 24 Mar 2020 18:36:27 -0400 Subject: [PATCH] guides section nav --- website/data/guides-navigation.js | 29 ++++++++++++++- website/data/subnav.js | 5 +++ .../autounattend_windows.mdx | 12 +++---- .../index.mdx | 2 +- .../preseed_ubuntu.mdx | 2 +- .../index.mdx => component-object-spec.mdx} | 12 +++---- .../index.mdx => from-json-v1.mdx} | 36 ++++++++++--------- website/pages/guides/hcl/index.mdx | 2 +- .../{variables/index.mdx => variables.mdx} | 2 +- website/pages/guides/index.mdx | 1 - .../packer-on-cicd/build-image-in-cicd.mdx | 2 +- .../packer-on-cicd/build-virtualbox-image.mdx | 12 +++---- website/pages/guides/packer-on-cicd/index.mdx | 8 ++--- .../guides/packer-on-cicd/trigger-tfe.mdx | 2 +- .../upload-images-to-artifact.mdx | 2 +- .../guides/workflow-tips-and-tricks/index.mdx | 1 + .../isotime-template-function.mdx | 1 + .../use-packer-with-comment.mdx | 7 ++-- .../veewee-to-packer.mdx | 1 + website/scripts/changelog.md | 1 + 20 files changed, 88 insertions(+), 52 deletions(-) rename website/pages/guides/hcl/{component-object-spec/index.mdx => component-object-spec.mdx} (83%) rename website/pages/guides/hcl/{from-json-v1/index.mdx => from-json-v1.mdx} (90%) rename website/pages/guides/hcl/{variables/index.mdx => variables.mdx} (99%) diff --git a/website/data/guides-navigation.js b/website/data/guides-navigation.js index 4e57f80a7..16f203c9e 100644 --- a/website/data/guides-navigation.js +++ b/website/data/guides-navigation.js @@ -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' + ] + } +] diff --git a/website/data/subnav.js b/website/data/subnav.js index 1e8b908f7..c6980e700 100644 --- a/website/data/subnav.js +++ b/website/data/subnav.js @@ -5,6 +5,11 @@ export default [ url: '/intro', type: 'inbound' }, + { + text: 'Guides', + url: '/guides', + type: 'inbound' + }, { text: 'Docs', url: '/docs', diff --git a/website/pages/guides/automatic-operating-system-installs/autounattend_windows.mdx b/website/pages/guides/automatic-operating-system-installs/autounattend_windows.mdx index 13aae4fca..3314087e7 100644 --- a/website/pages/guides/automatic-operating-system-installs/autounattend_windows.mdx +++ b/website/pages/guides/automatic-operating-system-installs/autounattend_windows.mdx @@ -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 { diff --git a/website/pages/guides/automatic-operating-system-installs/index.mdx b/website/pages/guides/automatic-operating-system-installs/index.mdx index 8307e2af7..349eef39c 100644 --- a/website/pages/guides/automatic-operating-system-installs/index.mdx +++ b/website/pages/guides/automatic-operating-system-installs/index.mdx @@ -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. diff --git a/website/pages/guides/automatic-operating-system-installs/preseed_ubuntu.mdx b/website/pages/guides/automatic-operating-system-installs/preseed_ubuntu.mdx index f14383aa9..d3ce741c7 100644 --- a/website/pages/guides/automatic-operating-system-installs/preseed_ubuntu.mdx +++ b/website/pages/guides/automatic-operating-system-installs/preseed_ubuntu.mdx @@ -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. diff --git a/website/pages/guides/hcl/component-object-spec/index.mdx b/website/pages/guides/hcl/component-object-spec.mdx similarity index 83% rename from website/pages/guides/hcl/component-object-spec/index.mdx rename to website/pages/guides/hcl/component-object-spec.mdx index 0e545aff8..3957b94d9 100644 --- a/website/pages/guides/hcl/component-object-spec/index.mdx +++ b/website/pages/guides/hcl/component-object-spec.mdx @@ -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) diff --git a/website/pages/guides/hcl/from-json-v1/index.mdx b/website/pages/guides/hcl/from-json-v1.mdx similarity index 90% rename from website/pages/guides/hcl/from-json-v1/index.mdx rename to website/pages/guides/hcl/from-json-v1.mdx index e264d5772..d0c4efb7d 100644 --- a/website/pages/guides/hcl/from-json-v1/index.mdx +++ b/website/pages/guides/hcl/from-json-v1.mdx @@ -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 - -* post-processor: -* alicloud-import image_disk_mappings + + - 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 + +- 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: diff --git a/website/pages/guides/hcl/index.mdx b/website/pages/guides/hcl/index.mdx index 64acfe08c..82f8608e2 100644 --- a/website/pages/guides/hcl/index.mdx +++ b/website/pages/guides/hcl/index.mdx @@ -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 diff --git a/website/pages/guides/hcl/variables/index.mdx b/website/pages/guides/hcl/variables.mdx similarity index 99% rename from website/pages/guides/hcl/variables/index.mdx rename to website/pages/guides/hcl/variables.mdx index 50a98ace0..b7bceacdf 100644 --- a/website/pages/guides/hcl/variables/index.mdx +++ b/website/pages/guides/hcl/variables.mdx @@ -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. diff --git a/website/pages/guides/index.mdx b/website/pages/guides/index.mdx index ef3066fc4..3b0922979 100644 --- a/website/pages/guides/index.mdx +++ b/website/pages/guides/index.mdx @@ -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, diff --git a/website/pages/guides/packer-on-cicd/build-image-in-cicd.mdx b/website/pages/guides/packer-on-cicd/build-image-in-cicd.mdx index df28f1d2b..f2bc487c6 100644 --- a/website/pages/guides/packer-on-cicd/build-image-in-cicd.mdx +++ b/website/pages/guides/packer-on-cicd/build-image-in-cicd.mdx @@ -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 diff --git a/website/pages/guides/packer-on-cicd/build-virtualbox-image.mdx b/website/pages/guides/packer-on-cicd/build-virtualbox-image.mdx index af546d4bb..79fe19a21 100644 --- a/website/pages/guides/packer-on-cicd/build-virtualbox-image.mdx +++ b/website/pages/guides/packer-on-cicd/build-virtualbox-image.mdx @@ -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) diff --git a/website/pages/guides/packer-on-cicd/index.mdx b/website/pages/guides/packer-on-cicd/index.mdx index 328e699c7..d5ef182ac 100644 --- a/website/pages/guides/packer-on-cicd/index.mdx +++ b/website/pages/guides/packer-on-cicd/index.mdx @@ -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 diff --git a/website/pages/guides/packer-on-cicd/trigger-tfe.mdx b/website/pages/guides/packer-on-cicd/trigger-tfe.mdx index 56b46ca05..5b14d379d 100644 --- a/website/pages/guides/packer-on-cicd/trigger-tfe.mdx +++ b/website/pages/guides/packer-on-cicd/trigger-tfe.mdx @@ -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 diff --git a/website/pages/guides/packer-on-cicd/upload-images-to-artifact.mdx b/website/pages/guides/packer-on-cicd/upload-images-to-artifact.mdx index ca0b1a2d8..469b3f54c 100644 --- a/website/pages/guides/packer-on-cicd/upload-images-to-artifact.mdx +++ b/website/pages/guides/packer-on-cicd/upload-images-to-artifact.mdx @@ -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 diff --git a/website/pages/guides/workflow-tips-and-tricks/index.mdx b/website/pages/guides/workflow-tips-and-tricks/index.mdx index 6a513ea28..5938b7edb 100644 --- a/website/pages/guides/workflow-tips-and-tricks/index.mdx +++ b/website/pages/guides/workflow-tips-and-tricks/index.mdx @@ -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 diff --git a/website/pages/guides/workflow-tips-and-tricks/isotime-template-function.mdx b/website/pages/guides/workflow-tips-and-tricks/isotime-template-function.mdx index a506c9eb9..81c37380c 100644 --- a/website/pages/guides/workflow-tips-and-tricks/isotime-template-function.mdx +++ b/website/pages/guides/workflow-tips-and-tricks/isotime-template-function.mdx @@ -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. diff --git a/website/pages/guides/workflow-tips-and-tricks/use-packer-with-comment.mdx b/website/pages/guides/workflow-tips-and-tricks/use-packer-with-comment.mdx index 4c9190d76..710622781 100644 --- a/website/pages/guides/workflow-tips-and-tricks/use-packer-with-comment.mdx +++ b/website/pages/guides/workflow-tips-and-tricks/use-packer-with-comment.mdx @@ -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 , ``` diff --git a/website/pages/guides/workflow-tips-and-tricks/veewee-to-packer.mdx b/website/pages/guides/workflow-tips-and-tricks/veewee-to-packer.mdx index f52feff18..8d7184dd6 100644 --- a/website/pages/guides/workflow-tips-and-tricks/veewee-to-packer.mdx +++ b/website/pages/guides/workflow-tips-and-tricks/veewee-to-packer.mdx @@ -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 diff --git a/website/scripts/changelog.md b/website/scripts/changelog.md index 592e18026..6912513a7 100644 --- a/website/scripts/changelog.md +++ b/website/scripts/changelog.md @@ -1 +1,2 @@ - `/intro/getting-started/install` redirects to `/intro/getting-started` +- `/guides/hcl` folders with only index changed to named individual files