Skip to content

Commit 858e5b5

Browse files
committed
assume this file being empty is the main problem
1 parent 725565a commit 858e5b5

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

.pipeline

+23-11
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ pipeline {
4949
if [[ $(git show -s --format='%s%n%b' "${LHS}..${RHS}") =~ LINT-FULL ]]
5050
then find hubblestack -name "*.py"
5151
else find hubblestack -name "*.py" -print0 | xargs -r0 git diff --name-only "$LHS" "$RHS"
52-
fi > tests/unittests/output/relevant-files.txt
52+
fi > relevant-files.txt
5353
'''
54-
sh '''mkdir -vp tests/unittests/output'''
54+
sh '''mkdir -vp tests/unittests/output
55+
cp relevant-files.txt tests/unittests/output
56+
'''
5557
}
5658
}
5759
stage('lint/test') {
@@ -71,9 +73,14 @@ pipeline {
7173
steps {
7274
sh '''#!/bin/bash
7375
source ./venv/bin/activate
74-
< tests/unittests/output/relevant-files.txt xargs -r pylint --output-format=json \
75-
> tests/unittests/output/pylint.json
76-
x=$?
76+
if grep -q . relevant-files.txt; then
77+
< relevant-files.txt xargs -r pylint --output-format=json \
78+
> tests/unittests/output/pylint.json
79+
x=$?
80+
else
81+
echo "[]" > tests/unittests/output/pylint.json
82+
x=0
83+
fi
7784
python ./tests/automation/pylint-json-to-html tests/unittests/output/pylint.json
7885
exit $x
7986
'''
@@ -84,12 +91,17 @@ pipeline {
8491
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
8592
sh '''#!/bin/bash
8693
source ./venv/bin/activate
87-
< tests/unittests/output/relevant-files.txt xargs -r bandit -lif html \
88-
> tests/unittests/output/bandit.html
89-
x=$?
90-
cp tests/static/bandit.css tests/unittests/output/bandit.css
91-
sed -i -e '/<style/,/<.style/c<link rel="stylesheet" href="bandit.css">' \
92-
tests/unittests/output/bandit.html
94+
if grep -q . relevant-files.txt; then
95+
< relevant-files.txt xargs -r bandit -lif html \
96+
> tests/unittests/output/bandit.html
97+
x=$?
98+
cp tests/static/bandit.css tests/unittests/output/bandit.css
99+
sed -i -e '/<style/,/<.style/c<link rel="stylesheet" href="bandit.css">' \
100+
tests/unittests/output/bandit.html
101+
else
102+
echo "<p>did not run</p>" > tests/unittests/output/bandit.html
103+
x=0
104+
fi
93105
exit $x
94106
'''
95107
}

0 commit comments

Comments
 (0)