build-product.sh
This utility script simplifies the process of building specific ComplianceAsCode products within the container.
Location
/utils/build-product.sh
This script is available on the container’s PATH, so it can be run from any directory inside the container.
Purpose
The primary purpose of this script is to:
- Provide a simple interface for building ComplianceAsCode products
- Clean up previous build artifacts for the specified product
- Copy generated files to the output directory mounted from the host
- Provide feedback on the build process
Usage
build-product [product-name] [options]
Parameters
Parameter | Description |
---|---|
product-name | The name of the product to build (e.g., rhel10, ubuntu2204) |
Options
Additional options can be passed to the underlying make
command:
build-product rhel10 --profile stig
Examples
Building RHEL 10 Content
build-product rhel10
Building Ubuntu 24.04 Content
build-product ubuntu2404
Building with Specific Profile
build-product rhel10 --profile stig
How It Works
The script follows this process:
- Verifies that a product name was provided
- Cleans previous build artifacts for the specified product
- Builds the product using the ComplianceAsCode build system
- Copies the generated files to the
/output
directory, which is mounted from the host - Lists the generated files for verification
Available Products
To see a list of available products, run the script without any arguments:
build-product
This will display a list of available products that can be built.
Output
The script generates SCAP content in various formats:
- XCCDF files (security checklists)
- OVAL definitions (technical checks)
- DataStream files (bundled content)
- Ansible playbooks (remediation scripts)
- Bash scripts (remediation scripts)
These files are placed in both the /content/build
directory inside the container and copied to the /output
directory, which is mounted from the host’s ./output
directory.
Error Handling
If the build process fails, the script will display an error message and exit with status code 1.