Spice Labs Surveyor CLI

The Spice Labs Surveyor CLI surveys software artifacts, generates encrypted Artifact Dependency Graphs (ADGs), and securely uploads them to the Spice Labs platform. It can run locally via JVM or in a containerized environment via Docker.

Prerequisites

  • Docker must be installed and running. Get Docker
  • A Spice Pass set as the SPICE_PASS environment variable. Download it from your Spice Labs project dashboard.

Installation

macOS / Linux

curl -sSLf https://install.spicelabs.io | bash

Windows PowerShell

irm -UseBasicParsing -Uri https://install.spicelabs.io | iex

After installation, add spice to your PATH as instructed by the installer.

Commands

CommandDescription
runSurvey and upload in one step (default).
survey-artifactsGenerate ADGs locally but do not upload.
upload-adgsUpload previously generated ADGs.
decode-spice-passDecode a Spice Pass file or string for verification.

CLI Options

General

OptionDescriptionDefault
--input=<path>Input path.Current directory
--output=<path>Output path.None
--tag=<tag>Tag all top-level artifacts with the current date and the given text. Required for run.None
--tag-json=<json>Add JSON to any tags.None
--threads=<n>Number of threads to use.Half of available CPU cores
--max-records=<n>Max records to process per batch.5000
--log-level=<level>Logging verbosity: all, trace, debug, info, warn, error, fatal, off.info
--log-file=<path>Append log output to this file (in addition to console). ANSI codes are stripped.None
--ciCI mode.false
--use-static-metadataAugment Goat Rodeo information with other static metadata.false

Advanced Builder Options

OptionDescription
--ginger-args=<args>Extra flags to Ginger uploader (comma-separated). Example: --ginger-args="--skip-key,--encrypt-only".
--goat-rodeo-args=<args>Key=value args to Goat Rodeo surveyor. Example: --goat-rodeo-args="blockList=ignored,tempDir=/tmp".

Example Commands

Full Survey and Upload

spice --input=./target --tag=my-service

Survey Only

spice --command=survey-artifacts --input=./src --output=./adg-out

Upload Existing ADGs

spice --command=upload-adgs --input=./adg-out

CI Mode

spice --ci --input=./target --tag=ci-build

Add Metadata

spice --tag=my-service --tag-json='{"commit":"abc123","branch":"main"}'

Log to File

spice --log-level=debug --log-file=spice.log --tag=debug-test

Docker Usage

Survey and Upload

docker run --rm \
  --user $(id -u):$(id -g) \
  --network host \
  -e SPICE_PASS=... \
  -v "$PWD/input:/mnt/input" \
  -v "$PWD/output:/mnt/output" \
  spicelabs/spice-labs-cli \
  --input=/mnt/input \
  --output=/mnt/output \
  --tag=my-service

Upload Only

docker run --rm \
  --user $(id -u):$(id -g) \
  --network host \
  -e SPICE_PASS=... \
  -v "$PWD/output:/mnt/input" \
  spicelabs/spice-labs-cli \
  --command=upload-adgs \
  --input=/mnt/input

Note: The wrapper script automatically remaps --input and --output host paths to /mnt/input and /mnt/output inside the container.

Environment Variables

VariableDescriptionDefault
SPICE_PASSRequired for upload-* commands. JWT token for Spice Labs auth.None
SPICE_LABS_CLI_USE_JVMUse the local JVM instead of Docker (1 = enable).0
SPICE_LABS_CLI_JARPath to the CLI JAR when using JVM mode./opt/spice-labs-cli/spice-labs-cli.jar
SPICE_LABS_JVM_ARGSCustom JVM flags (e.g. -Xmx512m -XX:+UseG1GC).-XX:MaxRAMPercentage=75
SPICE_IMAGEDocker image to use.spicelabs/spice-labs-cli
SPICE_IMAGE_TAGDocker image tag.latest
SPICE_LABS_CLI_SKIP_PULLSkip docker pull before run (1 = skip).0
SPICE_DOCKER_FLAGSAdditional flags passed to docker run.None

GitHub Actions Integration

jobs:
  spice-survey:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Spice Labs Surveyor
        uses: spice-labs-inc/action-spice-labs-surveyor@v5

See the Spice Labs Surveyor GitHub Action for full configuration options.

Troubleshooting

Common Errors

IssueCauseSolution
OCI runtime create failedMounted a .tar.gz instead of a .tar.Save Docker image as .tar only.
SPICE_PASS not setMissing authentication variable.Set SPICE_PASS before running.
Input directory not foundIncorrect --input path.Verify mount path or local path.
Permission deniedDocker volume not writable.Use absolute paths and correct permissions.
Upload failedNetwork or token issue.Re-authenticate and retry with a valid SPICE_PASS.

Debugging

  • Increase verbosity with --log-level=debug.
  • Write logs using --log-file=spice.log.
  • In CI, include --ci for deterministic exits.

Build Locally

Requirements: JDK 21+, Maven 3.6+

git clone https://github.com/spice-labs-inc/spice-labs-cli.git
cd spice-labs-cli
mvn clean install

Output:

target/spice-labs-cli-<version>-fat.jar

Run manually:

java -jar target/spice-labs-cli-*-fat.jar --version

License

Apache License 2.0. See LICENSE.