From 19a2f897cd4d51d0eb5047ae76ea4016a7e71828 Mon Sep 17 00:00:00 2001 From: Devashish Date: Mon, 4 Nov 2024 11:13:20 -0500 Subject: [PATCH] Fix verbiage in website --- .../content/docs/provisioners/hcp-sbom.mdx | 127 +++++++----------- 1 file changed, 48 insertions(+), 79 deletions(-) diff --git a/website/content/docs/provisioners/hcp-sbom.mdx b/website/content/docs/provisioners/hcp-sbom.mdx index e49875f89..a90b5bf88 100644 --- a/website/content/docs/provisioners/hcp-sbom.mdx +++ b/website/content/docs/provisioners/hcp-sbom.mdx @@ -1,7 +1,7 @@ --- description: | - The `hcp-sbom` Packer provisioner downloads the SBOM file from remote and - sends to HCP Packer when build is done. + The `hcp-sbom` Packer provisioner downloads an SBOM file from the guest VM and + sends it to HCP Packer when the build is done. page_title: HCP SBOM - Provisioners --- @@ -13,32 +13,18 @@ page_title: HCP SBOM - Provisioners Type: `hcp-sbom` -The `hcp-sbom` Packer provisioner downloads the SBOM file from the remote machine +The `hcp-sbom` Packer provisioner downloads an SBOM file from the guest machine and sends it to HCP Packer when the build is complete (only if the template is HCP-enabled). The SBOM file is automatically removed at the end of the process. -If the user wants to retain a copy of the SBOM file, they should specify the -`destination` field in the provisioner. +If you want to retain a copy of the SBOM file, you can specify the +`destination` option in the provisioner. Currently, we support `CycloneDX` and `SPDX` SBOM formats in `JSON`. -TBA: Add more details about max number of files allowed to download, and - if we are going to add the file name field. - ## Basic Example - - -```json -{ - "type": "hcp-sbom", - "source": "/tmp/sbom_cyclonedx.json", - "destination": "./sbom/sbom_cyclonedx.json" -} -``` - - - +In HCL2: ```hcl provisioner "hcp-sbom" { @@ -47,8 +33,17 @@ provisioner "hcp-sbom" { } ``` - - +In JSON: + +```json +{ + "type": "hcp-sbom", + "source": "/tmp/sbom_cyclonedx.json", + "destination": "./sbom/sbom_cyclonedx.json" +} +``` + + ## Configuration Reference @@ -62,50 +57,8 @@ Optional Parameters: ## Example Usage - - -```json -{ - "builders": [ - { - "type": "docker", - "image": "ubuntu:20.04", - "commit": true - } - ], - "provisioners": [ - { - "type": "shell", - "inline": [ - "apt-get update -y", - "apt-get install -y curl", - "bash -c \"$(curl -sSL https://install.mondoo.com/sh)\"" - ] - }, - { - "type": "shell", - "inline": [ - "cnquery sbom --output cyclonedx-json --output-target /tmp/sbom_cyclonedx.json", - "cnquery sbom --output spdx-json --output-target /tmp/sbom_spdx.json" - ] - }, - { - "type": "hcp-sbom", - "source": "/tmp/sbom_cyclonedx.json", - "destination": "./sbom" - }, - { - "type": "hcp-sbom", - "source": "/tmp/sbom_spdx.json", - "destination": "./sbom/sbom_spdx.json" - } - ] -} -``` - - - +In HCL2: ```hcl packer { @@ -134,14 +87,8 @@ build { inline = [ "apt-get update -y", "apt-get install -y curl gpg", - "bash -c \"$(curl -sSL https://install.mondoo.com/sh)\"" - ] - } - - provisioner "shell" { - inline = [ + "bash -c \"$(curl -sSL https://install.mondoo.com/sh)\"", "cnquery sbom --output cyclonedx-json --output-target /tmp/sbom_cyclonedx.json", - "cnquery sbom --output spdx-json --output-target /tmp/sbom_spdx.json", ] } @@ -149,13 +96,35 @@ build { source = "/tmp/sbom_cyclonedx.json" destination = "./sbom" } - - provisioner "hcp-sbom" { - source = "/tmp/sbom_spdx.json" - destination = "./sbom/sbom_spdx.json" - } } ``` - - +In JSON: + +```json +{ + "builders": [ + { + "type": "docker", + "image": "ubuntu:20.04", + "commit": true + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "apt-get update -y", + "apt-get install -y curl", + "bash -c \"$(curl -sSL https://install.mondoo.com/sh)\"", + "cnquery sbom --output cyclonedx-json --output-target /tmp/sbom_cyclonedx.json" + ] + }, + { + "type": "hcp-sbom", + "source": "/tmp/sbom_cyclonedx.json", + "destination": "./sbom" + } + ] +} +```