Skip to content

Instantly share code, notes, and snippets.

@maoo
Last active August 28, 2019 13:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maoo/40a4f7a9df8315290a1b0c347dd018da to your computer and use it in GitHub Desktop.
Save maoo/40a4f7a9df8315290a1b0c347dd018da to your computer and use it in GitHub Desktop.
JSON license report with fossa-cli

Creating and running Docker image for fossa-cli

docker pull fossa/fossa-cli:buildtools
docker run -it fossa/fossa-cli:buildtools /bin/bash

Run commands within the container


# Installing JQ for JSON manipulation
sudo apt-get install -y jq

# Build fossa-cli from source (master branch)
# export GOPATH=${PWD}
# mkdir -p src/github.com/fossas
# cd src/github.com/fossas
# git clone https://github.com/fossas/fossa-cli.git
# cd fossa-cli/
# make
# cd ~

# Extract FOSSA API Key from https://app.fossa.com/account/settings/integrations/api_tokens
export FOSSA_API_KEY=...

# Install fossa-cli 1.0.3
curl -L -O https://github.com/fossas/fossa-cli/releases/download/v1.0.3/fossa-cli_1.0.3_linux_amd64.tar.gz
tar xvzf fossa-cli_1.0.3_linux_amd64.tar.gz

# Add fossa command to PATH
export PATH=$PWD:$PATH

# Checkout a github public project and run fossa report licenses
git clone https://github.com/symphonyoss/symphony-java-client.git
cd symphony-java-client
fossa init
# Init (of this repo) should take 2-3 minutes
fossa report licenses --json > licenses.json
# Report generation (of this repo) should take  minutes

# Simplify JSON structure
cat licenses.json | jq '[.[] |  {package: .loc.package, licenses: [.Licenses[].LicenseID]}]'
@maoo
Copy link
Author

maoo commented Jun 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment