Skip to content

Commit

Permalink
Add new GH job to generate CSV table and HTML page with SRG mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggbecker committed Mar 10, 2022
1 parent bc019a4 commit f5cdbdd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/srg-mapping-table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: SRG Mapping Table
on:
# push:
# branches: [ 'master' ]
pull_request:
branches: [ 'master', 'stabilization*' ]
jobs:
publish:
name: SRG Mapping Table
runs-on: ubuntu-latest
container:
image: fedora:latest
steps:
- name: Install Deps
run: dnf install -y cmake git ninja-build openscap-utils python3-pyyaml python3-jinja2 python3-pytest ansible-lint expat libxslt python3-pip rsync
- name: Install deps python
run: pip3 install pandas
- name: Checkout
uses: actions/checkout@v2
- name: Build rule dir json
run: ./utils/rule_dir_json.py
- name: Generate CSV and HTML
run: ./utils/create_srg_export.py -c controls/stig_rhel9.yml -p rhel9 -m shared/references/disa-os-srg-v2r2.xml --output srg-mapping-rhel9.csv
- uses: actions/upload-artifact@v2
with:
name: srg-mapping-rhel9.csv
path: srg-mapping-rhel9.csv
- uses: actions/upload-artifact@v2
with:
name: srg-mapping-rhel9.html
path: srg-mapping-rhel9.csv.html
5 changes: 5 additions & 0 deletions utils/create_srg_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ def main() -> None:
used_rules)
print(f"File written to {full_output}")

# export CSV to HTML table
import pandas as pd
csv = pd.read_csv(full_output)
csv.to_html(pathlib.Path(args.output+".html"))


if __name__ == '__main__':
main()

0 comments on commit f5cdbdd

Please sign in to comment.