Skip to content

Commit 8145182

Browse files
authored
CHORE: CodeQL ADO pipeline task (#259)
### 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#38859](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/38859) ------------------------------------------------------------------- ### Summary This pull request adds a new CodeQL security analysis job to the `pr-validation-pipeline.yml` to improve automated security scanning of the codebase. The changes introduce a dedicated container for the CodeQL job, install necessary dependencies, and ensure the C++ extension is built for analysis. **Security and CI pipeline enhancements:** * Added a new `CodeQLAnalysis` job to the pipeline to perform CodeQL security analysis, including initialization and finalization steps. * Introduced a `codeqlContainer` using the `ubuntu:20.04` image to provide a consistent environment for CodeQL analysis. * Added steps to install build dependencies and Python 3.13, and to install Python requirements needed for CodeQL. * Included a step to build the C++ extension (`mssql_python/pybind/build.sh`) as part of the CodeQL analysis process. <!-- ### 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 5d50020 commit 8145182

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

eng/pipelines/pr-validation-pipeline.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,44 @@ trigger:
77
- main
88

99
jobs:
10+
- job: CodeQLAnalysis
11+
displayName: 'CodeQL Security Analysis'
12+
pool:
13+
vmImage: 'ubuntu-latest'
14+
15+
steps:
16+
- script: |
17+
sudo apt-get update
18+
sudo apt-get install -y build-essential cmake curl git python3 python3-pip python3-dev python3-venv unixodbc-dev
19+
displayName: 'Install build dependencies for CodeQL'
20+
21+
- task: UsePythonVersion@0
22+
inputs:
23+
versionSpec: '3.13'
24+
addToPath: true
25+
displayName: 'Use Python 3.13 for CodeQL'
26+
27+
- script: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
displayName: 'Install Python dependencies for CodeQL'
31+
32+
- task: CodeQL3000Init@0
33+
inputs:
34+
Enabled: true
35+
displayName: 'Initialize CodeQL'
36+
37+
# Build the C++ extension for CodeQL analysis
38+
- script: |
39+
cd mssql_python/pybind
40+
chmod +x build.sh
41+
./build.sh
42+
displayName: 'Build C++ extension for CodeQL analysis'
43+
44+
- task: CodeQL3000Finalize@0
45+
condition: always()
46+
displayName: 'Finalize CodeQL'
47+
1048
- job: PytestOnWindows
1149
displayName: 'Windows x64'
1250
pool:

0 commit comments

Comments
 (0)