Skip to content

Commit 0c8e43c

Browse files
authored
FIX: S360 CodeQL finding in PR validation to resolve stale snapshot issue (#407)
- Disable CodeQL auto-injection globally in PR validation pipeline - Add one-time 'pytestonwindows' job to update the old stale CodeQL snapshot - This fixes the S360 CodeQL finding SM02986 that was stuck on outdated code - After the old snapshot is cleared, the pytestonwindows job should be removed Resolves: User Story 39809 [S360] [CodeQL.SM02986] ### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below (e.g. AB#37452) For external contributors: Insert Github Issue number below (e.g. #149) Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- mssql-python maintainers: ADO Work Item --> > [AB#41680](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/41680) <!-- External contributors: GitHub Issue --> > GitHub Issue: #<ISSUE_NUMBER> ------------------------------------------------------------------- ### Summary <!-- Insert your summary of changes below. Minimum 10 characters required. --> This pull request updates the PR validation pipeline configuration to address CodeQL analysis and snapshot management. The main changes are disabling automatic CodeQL analysis to prevent duplicate findings, and introducing a one-time job to update a legacy CodeQL snapshot for the `pytestonwindows` build. These adjustments ensure that CodeQL runs only where needed and help resolve an old issue with snapshot duplication. **CodeQL Analysis Configuration:** * Disabled global CodeQL auto-injection in all jobs by setting the `Codeql.Enabled` variable to `false`, ensuring CodeQL analysis is not performed in this pipeline except where explicitly enabled. **One-time Snapshot Update Job:** * Added a dedicated job named `pytestonwindows` to update the old CodeQL snapshot. This job is configured to run on `windows-latest` and temporarily enables CodeQL analysis for this specific purpose. The job is intended for one-time use and should be removed after the snapshot issue is resolved. **Build and Dependency Changes (Windows Compatibility):** * Updated build and dependency installation steps in the new job to use Windows-specific commands (`call build.bat x64` and `cd mssql_python\pybind`) and install additional dependencies required for building the C++ extension. [[1]](diffhunk://#diff-296c8f902bbd70f34ee1c8c32383c8c99165fe4c8e5b0f234f8f22246e56a621L39-R59) [[2]](diffhunk://#diff-296c8f902bbd70f34ee1c8c32383c8c99165fe4c8e5b0f234f8f22246e56a621R9-R49) <!-- ### PR Title Guide > For feature requests FEAT: (short-description) > For non-feature requests like test case updates, config updates , dependency updates etc CHORE: (short-description) > For Fix requests FIX: (short-description) > For doc update requests DOC: (short-description) > For Formatting, indentation, or styling update STYLE: (short-description) > For Refactor, without any feature changes REFACTOR: (short-description) > For release related changes, without any feature changes RELEASE: #<RELEASE_VERSION> (short-description) ### Contribution Guidelines External contributors: - Create a GitHub issue first: https://github.com/microsoft/mssql-python/issues/new - Link the GitHub issue in the "GitHub Issue" section above - Follow the PR title format and provide a meaningful summary mssql-python maintainers: - Create an ADO Work Item following internal processes - Link the ADO Work Item in the "ADO Work Item" section above - Follow the PR title format and provide a meaningful summary -->
1 parent 119ca4a commit 0c8e43c

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

eng/pipelines/pr-validation-pipeline.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
displayName: 'CodeQL Security Analysis'
1212
pool:
1313
vmImage: 'ubuntu-latest'
14-
14+
1515
steps:
1616
- script: |
1717
sudo apt-get update
@@ -45,10 +45,14 @@ jobs:
4545
condition: always()
4646
displayName: 'Finalize CodeQL'
4747

48-
- job: PytestOnWindows
48+
- job: pytestonwindows
4949
displayName: 'Windows x64'
5050
pool:
5151
vmImage: 'windows-latest'
52+
variables:
53+
# Enable CodeQL for this job to update the old stale snapshot (build_jobname=pytestonwindows)
54+
# This can be removed once the old CodeQL issue SM02986 is cleared
55+
Codeql.Enabled: true
5256

5357
strategy:
5458
matrix:
@@ -225,11 +229,22 @@ jobs:
225229
env:
226230
DB_PASSWORD: $(DB_PASSWORD)
227231
232+
# ============== CodeQL Init (temporary - remove after SM02986 is cleared) ==============
233+
- task: CodeQL3000Init@0
234+
inputs:
235+
Enabled: true
236+
displayName: 'Initialize CodeQL (temporary)'
237+
228238
- script: |
229239
cd mssql_python\pybind
230240
build.bat x64
231241
displayName: 'Build .pyd file'
232242
243+
# ============== CodeQL Finalize (temporary - remove after SM02986 is cleared) ==============
244+
- task: CodeQL3000Finalize@0
245+
condition: always()
246+
displayName: 'Finalize CodeQL (temporary)'
247+
233248
# Run tests for LocalDB
234249
- script: |
235250
python -m pytest -v --junitxml=test-results-localdb.xml --cov=. --cov-report=xml:coverage-localdb.xml --capture=tee-sys --cache-clear

0 commit comments

Comments
 (0)