|
| 1 | +name: CIS-NIST Control File Sync |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + schedule: |
| 8 | + # Run every Sunday at 2:00 PM UTC |
| 9 | + - cron: '0 14 * * 0' |
| 10 | + workflow_dispatch: # Allow manual trigger |
| 11 | + |
| 12 | +jobs: |
| 13 | + generate-and-validate: |
| 14 | + name: Generate CIS-NIST Control File and Profiles |
| 15 | + runs-on: ubuntu-latest |
| 16 | + container: |
| 17 | + image: fedora:latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Install system dependencies |
| 21 | + run: | |
| 22 | + dnf install -y \ |
| 23 | + cmake \ |
| 24 | + make \ |
| 25 | + ninja-build \ |
| 26 | + openscap-utils \ |
| 27 | + python3-pyyaml \ |
| 28 | + python3-jinja2 \ |
| 29 | + python3-pip \ |
| 30 | + git \ |
| 31 | + gcc \ |
| 32 | + gcc-c++ \ |
| 33 | + python3-devel \ |
| 34 | + libxml2-devel \ |
| 35 | + libxslt-devel \ |
| 36 | + python3-setuptools \ |
| 37 | + libxml2 \ |
| 38 | + expat \ |
| 39 | + gh |
| 40 | +
|
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 43 | + with: |
| 44 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + fetch-depth: 0 |
| 46 | + |
| 47 | + - name: Configure git |
| 48 | + run: | |
| 49 | + git config --global user.name "github-actions[bot]" |
| 50 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 51 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 52 | +
|
| 53 | + - name: Install Python dependencies |
| 54 | + run: | |
| 55 | + pip install --upgrade pip |
| 56 | + pip install ruamel.yaml PyPDF2 |
| 57 | +
|
| 58 | + - name: Download OSCAL catalog |
| 59 | + run: | |
| 60 | + cd utils/nist_sync |
| 61 | + python3 download_oscal.py |
| 62 | +
|
| 63 | + - name: Run CIS-NIST workflow |
| 64 | + id: workflow |
| 65 | + run: | |
| 66 | + cd utils/nist_sync |
| 67 | + echo "Running workflow for products: rhel8 rhel9 rhel10" |
| 68 | + ./generate_cis_nist_workflow.sh --products "rhel8 rhel9 rhel10" |
| 69 | +
|
| 70 | + - name: Verify control files |
| 71 | + run: ./utils/nist_sync/ci_sync.sh verify |
| 72 | + |
| 73 | + - name: Render policies and generate HTML tables |
| 74 | + run: | |
| 75 | + cd build |
| 76 | + ninja render-policies |
| 77 | + cd .. |
| 78 | + mkdir -p artifacts/tables artifacts/rendered-policies |
| 79 | + for product in rhel8 rhel9 rhel10; do |
| 80 | + SRC="build/$product/rendered-policies/nist_800_53.html" |
| 81 | + DEST="artifacts/rendered-policies/nist_800_53-$product.html" |
| 82 | + [ -f "$SRC" ] && cp "$SRC" "$DEST" |
| 83 | + done |
| 84 | +
|
| 85 | + - name: Collect artifacts |
| 86 | + run: ./utils/nist_sync/ci_sync.sh collect-artifacts |
| 87 | + |
| 88 | + - name: Upload artifacts |
| 89 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4 |
| 90 | + with: |
| 91 | + name: cis-nist-artifacts-${{ github.run_number }} |
| 92 | + path: artifacts/ |
| 93 | + retention-days: 90 |
| 94 | + |
| 95 | + - name: Generate summary report |
| 96 | + run: ./utils/nist_sync/ci_sync.sh summarize |
| 97 | + |
| 98 | + - name: Check for changes in CIS reference |
| 99 | + id: changes |
| 100 | + run: ./utils/nist_sync/ci_sync.sh check-changes |
| 101 | + |
| 102 | + - name: Show diff summary |
| 103 | + if: steps.changes.outputs.has_changes == 'true' |
| 104 | + run: ./utils/nist_sync/ci_sync.sh show-diff |
| 105 | + |
| 106 | + - name: Create Pull Request for scheduled runs |
| 107 | + if: >- |
| 108 | + (github.event_name == 'schedule' || |
| 109 | + github.event_name == 'workflow_dispatch') && |
| 110 | + steps.changes.outputs.has_changes == 'true' |
| 111 | + env: |
| 112 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 113 | + GHA_EVENT_NAME: ${{ github.event_name }} |
| 114 | + GHA_RUN_ID: ${{ github.run_id }} |
| 115 | + GHA_REPOSITORY: ${{ github.repository }} |
| 116 | + run: ./utils/nist_sync/ci_sync.sh create-pr |
| 117 | + |
| 118 | + - name: Workflow Summary |
| 119 | + if: always() |
| 120 | + env: |
| 121 | + GHA_EVENT_NAME: ${{ github.event_name }} |
| 122 | + GHA_RUN_ID: ${{ github.run_id }} |
| 123 | + HAS_CHANGES: ${{ steps.changes.outputs.has_changes }} |
| 124 | + run: ./utils/nist_sync/ci_sync.sh workflow-summary |
0 commit comments