secureapp-python-agent 26.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- secureapp_python_agent-26.5.0/.editorconfig +10 -0
- secureapp_python_agent-26.5.0/.gitignore +151 -0
- secureapp_python_agent-26.5.0/.gitlab-ci.yml +253 -0
- secureapp_python_agent-26.5.0/.o11y-doctor.yaml +20 -0
- secureapp_python_agent-26.5.0/.service-manifests/python-agent-component.yaml +20 -0
- secureapp_python_agent-26.5.0/CODEOWNERS +1 -0
- secureapp_python_agent-26.5.0/LICENSE +2 -0
- secureapp_python_agent-26.5.0/Makefile +226 -0
- secureapp_python_agent-26.5.0/PKG-INFO +119 -0
- secureapp_python_agent-26.5.0/README-Developers.md +213 -0
- secureapp_python_agent-26.5.0/README.md +73 -0
- secureapp_python_agent-26.5.0/buildAll.sh +7 -0
- secureapp_python_agent-26.5.0/buildO11y.sh +5 -0
- secureapp_python_agent-26.5.0/buildPublish.sh +25 -0
- secureapp_python_agent-26.5.0/dev/benchmarks/__init__.py +30 -0
- secureapp_python_agent-26.5.0/dev/benchmarks/benchmark_agent.py +190 -0
- secureapp_python_agent-26.5.0/dev/benchmarks/benchmark_dependency_analyzer.py +303 -0
- secureapp_python_agent-26.5.0/dev/benchmarks/benchmark_suite.py +197 -0
- secureapp_python_agent-26.5.0/dev/benchmarks/conftest.py +125 -0
- secureapp_python_agent-26.5.0/dev/compat_test_1.35.0.py +267 -0
- secureapp_python_agent-26.5.0/dev/compat_test_1.39.0.py +348 -0
- secureapp_python_agent-26.5.0/dev/data/golden-data.csv +23 -0
- secureapp_python_agent-26.5.0/dev/debug/debug_analyzer.py +219 -0
- secureapp_python_agent-26.5.0/dev/debug/utils.py +148 -0
- secureapp_python_agent-26.5.0/dev/scripts/check_license.py +102 -0
- secureapp_python_agent-26.5.0/dev/scripts/update_deps.py +108 -0
- secureapp_python_agent-26.5.0/docker/Dockerfile.agentic-ai +43 -0
- secureapp_python_agent-26.5.0/docker/Dockerfile.manual +38 -0
- secureapp_python_agent-26.5.0/docker/Dockerfile.zero-code +42 -0
- secureapp_python_agent-26.5.0/docker-compose.yml +113 -0
- secureapp_python_agent-26.5.0/examples/README.md +77 -0
- secureapp_python_agent-26.5.0/examples/common_flask_utils.py +180 -0
- secureapp_python_agent-26.5.0/examples/manual_flask_app.py +163 -0
- secureapp_python_agent-26.5.0/examples/requirements.txt +20 -0
- secureapp_python_agent-26.5.0/examples/zero_code_agentic_ai_app.py +334 -0
- secureapp_python_agent-26.5.0/examples/zero_code_flask_app.py +43 -0
- secureapp_python_agent-26.5.0/o11y_test_application/otel-collector/splunk-otel-config.yaml +57 -0
- secureapp_python_agent-26.5.0/o11y_test_application/otel-collector/start-splunk-otel-collector.sh +16 -0
- secureapp_python_agent-26.5.0/o11y_test_application/packages-with-cves.txt +11 -0
- secureapp_python_agent-26.5.0/o11y_test_application/runit.sh +30 -0
- secureapp_python_agent-26.5.0/o11y_test_application/test_application.py +25 -0
- secureapp_python_agent-26.5.0/otel-collector-config.yml +50 -0
- secureapp_python_agent-26.5.0/pyproject.toml +223 -0
- secureapp_python_agent-26.5.0/renovate.json +21 -0
- secureapp_python_agent-26.5.0/setup.cfg +4 -0
- secureapp_python_agent-26.5.0/sonar-project.properties +3 -0
- secureapp_python_agent-26.5.0/src/secureapp_python_agent.egg-info/PKG-INFO +119 -0
- secureapp_python_agent-26.5.0/src/secureapp_python_agent.egg-info/SOURCES.txt +62 -0
- secureapp_python_agent-26.5.0/src/secureapp_python_agent.egg-info/dependency_links.txt +1 -0
- secureapp_python_agent-26.5.0/src/secureapp_python_agent.egg-info/entry_points.txt +5 -0
- secureapp_python_agent-26.5.0/src/secureapp_python_agent.egg-info/requires.txt +28 -0
- secureapp_python_agent-26.5.0/src/secureapp_python_agent.egg-info/top_level.txt +1 -0
- secureapp_python_agent-26.5.0/src/splunk_secureapp_opentelemetry_extension/__init__.py +38 -0
- secureapp_python_agent-26.5.0/src/splunk_secureapp_opentelemetry_extension/agent.py +304 -0
- secureapp_python_agent-26.5.0/src/splunk_secureapp_opentelemetry_extension/dependency_analyzer.py +528 -0
- secureapp_python_agent-26.5.0/src/splunk_secureapp_opentelemetry_extension/environment_variables.py +59 -0
- secureapp_python_agent-26.5.0/src/splunk_secureapp_opentelemetry_extension/py.typed +0 -0
- secureapp_python_agent-26.5.0/src/splunk_secureapp_opentelemetry_extension/utils.py +86 -0
- secureapp_python_agent-26.5.0/tests/__init__.py +6 -0
- secureapp_python_agent-26.5.0/tests/test_agent.py +715 -0
- secureapp_python_agent-26.5.0/tests/test_dependency_analyzer.py +1604 -0
- secureapp_python_agent-26.5.0/tests/test_environment_variables.py +74 -0
- secureapp_python_agent-26.5.0/tests/test_integration.py +436 -0
- secureapp_python_agent-26.5.0/tests/test_package_import.py +78 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# Virtual environments
|
|
29
|
+
venv/
|
|
30
|
+
env/
|
|
31
|
+
ENV/
|
|
32
|
+
.venv/
|
|
33
|
+
.env/
|
|
34
|
+
|
|
35
|
+
# PyInstaller
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
pytest-results.xml
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
.testmondata
|
|
57
|
+
|
|
58
|
+
# Setuptools-scm auto-generated version file
|
|
59
|
+
src/splunk_secureapp_opentelemetry_extension/_version.py
|
|
60
|
+
|
|
61
|
+
# Translations
|
|
62
|
+
*.mo
|
|
63
|
+
*.pot
|
|
64
|
+
|
|
65
|
+
# Django stuff:
|
|
66
|
+
*.log
|
|
67
|
+
local_settings.py
|
|
68
|
+
db.sqlite3
|
|
69
|
+
|
|
70
|
+
# Flask stuff:
|
|
71
|
+
instance/
|
|
72
|
+
.webassets-cache
|
|
73
|
+
|
|
74
|
+
# Scrapy stuff:
|
|
75
|
+
.scrapy
|
|
76
|
+
|
|
77
|
+
# Sphinx documentation
|
|
78
|
+
docs/_build/
|
|
79
|
+
|
|
80
|
+
# PyBuilder
|
|
81
|
+
target/
|
|
82
|
+
|
|
83
|
+
# Jupyter Notebook
|
|
84
|
+
.ipynb_checkpoints
|
|
85
|
+
|
|
86
|
+
# IPython
|
|
87
|
+
profile_default/
|
|
88
|
+
ipython_config.py
|
|
89
|
+
|
|
90
|
+
# pyenv
|
|
91
|
+
.python-version
|
|
92
|
+
|
|
93
|
+
# celery beat schedule file
|
|
94
|
+
celerybeat-schedule
|
|
95
|
+
|
|
96
|
+
# SageMath parsed files
|
|
97
|
+
*.sage.py
|
|
98
|
+
|
|
99
|
+
# Spyder project settings
|
|
100
|
+
.spyderproject
|
|
101
|
+
.spyproject
|
|
102
|
+
|
|
103
|
+
# Rope project settings
|
|
104
|
+
.ropeproject
|
|
105
|
+
|
|
106
|
+
# mkdocs documentation
|
|
107
|
+
/site
|
|
108
|
+
|
|
109
|
+
# mypy
|
|
110
|
+
.mypy_cache/
|
|
111
|
+
.dmypy.json
|
|
112
|
+
dmypy.json
|
|
113
|
+
|
|
114
|
+
# Pyre type checker
|
|
115
|
+
.pyre/
|
|
116
|
+
|
|
117
|
+
# IDE files
|
|
118
|
+
.vscode/
|
|
119
|
+
.idea/
|
|
120
|
+
*.swp
|
|
121
|
+
*.swo
|
|
122
|
+
*~
|
|
123
|
+
|
|
124
|
+
# macOS
|
|
125
|
+
.DS_Store
|
|
126
|
+
|
|
127
|
+
# Windows
|
|
128
|
+
Thumbs.db
|
|
129
|
+
ehthumbs.db
|
|
130
|
+
Desktop.ini
|
|
131
|
+
|
|
132
|
+
# Security reports
|
|
133
|
+
bandit-report.json
|
|
134
|
+
safety-report.json
|
|
135
|
+
|
|
136
|
+
# Temporary files
|
|
137
|
+
*.tmp
|
|
138
|
+
*.temp
|
|
139
|
+
.temp/
|
|
140
|
+
|
|
141
|
+
# Local configuration and logs
|
|
142
|
+
logs/
|
|
143
|
+
.env.local
|
|
144
|
+
.env.*.local
|
|
145
|
+
|
|
146
|
+
# Backup files
|
|
147
|
+
*.bak
|
|
148
|
+
*.backup
|
|
149
|
+
|
|
150
|
+
# Logs directory for logging
|
|
151
|
+
logs/*
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
include:
|
|
2
|
+
- project: observability/shared/gitlab-jobs
|
|
3
|
+
ref: 3.1.15
|
|
4
|
+
file:
|
|
5
|
+
- oss-scan-template.yml
|
|
6
|
+
- sast-scan-template.yml
|
|
7
|
+
- template: "Workflows/MergeRequest-Pipelines.gitlab-ci.yml"
|
|
8
|
+
- project: ci-cd/templates
|
|
9
|
+
file: /cicd/sonarqube-3.0.1.yml
|
|
10
|
+
|
|
11
|
+
variables:
|
|
12
|
+
# Using Python 3.13 with trixie (Debian 13) base
|
|
13
|
+
PY3_IMAGE: docker.repo.splunkdev.net/ci-cd/ci-container/python-3.13-trixie:5.3.0
|
|
14
|
+
# Ensure full git history for setuptools-scm versioning
|
|
15
|
+
GIT_DEPTH: 0
|
|
16
|
+
# Set cache configuration
|
|
17
|
+
CACHE_KEY: ${CI_COMMIT_REF_SLUG}
|
|
18
|
+
CACHE_PATHS: ".pip-cache/"
|
|
19
|
+
ENABLE_SONARQUBE:
|
|
20
|
+
value: "true"
|
|
21
|
+
options:
|
|
22
|
+
- "true"
|
|
23
|
+
- "false"
|
|
24
|
+
description: >-
|
|
25
|
+
Enable SonarQube code quality scanning. Set to 'false' to disable.
|
|
26
|
+
|
|
27
|
+
image: ${PY3_IMAGE}
|
|
28
|
+
|
|
29
|
+
stages:
|
|
30
|
+
- code_analysis
|
|
31
|
+
- test
|
|
32
|
+
- build
|
|
33
|
+
- publish
|
|
34
|
+
|
|
35
|
+
# Enable caching to speed up dependency installation
|
|
36
|
+
cache:
|
|
37
|
+
key: ${CACHE_KEY}
|
|
38
|
+
paths:
|
|
39
|
+
- ${CACHE_PATHS}
|
|
40
|
+
when: always
|
|
41
|
+
|
|
42
|
+
# Global before_script for dependency installation optimization
|
|
43
|
+
.base_setup: &base_setup
|
|
44
|
+
before_script:
|
|
45
|
+
- mkdir -p .pip-cache
|
|
46
|
+
- pip config set global.cache-dir .pip-cache
|
|
47
|
+
- make venv-install
|
|
48
|
+
|
|
49
|
+
# Core unit tests with coverage validation
|
|
50
|
+
test:unit:
|
|
51
|
+
stage: test
|
|
52
|
+
<<: *base_setup
|
|
53
|
+
script:
|
|
54
|
+
- make all # Runs format, lint, typecheck, test with 85% coverage
|
|
55
|
+
coverage: '/TOTAL.*\s+(\d+%)$/'
|
|
56
|
+
artifacts:
|
|
57
|
+
reports:
|
|
58
|
+
junit: pytest-results.xml # Added for better GitLab test integration
|
|
59
|
+
coverage_report:
|
|
60
|
+
coverage_format: cobertura
|
|
61
|
+
path: coverage.xml
|
|
62
|
+
paths:
|
|
63
|
+
- htmlcov/
|
|
64
|
+
- coverage.xml
|
|
65
|
+
rules:
|
|
66
|
+
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
67
|
+
when: never
|
|
68
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
69
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
70
|
+
- if: $CI_COMMIT_TAG
|
|
71
|
+
|
|
72
|
+
# Build stage with proper dependencies
|
|
73
|
+
build:wheel:
|
|
74
|
+
stage: build
|
|
75
|
+
needs:
|
|
76
|
+
- semgrep
|
|
77
|
+
- test:unit # Ensures tests pass with 85% coverage
|
|
78
|
+
<<: *base_setup
|
|
79
|
+
script:
|
|
80
|
+
- make build
|
|
81
|
+
artifacts:
|
|
82
|
+
paths:
|
|
83
|
+
- dist/
|
|
84
|
+
rules:
|
|
85
|
+
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
86
|
+
when: never
|
|
87
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
88
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
89
|
+
- if: $CI_COMMIT_TAG
|
|
90
|
+
|
|
91
|
+
# Shared publish template to reduce duplication
|
|
92
|
+
.publish_template: &publish_template
|
|
93
|
+
stage: publish
|
|
94
|
+
<<: *base_setup
|
|
95
|
+
script:
|
|
96
|
+
- venv/bin/python -m twine check dist/*
|
|
97
|
+
- venv/bin/python -m twine upload --verbose --non-interactive ${TWINE_REPOSITORY_URL:+--skip-existing} dist/*
|
|
98
|
+
# testPypi - using variable set TEST_TWINE_PASSWORD to API TOKEN - Tag PyPITest
|
|
99
|
+
publish:test:
|
|
100
|
+
<<: *publish_template
|
|
101
|
+
needs:
|
|
102
|
+
- job: build:wheel
|
|
103
|
+
artifacts: true
|
|
104
|
+
variables:
|
|
105
|
+
TWINE_USERNAME: __token__
|
|
106
|
+
TWINE_PASSWORD: $TEST_TWINE_PASSWORD
|
|
107
|
+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
|
|
108
|
+
rules:
|
|
109
|
+
- if: '$CI_COMMIT_TAG == "PyPITest"'
|
|
110
|
+
# pypi - using o11y-gdi set API TOKEN
|
|
111
|
+
publish:production:
|
|
112
|
+
<<: *publish_template
|
|
113
|
+
needs:
|
|
114
|
+
- job: build:wheel
|
|
115
|
+
artifacts: true
|
|
116
|
+
variables:
|
|
117
|
+
TWINE_USERNAME: __token__
|
|
118
|
+
TWINE_PASSWORD: $TWINE_PASSWORD
|
|
119
|
+
rules:
|
|
120
|
+
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
121
|
+
when: never
|
|
122
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
123
|
+
|
|
124
|
+
# Python version compatibility matrix testing
|
|
125
|
+
test:python-matrix:
|
|
126
|
+
stage: test
|
|
127
|
+
image: docker.repo.splunkdev.net/ci-cd/ci-container/python-${PYTHON_VERSION}-trixie:5.3.0
|
|
128
|
+
needs:
|
|
129
|
+
- test:unit # Explicit dependency for better pipeline visualization
|
|
130
|
+
<<: *base_setup
|
|
131
|
+
script:
|
|
132
|
+
- make test # Run tests for the specific Python version in this container
|
|
133
|
+
artifacts:
|
|
134
|
+
reports:
|
|
135
|
+
junit: pytest-results.xml
|
|
136
|
+
paths:
|
|
137
|
+
- htmlcov/
|
|
138
|
+
- coverage.xml
|
|
139
|
+
parallel:
|
|
140
|
+
matrix:
|
|
141
|
+
- PYTHON_VERSION: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
142
|
+
rules:
|
|
143
|
+
# Run on main branch for comprehensive validation
|
|
144
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
145
|
+
# Run on git tags to ensure release compatibility
|
|
146
|
+
- if: $CI_COMMIT_TAG
|
|
147
|
+
# Manual trigger for merge requests (allow_failure for optional testing)
|
|
148
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
149
|
+
|
|
150
|
+
# Add OpenTelemetry version compatibility testing
|
|
151
|
+
test:otel-versions:
|
|
152
|
+
stage: test
|
|
153
|
+
image: ${PY3_IMAGE}
|
|
154
|
+
needs:
|
|
155
|
+
- test:unit
|
|
156
|
+
<<: *base_setup
|
|
157
|
+
script:
|
|
158
|
+
- pip uninstall -y opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp
|
|
159
|
+
- pip install opentelemetry-api==${OTEL_VERSION} opentelemetry-sdk==${OTEL_VERSION} opentelemetry-exporter-otlp==${OTEL_VERSION}
|
|
160
|
+
- echo "Installed OpenTelemetry packages:"
|
|
161
|
+
- pip show opentelemetry-api | grep "Version"
|
|
162
|
+
- pip show opentelemetry-sdk | grep "Version"
|
|
163
|
+
- pip show opentelemetry-exporter-otlp | grep "Version"
|
|
164
|
+
- make test
|
|
165
|
+
parallel:
|
|
166
|
+
matrix:
|
|
167
|
+
- OTEL_VERSION: ["1.27.0", "1.30.0", "1.35.0", "1.38.0", "1.39.0", "1.39.1"]
|
|
168
|
+
rules:
|
|
169
|
+
# Run on main branch for comprehensive validation
|
|
170
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
171
|
+
# Run on git tags to ensure release compatibility
|
|
172
|
+
- if: $CI_COMMIT_TAG
|
|
173
|
+
# Manual trigger for merge requests
|
|
174
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
175
|
+
when: manual
|
|
176
|
+
allow_failure: true
|
|
177
|
+
|
|
178
|
+
# Performance benchmarks and validation
|
|
179
|
+
test:benchmarks:
|
|
180
|
+
stage: test
|
|
181
|
+
needs:
|
|
182
|
+
- test:unit # Ensure core tests pass before performance testing
|
|
183
|
+
<<: *base_setup
|
|
184
|
+
script:
|
|
185
|
+
- make benchmark # Runs performance benchmarks with mocking
|
|
186
|
+
artifacts:
|
|
187
|
+
reports:
|
|
188
|
+
junit: dev/benchmarks/results/benchmark-results.xml
|
|
189
|
+
paths:
|
|
190
|
+
- dev/benchmarks/results/
|
|
191
|
+
variables:
|
|
192
|
+
# Performance testing configuration
|
|
193
|
+
SPLUNK_SECUREAPP_DEPENDENCY_INITIAL_DELAY: "1"
|
|
194
|
+
SPLUNK_SECUREAPP_DEPENDENCY_SCAN_INTERVAL: "30"
|
|
195
|
+
rules:
|
|
196
|
+
# Run performance tests on main branch
|
|
197
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
198
|
+
when: manual
|
|
199
|
+
allow_failure: true
|
|
200
|
+
# Run on git tags to validate release performance
|
|
201
|
+
- if: $CI_COMMIT_TAG
|
|
202
|
+
when: manual
|
|
203
|
+
allow_failure: true
|
|
204
|
+
# Optional for merge requests
|
|
205
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
206
|
+
when: manual
|
|
207
|
+
allow_failure: true
|
|
208
|
+
|
|
209
|
+
sonarqube:
|
|
210
|
+
stage: test
|
|
211
|
+
interruptible: true
|
|
212
|
+
allow_failure: true
|
|
213
|
+
needs:
|
|
214
|
+
- job: test:unit
|
|
215
|
+
optional: true
|
|
216
|
+
artifacts: true
|
|
217
|
+
rules:
|
|
218
|
+
- if: $ENABLE_SONARQUBE != "true"
|
|
219
|
+
when: never
|
|
220
|
+
- if: $CI_COMMIT_TAG
|
|
221
|
+
- if: $CI_MERGE_REQUEST_IID
|
|
222
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
223
|
+
script:
|
|
224
|
+
- |
|
|
225
|
+
SONAR_ARGS="-Dsonar.qualitygate.wait=true"
|
|
226
|
+
if [ -n "$CI_COMMIT_TAG" ]; then
|
|
227
|
+
SONAR_ARGS="${SONAR_ARGS} -Dsonar.branch.name=${CI_DEFAULT_BRANCH}"
|
|
228
|
+
echo "Tag detected: reporting analysis to branch ${CI_DEFAULT_BRANCH}"
|
|
229
|
+
elif [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
|
|
230
|
+
SONAR_ARGS="${SONAR_ARGS} -Dsonar.branch.name=${CI_DEFAULT_BRANCH}"
|
|
231
|
+
echo "Default branch: reporting analysis to branch ${CI_DEFAULT_BRANCH}"
|
|
232
|
+
fi
|
|
233
|
+
SONAR_AUTH_TOKEN="${SONAR_TOKEN:-$SONAR_LOGIN_TOKEN}"
|
|
234
|
+
if [ -z "$SONAR_AUTH_TOKEN" ]; then
|
|
235
|
+
if [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ] && [ "$CI_COMMIT_REF_PROTECTED" != "true" ]; then
|
|
236
|
+
echo "Skipping SonarQube analysis: SONAR_TOKEN or SONAR_LOGIN_TOKEN is unavailable for this unprotected merge request ref."
|
|
237
|
+
exit 0
|
|
238
|
+
fi
|
|
239
|
+
echo "SONAR_TOKEN or SONAR_LOGIN_TOKEN must be configured for SonarQube analysis."
|
|
240
|
+
exit 1
|
|
241
|
+
fi
|
|
242
|
+
sonar-scanner -Dsonar.token="$SONAR_AUTH_TOKEN" ${SONAR_ARGS}
|
|
243
|
+
after_script:
|
|
244
|
+
- |
|
|
245
|
+
if [ "$CI_JOB_STATUS" = "failed" ]; then
|
|
246
|
+
mkdir -p .scannerwork
|
|
247
|
+
touch .scannerwork/.keep
|
|
248
|
+
fi
|
|
249
|
+
artifacts:
|
|
250
|
+
paths:
|
|
251
|
+
- .scannerwork/
|
|
252
|
+
when: on_failure
|
|
253
|
+
expire_in: 7 days
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# The Doctor (http://go/the-doctor) configuration for this repository
|
|
2
|
+
|
|
3
|
+
assignMergeRequestReviewersFromGroups:
|
|
4
|
+
groups:
|
|
5
|
+
- sg-cloud-o11y-secureapp-dev
|
|
6
|
+
ignoreLabels:
|
|
7
|
+
- dependency-update
|
|
8
|
+
except:
|
|
9
|
+
- bot_polyjuice
|
|
10
|
+
|
|
11
|
+
closeStaleMergeRequests:
|
|
12
|
+
staleAfterDays: 28
|
|
13
|
+
closeAfterStaleDays: 7
|
|
14
|
+
|
|
15
|
+
unassignReviewersFromDrafts: {}
|
|
16
|
+
|
|
17
|
+
assignUnassignedMergeRequests: {}
|
|
18
|
+
|
|
19
|
+
approveRenovateUpdates:
|
|
20
|
+
requireLabel: auto-merge-enabled
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
apiVersion: backstage.io/v1alpha1
|
|
3
|
+
kind: Component
|
|
4
|
+
metadata:
|
|
5
|
+
name: secure-app-python
|
|
6
|
+
title: secure-app-python
|
|
7
|
+
functionalDomain:
|
|
8
|
+
- o11y
|
|
9
|
+
description: This is secureapp backend
|
|
10
|
+
annotations:
|
|
11
|
+
backstage.io/source-location: url:https://cd.splunkdev.com/o11y-gdi/secure-app-python
|
|
12
|
+
splunk.com/issue-tracker-url: https://splunk.atlassian.net/jira/software/c/projects
|
|
13
|
+
splunk.com/slack-url: http://go/slack/o11y-app-platform
|
|
14
|
+
backstage.io/view-url: https://cd.splunkdev.com/o11y-gdi/secure-app-python/.service-manifests/python-agent-component.yaml
|
|
15
|
+
backstage.io/edit-url: https://cd.splunkdev.com/o11y-gdi/secure-app-python/.service-manifests/python-agent-component.yaml
|
|
16
|
+
links: []
|
|
17
|
+
spec:
|
|
18
|
+
lifecycle: experimental
|
|
19
|
+
type: service
|
|
20
|
+
owner: group:sg-cloud-o11y-secureapp-dev
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @okta-groups/sg-cloud-o11y-secureapp-dev @okta-groups/sg-cloud-o11y-gdi-eng
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Makefile for Splunk SecureApp Python Agent Development
|
|
2
|
+
|
|
3
|
+
VENV_NAME ?= venv
|
|
4
|
+
VENV_DIR := $(VENV_NAME)
|
|
5
|
+
PYTHON := $(VENV_DIR)/bin/python
|
|
6
|
+
PIP := $(VENV_DIR)/bin/pip
|
|
7
|
+
|
|
8
|
+
# OpenTelemetry packages for version testing
|
|
9
|
+
OTEL_PACKAGES := opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp
|
|
10
|
+
|
|
11
|
+
# Reusable functions
|
|
12
|
+
define install_otel_version
|
|
13
|
+
$(PYTHON) -m pip uninstall -y $(OTEL_PACKAGES)
|
|
14
|
+
$(PYTHON) -m pip install $(foreach pkg,$(OTEL_PACKAGES),$(pkg)==$(1))
|
|
15
|
+
endef
|
|
16
|
+
|
|
17
|
+
define restore_deps
|
|
18
|
+
@echo "๐ Restoring original dependencies..."
|
|
19
|
+
$(PYTHON) -m pip uninstall -y $(OTEL_PACKAGES)
|
|
20
|
+
$(PYTHON) -m pip install -e .
|
|
21
|
+
endef
|
|
22
|
+
|
|
23
|
+
.PHONY: help venv-install test test-matrix tox lint format typecheck \
|
|
24
|
+
check-license build clean all benchmark debug debug-packages debug-performance \
|
|
25
|
+
publish validate-env show-version test-otel-versions quick-test venv-update \
|
|
26
|
+
test-otel-version test-local-otel-matrix
|
|
27
|
+
|
|
28
|
+
help:
|
|
29
|
+
@echo "SecureApp Python Agent - Development Commands"
|
|
30
|
+
@echo ""
|
|
31
|
+
@echo "๐ Quick Start:"
|
|
32
|
+
@echo " make venv-install # One-time setup: creates venv + installs all dependencies"
|
|
33
|
+
@echo " make all # Complete validation pipeline (matches GitLab CI exactly)"
|
|
34
|
+
@echo ""
|
|
35
|
+
@echo "๐ Setup & Environment:"
|
|
36
|
+
@echo " venv-install - Setup development environment with all dependencies"
|
|
37
|
+
@echo " venv-update - Update existing venv with new dependencies (faster than reinstall)"
|
|
38
|
+
@echo " validate-env - Validate Python version and tool availability"
|
|
39
|
+
@echo ""
|
|
40
|
+
@echo "๐งช Testing Commands:"
|
|
41
|
+
@echo " all - Complete validation: format โ lint โ typecheck โ test (85% coverage)"
|
|
42
|
+
@echo " test - Run tests with 85% coverage requirement"
|
|
43
|
+
@echo " quick-test - Run only tests affected by recent changes (fastest for development)"
|
|
44
|
+
@echo ""
|
|
45
|
+
@echo "๐ฌ Compatibility Testing:"
|
|
46
|
+
@echo " test-matrix - Run tests across all Python versions (PARALLEL: faster, uses tox -p auto)"
|
|
47
|
+
@echo " tox - Run tests across all Python versions (SEQUENTIAL: slower, clearer output)"
|
|
48
|
+
@echo " test-otel-versions - Test with different OpenTelemetry versions"
|
|
49
|
+
@echo " test-otel-version - Test with a specific OpenTelemetry version (OTEL_VERSION=X.Y.Z)"
|
|
50
|
+
@echo " test-local-otel-matrix - Run full OTel version matrix tests locally"
|
|
51
|
+
@echo ""
|
|
52
|
+
@echo "๐ง Code Quality:"
|
|
53
|
+
@echo " format - Format code with ruff (auto-fixes style issues)"
|
|
54
|
+
@echo " lint - Run linting with auto-fix (catches bugs + style violations)"
|
|
55
|
+
@echo " typecheck - Run type checking with mypy (ensures type safety)"
|
|
56
|
+
@echo " check-license - Verify and add license headers to Python files"
|
|
57
|
+
@echo ""
|
|
58
|
+
@echo "๐ Performance & Analysis:"
|
|
59
|
+
@echo " benchmark - Run complete benchmark suite (startup, memory, CPU impact)"
|
|
60
|
+
@echo " debug - Interactive debug analyzer (explore runtime state)"
|
|
61
|
+
@echo ""
|
|
62
|
+
@echo "๐ Debug & Troubleshooting:"
|
|
63
|
+
@echo " debug-packages - Show current runtime package analysis"
|
|
64
|
+
@echo " debug-performance - Run performance analysis"
|
|
65
|
+
@echo ""
|
|
66
|
+
@echo "๐ฆ Build & Release:"
|
|
67
|
+
@echo " build - Build distribution packages (wheel + sdist)"
|
|
68
|
+
@echo " publish - Publish package to Artifactory (requires credentials)"
|
|
69
|
+
@echo " clean - Clean all build artifacts and caches (preserves venv)"
|
|
70
|
+
@echo " show-version - Show current version from setuptools-scm"
|
|
71
|
+
@echo ""
|
|
72
|
+
@echo "๐ก Common Workflows:"
|
|
73
|
+
@echo " โข Daily Development: make quick-test โ make all"
|
|
74
|
+
@echo " โข Before Committing: make all"
|
|
75
|
+
@echo " โข OpenTelemetry Changes: make test-otel-versions"
|
|
76
|
+
@echo " โข Python Version Testing: make tox (tests Python 3.10-3.14)"
|
|
77
|
+
@echo " โข Performance Validation: make benchmark or tox -e benchmark"
|
|
78
|
+
@echo " โข Environment Update: make venv-update โ make validate-env"
|
|
79
|
+
@echo ""
|
|
80
|
+
@echo "๐ Requirements:"
|
|
81
|
+
@echo " โข Performance: <100ms startup, <10MB memory, 85%+ coverage"
|
|
82
|
+
@echo " โข Compatibility: Python 3.10-3.14, OpenTelemetry 1.27.0-1.39.x (tested up to 1.39.1)"
|
|
83
|
+
|
|
84
|
+
# Setup development environment (one command for new developers)
|
|
85
|
+
$(PYTHON):
|
|
86
|
+
@echo "๐ Creating virtual environment..."
|
|
87
|
+
python3 -m venv $(VENV_DIR)
|
|
88
|
+
$(PIP) install --upgrade pip
|
|
89
|
+
|
|
90
|
+
venv-install: $(PYTHON)
|
|
91
|
+
$(PIP) install -e .[dev]
|
|
92
|
+
@echo "โ
Development environment ready!"
|
|
93
|
+
@echo "Run 'make all' to validate your setup."
|
|
94
|
+
|
|
95
|
+
# Update existing venv with new dependencies (faster than reinstall)
|
|
96
|
+
venv-update: $(PYTHON)
|
|
97
|
+
@echo "๐ Updating virtual environment dependencies..."
|
|
98
|
+
$(PIP) install --upgrade pip
|
|
99
|
+
$(PIP) install -e .[dev] --upgrade
|
|
100
|
+
@echo "โ
Dependencies updated!"
|
|
101
|
+
|
|
102
|
+
# Core development workflow
|
|
103
|
+
test:
|
|
104
|
+
$(PYTHON) -m pytest tests --junit-xml=pytest-results.xml
|
|
105
|
+
|
|
106
|
+
# Run only tests affected by recent changes (fastest for development)
|
|
107
|
+
quick-test:
|
|
108
|
+
@echo "๐ Running only tests affected by recent changes..."
|
|
109
|
+
$(PYTHON) -m pytest tests -xvs --testmon --no-cov
|
|
110
|
+
|
|
111
|
+
tox:
|
|
112
|
+
tox
|
|
113
|
+
|
|
114
|
+
lint:
|
|
115
|
+
$(PYTHON) -m ruff check src tests dev --fix
|
|
116
|
+
|
|
117
|
+
format:
|
|
118
|
+
$(PYTHON) -m ruff format src tests dev
|
|
119
|
+
|
|
120
|
+
typecheck:
|
|
121
|
+
$(PYTHON) -m mypy src tests
|
|
122
|
+
|
|
123
|
+
check-license:
|
|
124
|
+
@echo "๐ Checking license headers..."
|
|
125
|
+
@echo "Files being checked: src/ tests/ dev/ examples/"
|
|
126
|
+
find src tests dev examples -name "*.py" -type f -exec $(PYTHON) dev/scripts/check_license.py {} +
|
|
127
|
+
@echo "โ
License check complete"
|
|
128
|
+
|
|
129
|
+
# Build distribution packages
|
|
130
|
+
build:
|
|
131
|
+
$(PYTHON) -m build
|
|
132
|
+
|
|
133
|
+
clean:
|
|
134
|
+
@echo "๐งน Cleaning build artifacts and caches..."
|
|
135
|
+
rm -rf build/ dist/ *.egg-info/ src/*.egg-info/ venv/ logs/
|
|
136
|
+
rm -rf .coverage* .testmondata pytest-results.xml htmlcov/ coverage.xml .pytest_cache/ .mypy_cache/ .ruff_cache/ .tox/
|
|
137
|
+
rm -rf tests/htmlcov/ tests/coverage.xml tests/.coverage
|
|
138
|
+
rm -rf dev/benchmarks/results/ dev/benchmarks/.pytest_cache/
|
|
139
|
+
rm -f src/splunk_secureapp_opentelemetry_extension/_version.py
|
|
140
|
+
rm -f o11y_test_application/otel-collector/otelcol_darwin_amd64
|
|
141
|
+
rm -f o11y_test_application/otel-collector/out.txt
|
|
142
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
143
|
+
find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
144
|
+
find . -type f -name "*.pyo" -delete 2>/dev/null || true
|
|
145
|
+
find . -type f -name "*.orig" -delete 2>/dev/null || true
|
|
146
|
+
find . -type f -name "*.rej" -delete 2>/dev/null || true
|
|
147
|
+
find . -type f -name ".DS_Store" -delete 2>/dev/null || true
|
|
148
|
+
@echo "โ
Clean complete"
|
|
149
|
+
|
|
150
|
+
# Complete validation pipeline - enforces 85% coverage
|
|
151
|
+
all: format lint typecheck test
|
|
152
|
+
@echo "โ
All checks passed! (format โ lint โ typecheck โ test with 85% coverage)"
|
|
153
|
+
|
|
154
|
+
# Performance benchmarks
|
|
155
|
+
benchmark:
|
|
156
|
+
@echo "๐ Running benchmark suite..."
|
|
157
|
+
$(PYTHON) dev/benchmarks/benchmark_suite.py
|
|
158
|
+
|
|
159
|
+
# Debug and analysis tools
|
|
160
|
+
debug:
|
|
161
|
+
@echo "๐ Starting debug analyzer..."
|
|
162
|
+
$(PYTHON) dev/debug/debug_analyzer.py --analyze
|
|
163
|
+
|
|
164
|
+
debug-packages:
|
|
165
|
+
@echo "๐ฆ Analyzing runtime packages..."
|
|
166
|
+
$(PYTHON) dev/debug/debug_analyzer.py
|
|
167
|
+
|
|
168
|
+
debug-performance:
|
|
169
|
+
@echo "โก Running performance analysis..."
|
|
170
|
+
$(PYTHON) dev/debug/debug_analyzer.py --performance
|
|
171
|
+
|
|
172
|
+
# CI/CD Publishing target - added to go to real test pypi - config set in .pypirc - called by buildPublish.sh testpypi
|
|
173
|
+
publish_testpypi:
|
|
174
|
+
@echo "๐ฆ Publishing package to repository: testpypi..."
|
|
175
|
+
$(PYTHON) -m twine upload dist/* --repository testpypi
|
|
176
|
+
|
|
177
|
+
# Matrix testing across Python versions (for advanced CI)
|
|
178
|
+
test-matrix:
|
|
179
|
+
@echo "๐ฌ Running matrix tests..."
|
|
180
|
+
tox -p auto
|
|
181
|
+
|
|
182
|
+
# Test with different OpenTelemetry versions
|
|
183
|
+
test-otel-versions:
|
|
184
|
+
@echo "๐ฌ Testing across OpenTelemetry versions (1.27.0 to 1.35.0)..."
|
|
185
|
+
$(call install_otel_version,1.27.0)
|
|
186
|
+
@echo "โ
Testing with OpenTelemetry 1.27.0..."
|
|
187
|
+
$(PYTHON) -m pytest tests --no-cov
|
|
188
|
+
$(call install_otel_version,1.35.0)
|
|
189
|
+
@echo "โ
Testing with OpenTelemetry 1.35.0..."
|
|
190
|
+
$(PYTHON) -m pytest tests --no-cov
|
|
191
|
+
$(call restore_deps)
|
|
192
|
+
@echo "โ
OpenTelemetry compatibility testing completed successfully!"
|
|
193
|
+
|
|
194
|
+
# Test with a specific OpenTelemetry version
|
|
195
|
+
test-otel-version:
|
|
196
|
+
@test -n "$(OTEL_VERSION)" || (echo "โ Error: OTEL_VERSION not specified" && echo "Usage: make test-otel-version OTEL_VERSION=X.Y.Z" && exit 1)
|
|
197
|
+
@echo "๐ฌ Testing with OpenTelemetry $(OTEL_VERSION)..."
|
|
198
|
+
$(call install_otel_version,$(OTEL_VERSION))
|
|
199
|
+
@$(PYTHON) -c "from importlib.metadata import distributions; pkgs=sorted('{}=={}'.format(name, d.version) for d in distributions() for name in [d.metadata.get('Name') or ''] if 'opentelemetry' in name.lower()); print('โ
Installed:', ', '.join(pkgs))"
|
|
200
|
+
$(PYTHON) -m pytest tests
|
|
201
|
+
$(call restore_deps)
|
|
202
|
+
@echo "โ
OpenTelemetry compatibility testing completed successfully!"
|
|
203
|
+
|
|
204
|
+
# Run local OpenTelemetry matrix testing
|
|
205
|
+
test-local-otel-matrix:
|
|
206
|
+
@echo "๐ฌ Running full OpenTelemetry version matrix tests locally..."
|
|
207
|
+
@for version in 1.27.0 1.30.0 1.35.0 1.38.0 1.39.0 1.39.1; do \
|
|
208
|
+
echo "๐ฌ Testing with OpenTelemetry $$version..."; \
|
|
209
|
+
$(PYTHON) -m pip uninstall -y $(OTEL_PACKAGES); \
|
|
210
|
+
$(PYTHON) -m pip install $(foreach pkg,$(OTEL_PACKAGES),$(pkg)==$$version); \
|
|
211
|
+
$(PYTHON) -m pytest tests --no-cov || exit 1; \
|
|
212
|
+
done
|
|
213
|
+
$(call restore_deps)
|
|
214
|
+
@echo "โ
OpenTelemetry matrix testing completed successfully!"
|
|
215
|
+
|
|
216
|
+
# Validate environment and dependencies
|
|
217
|
+
validate-env:
|
|
218
|
+
@echo "โ
Validating environment..."
|
|
219
|
+
@$(PYTHON) --version
|
|
220
|
+
@$(PYTHON) -c "import sys; print(f'Python: {sys.version}')"
|
|
221
|
+
@$(PYTHON) -c "import pytest, ruff, mypy; print('โ
All dev tools available')"
|
|
222
|
+
|
|
223
|
+
# Release Management Commands (Git Tag-Based Versioning)
|
|
224
|
+
show-version:
|
|
225
|
+
@echo "๐
Current version from setuptools-scm:"
|
|
226
|
+
@$(PYTHON) -m setuptools_scm || echo "Unable to determine version (no git tags yet)"
|