Skip to content

Commit 7973c97

Browse files
authored
Add script and config for FOSSA scanning (elastic#1370)
FOSSA will check that we are only using code with approved licenses.
1 parent 68e7bf2 commit 7973c97

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

Diff for: .fossa.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Generated by FOSSA CLI (https://github.com/fossas/fossa-cli)
2+
# Visit https://fossa.com to learn more
3+
4+
version: 2
5+
cli:
6+
server: https://app.fossa.com
7+
fetcher: custom
8+
project: git@github.com:elastic/ml-cpp.git
9+
analyze:
10+
modules:
11+
- name: 3rd_party/licenses
12+
type: raw
13+
target: 3rd_party/licenses
14+
- name: 3rd_party/rapidjson/include/rapidjson
15+
type: raw
16+
target: 3rd_party/rapidjson/include/rapidjson
17+
- name: include/api
18+
type: raw
19+
target: include/api
20+
- name: include/core
21+
type: raw
22+
target: include/core
23+
- name: include/maths
24+
type: raw
25+
target: include/maths
26+
- name: include/model
27+
type: raw
28+
target: include/model
29+
- name: include/ver
30+
type: raw
31+
target: include/ver
32+
- name: include/seccomp
33+
type: raw
34+
target: include/seccomp
35+
- name: lib/api
36+
type: raw
37+
target: lib/api
38+
- name: lib/core
39+
type: raw
40+
target: lib/core
41+
- name: lib/maths
42+
type: raw
43+
target: lib/maths
44+
- name: lib/model
45+
type: raw
46+
target: lib/model
47+
- name: lib/ver
48+
type: raw
49+
target: lib/ver
50+
- name: lib/seccomp
51+
type: raw
52+
target: lib/seccomp
53+
- name: bin/autodetect
54+
type: raw
55+
target: bin/autodetect
56+
- name: bin/categorize
57+
type: raw
58+
target: bin/categorize
59+
- name: bin/controller
60+
type: raw
61+
target: bin/controller
62+
- name: bin/normalize
63+
type: raw
64+
target: bin/normalize
65+
- name: bin/data_frame_analyzer
66+
type: raw
67+
target: bin/data_frame_analyzer

Diff for: dev-tools/fossa_scan.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
#
3+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4+
# or more contributor license agreements. Licensed under the Elastic License;
5+
# you may not use this file except in compliance with the Elastic License.
6+
#
7+
8+
# Run a FOSSA scan on the repo to check for license violations
9+
10+
# Get the FOSSA API token from Vault
11+
set +x
12+
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
13+
unset VAULT_ROLE_ID VAULT_SECRET_ID
14+
export FOSSA_API_KEY=$(vault read -field=token secret/jenkins-ci/fossa/api-token)
15+
unset VAULT_TOKEN
16+
set -x
17+
18+
# Change directory to the top level of the repo
19+
readonly GIT_TOPLEVEL=$(git rev-parse --show-toplevel 2> /dev/null)
20+
cd "$GIT_TOPLEVEL"
21+
22+
# Run the FOSSA scan
23+
fossa analyze
24+

0 commit comments

Comments
 (0)