updated CI to generate docs automatically

This commit is contained in:
divious1
2019-06-20 11:47:34 -04:00
parent 4e90970b74
commit 9848bfd998
3 changed files with 209 additions and 188 deletions
+20 -1
View File
@@ -192,6 +192,24 @@ jobs:
else
git clone --branch ${CIRCLE_BRANCH} https://${GITHUB_TOKEN}@github.com/splunk/security-content.git
fi
- run: *apt-install
- run:
name: install python dependencies
command: |
cd security-content
rm -rf venv
virtualenv --python=/usr/bin/python2.7 --clear venv
source venv/bin/activate
pip install -q -r requirements.txt
- run:
name: run doc-gen
command: |
cd security-content
source venv/bin/activate
python bin/doc-gen.py --path . --output docs -v
- run:
name: update github with new docs and package bits
command: |
cd security-content
rm -rf package
mv ~/latest package
@@ -201,7 +219,8 @@ jobs:
git config user.name "research bot"
git config --global push.default simple
git add package/*
git commit --allow-empty -m "updating package files [ci skip]"
git add docs/*
git commit --allow-empty -m "updating docs and package bits [ci skip]"
# Push quietly to prevent showing the token in log
git push https://${GITHUB_TOKEN}@github.com/splunk/security-content.git ${CIRCLE_BRANCH}
CONTENT_VERSION=$(echo $CIRCLE_TAG | grep -oP "\d.\d.\d+")
+6 -4
View File
@@ -355,10 +355,6 @@ def write_splunk_docs(stories, detections, OUTPUT_DIR):
output_file.write("\n==={0}===\n".format(story_name))
# header information
output_file.write("""\n<div class="toccolours mw-collapsible">\n<div class="mw-collapsible-content">\n""")
output_file.write("* creation_date = {0}\n".format(story['creation_date']))
output_file.write("* modification_date = {0}\n".format(story['modification_date']))
output_file.write("* version = {0}\n".format(story['version']))
output_file.write("\n====Description====\n{0}\n".format(story['description']))
output_file.write("\n====Narrative====\n{0}\n".format(story['narrative']))
@@ -403,6 +399,12 @@ def write_splunk_docs(stories, detections, OUTPUT_DIR):
output_file.write("\n====References====\n")
for r in story['references']:
output_file.write("* {0}\n".format(markdown(r)))
# story details
output_file.write("* creation_date = {0}\n".format(story['creation_date']))
output_file.write("* modification_date = {0}\n".format(story['modification_date']))
output_file.write("* version = {0}\n".format(story['version']))
# footer information
output_file.write("""\n</div>\n</div>\n""")
output_file.write("""\n[[Category:V:Lab:drafts]]""")
File diff suppressed because it is too large Load Diff