Skip to content

Commit 66292a6

Browse files
authored
Merge branch '3.0' into 3.0
2 parents d90c7ad + 36927c4 commit 66292a6

File tree

145 files changed

+9150
-5583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+9150
-5583
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ var/
3636
# Installer logs
3737
pip-log.txt
3838
pip-delete-this-directory.txt
39+
pytest-output.txt
3940

4041
# Unit test / coverage reports
4142
htmlcov/
43+
coverage/
4244
.tox/
4345
.coverage
4446
.coverage.*
@@ -81,10 +83,6 @@ celerybeat-schedule
8183
# dotenv
8284
.env
8385

84-
# virtualenv
85-
venv/
86-
ENV/
87-
8886
# Spyder project settings
8987
.spyderproject
9088

.pipeline

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
2+
def imgname = 'hubblestack/jenkins:centos-v1.0.8'
3+
4+
pipeline {
5+
agent { docker { image "${imgname}" } }
6+
7+
options {
8+
timestamps()
9+
ansiColor 'xterm'
10+
buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1'))
11+
}
12+
13+
environment {
14+
PY_COLORS = 1
15+
HS_PROFILE = 1
16+
}
17+
18+
stages {
19+
stage('setup') {
20+
steps {
21+
sh '''#!/bin/bash
22+
source /etc/profile.d/kersplat.sh
23+
pyenv local $PY_V
24+
pyenv shell $PY_V
25+
set -x -e
26+
rm -rf vlib venv .pytest_cache
27+
pip install --cache-dir ./pip.cache -t ./vlib virtualenv
28+
PYTHONPATH=./vlib ./vlib/bin/virtualenv ./venv
29+
source ./venv/bin/activate
30+
pip install --cache-dir ./pip.cache -U pip
31+
pip install --cache-dir ./pip.cache -U -r test-requirements.txt
32+
'''
33+
sh '''#!/bin/bash
34+
# NOTE: CHANGE_TARGET and BRANCH_NAME are only populated on multibranch pipeline.
35+
# For other environments, we have to fake it with 'origin/develop' and 'HEAD'
36+
echo "CHANGE_TARGET=$CHANGE_TARGET BRANCH_NAME=$BRANCH_NAME"
37+
/usr/bin/git fetch --no-tags --progress https://github.com/hubblestack/hubble.git +refs/heads/develop:refs/remotes/origin/develop
38+
echo git branch -vva
39+
git branch -vva
40+
echo "LHS=$LHS RHS=$RHS"
41+
LHS="origin/${CHANGE_TARGET:-develop}"
42+
RHS="${BRANCH_NAME:+origin/}${BRANCH_NAME:-HEAD}"
43+
if [[ $(git show -s --format='%s%n%b' "${LHS}..${RHS}") =~ LINT-FULL ]]
44+
then find hubblestack -name "*.py"
45+
else find hubblestack -name "*.py" -print0 | xargs -r0 git diff --name-only "$LHS" "$RHS"
46+
fi > relevant-files.txt
47+
'''
48+
sh '''mkdir -vp tests/unittests/output'''
49+
}
50+
}
51+
stage('lint/test') {
52+
parallel {
53+
stage('pytest') {
54+
steps {
55+
sh '''#!/bin/bash
56+
source ./venv/bin/activate
57+
pytest --log-cli-level INFO tests/unittests --html=tests/unittests/output/pytest.html
58+
x=$?
59+
cp tests/unittests/output/combined.svg tests/unittests/output/profile-diagram.svg
60+
exit $x
61+
'''
62+
}
63+
}
64+
stage('pylint') {
65+
steps {
66+
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
67+
sh '''#!/bin/bash
68+
source ./venv/bin/activate
69+
< relevant-files.txt xargs -r pylint --output-format=json \
70+
> tests/unittests/output/pylint.json
71+
x=$?
72+
python ./tests/automation/pylint-json-to-html tests/unittests/output/pylint.json
73+
exit $x
74+
'''
75+
}
76+
}
77+
}
78+
stage('bandit') {
79+
steps {
80+
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
81+
sh '''#!/bin/bash
82+
source ./venv/bin/activate
83+
< relevant-files.txt xargs -r bandit -lif html \
84+
> tests/unittests/output/bandit.html
85+
x=$?
86+
cp tests/static/bandit.css tests/unittests/output/bandit.css
87+
sed -i -e '/<style/,/<.style/c<link rel="stylesheet" href="bandit.css">' \
88+
tests/unittests/output/bandit.html
89+
exit $x
90+
'''
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
97+
98+
post {
99+
always {
100+
publishHTML (target: [
101+
allowMissing: false,
102+
alwaysLinkToLastBuild: false,
103+
keepAll: true,
104+
reportDir: 'tests/unittests/output',
105+
reportFiles: 'pytest.html, coverage/index.html, pylint.html, profile-diagram.svg, bandit.html',
106+
reportName: "Test Reports"
107+
])
108+
}
109+
}
110+
}

conf/hubble

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@ fileserver_backend:
4848
# kwargs:
4949
# verbose: True
5050
# returner: splunk_nova_return
51-
# returner_retry: True # only works on splunk returners for now
5251
# run_on_start: False
5352
# fdg_top:
5453
# function: fdg.top
5554
# seconds: 86400
5655
# splay: 3600
5756
# returner: splunk_fdg_return
58-
# returner_retry: True
5957
# run_on_start: True
6058
# nebula_fifteen_min:
6159
# function: nebula.queries
@@ -80,7 +78,6 @@ fileserver_backend:
8078
# args:
8179
# - day
8280
# returner: splunk_nebula_return
83-
# returner_retry: True # only works on splunk returners for now
8481
# run_on_start: False
8582
# nebula_osqueryd_monitor:
8683
# function: nebula.osqueryd_monitor
@@ -108,6 +105,11 @@ fileserver_backend:
108105
# mask_passwords: True
109106
# returner: splunk_osqueryd_return
110107
# run_on_start: True
108+
# nebula_osquery_extensions:
109+
# function: nebula.extensions
110+
# seconds: 86400
111+
# splay: 3600
112+
# run_on_start: True
111113
# pulsar:
112114
# function: pulsar.process
113115
# seconds: 1

hubblestack/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
__version__ = '3.0.8'
22

3-
__buildinfo__ = { 'branch' : 'BRANCH_NOT_SET' , 'last_commit' : 'COMMIT_NOT_SET' }
4-
3+
__buildinfo__ = {'branch': 'BRANCH_NOT_SET', 'last_commit': 'COMMIT_NOT_SET'}

0 commit comments

Comments
 (0)