Skip to content

Commit

Permalink
Add script and config for FOSSA scanning (elastic#1370)
Browse files Browse the repository at this point in the history
FOSSA will check that we are only using code with approved
licenses.
  • Loading branch information
droberts195 authored Jul 22, 2020
1 parent 68e7bf2 commit 7973c97
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Generated by FOSSA CLI (https://github.com/fossas/fossa-cli)
# Visit https://fossa.com to learn more

version: 2
cli:
server: https://app.fossa.com
fetcher: custom
project: git@github.com:elastic/ml-cpp.git
analyze:
modules:
- name: 3rd_party/licenses
type: raw
target: 3rd_party/licenses
- name: 3rd_party/rapidjson/include/rapidjson
type: raw
target: 3rd_party/rapidjson/include/rapidjson
- name: include/api
type: raw
target: include/api
- name: include/core
type: raw
target: include/core
- name: include/maths
type: raw
target: include/maths
- name: include/model
type: raw
target: include/model
- name: include/ver
type: raw
target: include/ver
- name: include/seccomp
type: raw
target: include/seccomp
- name: lib/api
type: raw
target: lib/api
- name: lib/core
type: raw
target: lib/core
- name: lib/maths
type: raw
target: lib/maths
- name: lib/model
type: raw
target: lib/model
- name: lib/ver
type: raw
target: lib/ver
- name: lib/seccomp
type: raw
target: lib/seccomp
- name: bin/autodetect
type: raw
target: bin/autodetect
- name: bin/categorize
type: raw
target: bin/categorize
- name: bin/controller
type: raw
target: bin/controller
- name: bin/normalize
type: raw
target: bin/normalize
- name: bin/data_frame_analyzer
type: raw
target: bin/data_frame_analyzer
24 changes: 24 additions & 0 deletions dev-tools/fossa_scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License;
# you may not use this file except in compliance with the Elastic License.
#

# Run a FOSSA scan on the repo to check for license violations

# Get the FOSSA API token from Vault
set +x
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
unset VAULT_ROLE_ID VAULT_SECRET_ID
export FOSSA_API_KEY=$(vault read -field=token secret/jenkins-ci/fossa/api-token)
unset VAULT_TOKEN
set -x

# Change directory to the top level of the repo
readonly GIT_TOPLEVEL=$(git rev-parse --show-toplevel 2> /dev/null)
cd "$GIT_TOPLEVEL"

# Run the FOSSA scan
fossa analyze

0 comments on commit 7973c97

Please sign in to comment.