Skip to content

Commit 61a1462

Browse files
Pylint updates, CI workflows, attrs updates (#7)
* pylint updates, worklflows added, HANA RHEL attrs updated * Update documentation for clarity and formatting improvements * Added ansible docs * Refactor imports in multiple modules for consistency and clarity * Enhance setup script to create and activate Python virtual environment
1 parent afc3705 commit 61a1462

Some content is hidden

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

42 files changed

+2053
-422
lines changed

.github/workflows/codeql.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["main", "development"]
17+
pull_request:
18+
branches: ["main", "development"]
19+
schedule:
20+
- cron: "0 0 * * 1"
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
analyze:
27+
name: Analyze
28+
runs-on: ubuntu-latest
29+
permissions:
30+
actions: read
31+
contents: read
32+
security-events: write
33+
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
language: ["javascript", "python"]
38+
39+
steps:
40+
- name: Harden Runner
41+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
42+
with:
43+
egress-policy: audit
44+
45+
- name: Checkout repository
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
48+
- name: Initialize CodeQL
49+
uses: github/codeql-action/init@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
50+
with:
51+
languages: ${{ matrix.language }}
52+
53+
- name: Autobuild
54+
uses: github/codeql-action/autobuild@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
55+
56+
- name: Perform CodeQL Analysis
57+
uses: github/codeql-action/analyze@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
58+
with:
59+
category: "/language:${{matrix.language}}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0

.github/workflows/github-actions-ansible-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Python
2020
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 #v5.4.0
2121
with:
22-
python-version: '3.x'
22+
python-version: '3.10'
2323

2424
- name: Install dependencies
2525
run: |

.github/workflows/github-actions-code-coverage.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Python
2020
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 #v5.4.0
2121
with:
22-
python-version: '3.x'
22+
python-version: '3.10'
2323

2424
- name: Install dependencies
2525
run: |
@@ -30,6 +30,10 @@ jobs:
3030
run: |
3131
pytest --cov=src/ --cov-fail-under=85 --cov-report=xml tests/
3232
33+
- name: Run pylint
34+
run: |
35+
pylint --load-plugins=pylint.extensions.docparams --fail-under=9 --disable=R $(git ls-files '*.py') --rcfile=./pyproject.toml
36+
3337
- name: Check code formatting with black
3438
run: |
3539
black --check src/ tests/ --config pyproject.toml
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
branch_protection_rule:
8+
schedule:
9+
- cron: '32 4 * * 5'
10+
push:
11+
branches: [ "main" ]
12+
13+
permissions: read-all
14+
15+
jobs:
16+
analysis:
17+
name: Scorecard analysis
18+
runs-on: ubuntu-latest
19+
permissions:
20+
security-events: write
21+
id-token: write
22+
23+
steps:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
26+
with:
27+
egress-policy: audit
28+
29+
- name: "Checkout code"
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: false
33+
34+
- name: "Run analysis"
35+
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
36+
with:
37+
results_file: results.sarif
38+
results_format: sarif
39+
publish_results: true
40+
41+
- name: "Upload artifact"
42+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
43+
with:
44+
name: SARIF file
45+
path: results.sarif
46+
retention-days: 5
47+
48+
- name: "Upload to code-scanning"
49+
uses: github/codeql-action/upload-sarif@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
50+
with:
51+
sarif_file: results.sarif

.github/workflows/trivy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: trivy
3+
4+
on:
5+
pull_request:
6+
types: [ 'opened', 'reopened', 'synchronize' ]
7+
merge_group:
8+
workflow_dispatch:
9+
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
build:
18+
name: 'trivy scan'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Harden Runner
22+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
23+
with:
24+
egress-policy: audit
25+
26+
- name: Checkout code
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
29+
- name: Run Trivy vulnerability scanner (file system)
30+
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
31+
with:
32+
scan-type: 'fs'
33+
ignore-unfixed: true
34+
scan-ref: .
35+
format: 'sarif'
36+
scanners: 'vuln,secret,config'
37+
output: report-fs.sarif
38+
39+
- name: Upload Trivy report (fs) GitHub Security
40+
uses: github/codeql-action/upload-sarif@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
41+
with:
42+
sarif_file: report-fs.sarif
43+
category: 'fs'

docs/ARCHITECTURE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
- **WORKSPACES**: System-specific configuration and credentials management
1010
- **Reporting Engine**: Generates detailed HTML test reports
1111

12-
13-
1412
## Architecture
1513

1614
### High-Level Framework Structure
@@ -81,7 +79,8 @@ graph TB
8179
```
8280

8381
## Directory Structure
84-
```
82+
83+
```plain
8584
src/
8685
├── module_utils/ # Shared utilities and constants
8786
├── modules/ # Custom Ansible modules
@@ -119,4 +118,4 @@ sequenceDiagram
119118
Framework->>Reporting: Generate Failure Report
120119
Reporting-->>User: Failure Report
121120
end
122-
```
121+
```

docs/DB_HIGH_AVAILABILITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
| Secondary Node Kill | Process | The Secondary Node Kill test examines cluster resilience by forcefully terminating HANA processes on the secondary node using the kill -9 signal. The test validates that the primary node maintains normal operation while the secondary node undergoes recovery, ensuring cluster stability and proper data synchronization after the recovery process completes. | [node-kill.md](./pseudocode/node-kill.md) |
1717
| Secondary Echo B | System | The Secondary Echo B test simulates an uncontrolled system crash on the secondary HANA node by executing the 'echo b' command, triggering an immediate reboot without proper shutdown procedures. The test validates that the primary node maintains operation, verifies cluster stability, and ensures system replication resumes correctly after the secondary node recovers. | [echo-b.md](./pseudocode/echo-b.md) |
1818
| Filesystem Freeze | Storage | The Filesystem Freeze test validates cluster behavior when the primary node's filesystem becomes unresponsive. It simulates a storage issue by freezing the filesystem on the primary node running HANA database, which triggers automatic failover to the secondary node. The test verifies proper cluster reaction, resource migration, and data consistency after recovery. | [freeze-filesystem.md](./pseudocode/freeze-filesystem.md) |
19-
| SBD Fencing | Fencing | Validates cluster fencing mechanism by killing the SBD inquisitor process on the primary node. Tests proper fence detection, node isolation, and automated failover to ensure cluster integrity during hardware or communication failures. | [sbd-fencing.md](./pseudocode/sbd-fencing.md) |
19+
| SBD Fencing | Fencing | Validates cluster fencing mechanism by killing the SBD inquisitor process on the primary node. Tests proper fence detection, node isolation, and automated failover to ensure cluster integrity during hardware or communication failures. | [sbd-fencing.md](./pseudocode/sbd-fencing.md) |

docs/HIGH_AVAILABILITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ In summary, SAP High Availability testing is an integral part of the overall SAP
3232

3333
#### Optional Components
3434

35-
- **Analytics Integration** [Telemetry Setup Information](./docs/TELEMETRY_SETUP.md)
35+
- **Analytics Integration** [Telemetry Setup Information](./TELEMETRY_SETUP.md)
3636
- Azure Log Analytics
3737
- Azure Data Explorer
3838

@@ -232,4 +232,4 @@ cd WORKSPACES/SYSTEM/<SYSTEM_CONFIG_NAME>/quality_assurance/
232232

233233
## Additional Resources
234234

235-
- [Azure SAP Documentation](https://docs.microsoft.com/azure/sap)
235+
- [Azure SAP Documentation](https://docs.microsoft.com/azure/sap)

docs/TELEMETRY_SETUP.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This guide outlines the steps to create an Azure Data Explorer (Kusto) cluster a
77
## Azure Data Explorer (Kusto) Cluster Setup
88

99
1. **Log in to the Azure Portal:**
10-
Navigate to https://portal.azure.com and sign in with your Azure credentials.
10+
Navigate to [Azure Portal](https://portal.azure.com) and sign in with your Azure credentials.
1111

1212
2. **Create a Resource Group:**
1313
- Click on "Resource groups" in the left navigation pane.
@@ -43,12 +43,12 @@ This guide outlines the steps to create an Azure Data Explorer (Kusto) cluster a
4343
- **adx_cluster_fqdn:** Azure Data Explorer Cluster FQDN [Data Ingestion URI].
4444
- **adx_database_name:** Azure Data Explorer Database Name [Database Name]
4545
- **adx_client_id:** Azure Data Explorer Client ID [MSI Client ID]
46-
- **telemetry_table_name:** Name of the table in the ADX database [SAP_AUTOMATION_QA]
46+
- **telemetry_table_name:** Name of the table in the ADX database SAP_AUTOMATION_QA
4747

4848
## Azure Log Analytics Workspace Setup
4949

5050
1. **Log in to the Azure Portal:**
51-
Use https://portal.azure.com with your credentials.
51+
Login to [Azure Portal](https://portal.azure.com) with your credentials.
5252

5353
2. **Create a Resource Group (if needed):**
5454
If you haven't already created a resource group for Log Analytics, follow the same step as above.
@@ -65,7 +65,7 @@ This guide outlines the steps to create an Azure Data Explorer (Kusto) cluster a
6565
4. **Assign Azure Roles for Data Ingestion:**
6666
To ingest or work with data in a Log Analytics Workspace, assign the following roles:
6767
- **Log Analytics Contributor:** Grants permissions to submit and manage data in the workspace.
68-
68+
6969
To assign a role:
7070
- Navigate to the Log Analytics Workspace resource.
7171
- Click on "Access control (IAM)."
@@ -75,4 +75,4 @@ This guide outlines the steps to create an Azure Data Explorer (Kusto) cluster a
7575
5. **Parameters**
7676
- **laws_workspace_id:** Log Analytics Workspace ID [Workspace ID]
7777
- **laws_shared_key:** Log Analytics Shared Key [Primary Key]
78-
- **telemetry_table_name:** Name of the table in Log Analytics [SAP_AUTOMATION_QA]
78+
- **telemetry_table_name:** Name of the table in Log Analytics SAP_AUTOMATION_QA

0 commit comments

Comments
 (0)