Add CodeQL native C build scanning to storage pipeline#48098
Conversation
|
Azure Pipelines: 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds compiled CodeQL scanning for the storage pipeline and ensures hybrid extension packages use cibuildwheel.
Changes:
- Wires a compiled-CodeQL pipeline parameter through shared templates.
- Detects setup.py-defined extensions alongside pyproject.toml.
- Routes compiled pyproject packages through cibuildwheel.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/storage/ci.yml |
Enables compiled CodeQL for storage. |
eng/pipelines/templates/stages/archetype-sdk-client.yml |
Forwards the CodeQL parameter. |
eng/pipelines/templates/stages/1es-redirect.yml |
Configures compiled C/C++ scanning. |
eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py |
Detects setup.py extensions for pyproject packages. |
eng/tools/azure-sdk-tools/ci_tools/build.py |
Builds detected extensions with cibuildwheel. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
eng/tools/azure-sdk-tools/ci_tools/build.py:246
-vvis a Python interpreter flag, not a cibuildwheel verbosity flag, so it emits verbose import tracing intorun_logged's captured output for every compiled-wheel build. The pipeline already setsCIBW_BUILD_VERBOSITY=3; remove this flag to avoid needlessly inflating captured logs and obscuring build failures, consistent with the existing setup.py cibuildwheel path below.
[sys.executable, "-vv", "-m", "cibuildwheel", "--output-dir", dist],
eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py:719
- Add a parser test for the new hybrid-package fallback. The existing
pyproject_project_def_with_extensionscenario declarestool.setuptools.ext-modulesdirectly and has no setup.py, so it never exercises lines 713–719; a regression here would silently route the storage extension through the pure-Python build path and defeat the native scan this PR enables.
if not ext_modules:
sibling_setup_py = os.path.join(package_directory, "setup.py")
if os.path.exists(sibling_setup_py):
try:
setup_py_result = parse_setup_py(sibling_setup_py)
ext_package = ext_package or setup_py_result[11] # ext_package
ext_modules = setup_py_result[12] # ext_modules
sdk/storage/ci.yml:42
- Correct the typo “becuase” to “because.”
# Enable Compiled CodeQL becuase azure-storage-extensions has C code that
|
@copilot run black and fix formatting as described here: https://github.com/Azure/azure-sdk-for-python/actions/runs/29761331967/job/88416408198?pr=48098 Push the change to this branch. |
… -vv flag Co-authored-by: danieljurek <2158838+danieljurek@users.noreply.github.com>
Fixed in the latest commit — removed trailing whitespace from docstring blank lines (the black failure) and also dropped the |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py:719
- The new setup.py fallback is not covered by the existing pyproject extension test, which only exercises declarative
[tool.setuptools].ext-modules. Add a dual-config fixture with extensions declared only in setup.py and assert thatParsedSetup.from_path(...)preservesis_pyprojectwhile discoveringext_packageandext_modules; otherwise tuple-index or parser regressions can silently route native packages through the pure-Python path.
if not ext_modules:
sibling_setup_py = os.path.join(package_directory, "setup.py")
if os.path.exists(sibling_setup_py):
try:
setup_py_result = parse_setup_py(sibling_setup_py)
ext_package = ext_package or setup_py_result[11] # ext_package
ext_modules = setup_py_result[12] # ext_modules
sdk/storage/ci.yml:42
- Correct the typo “becuase” to “because”.
# Enable Compiled CodeQL becuase azure-storage-extensions has C code that
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py:719
- The new fallback path is not covered by the existing parser tests:
test_parse_pyproject_extensionsonly exercises declarative[tool.setuptools].ext-modules, and its fixture has no siblingsetup.py. Add a fixture matching azure-storage-extensions (a[project]pyproject with the extension declared only in setup.py) and assert thatParsedSetup.from_pathdiscovers the extension; otherwise tuple-index or fallback regressions can silently route native packages through the pure-Python builder.
if not ext_modules:
sibling_setup_py = os.path.join(package_directory, "setup.py")
if os.path.exists(sibling_setup_py):
try:
setup_py_result = parse_setup_py(sibling_setup_py)
ext_package = ext_package or setup_py_result[11] # ext_package
ext_modules = setup_py_result[12] # ext_modules
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
eng/pipelines/templates/steps/build-package-artifacts.yml:167
CIBW_ENVIRONMENThas higher precedence thanpyproject.toml, so this replaces each package's existing cibuildwheel environment instead of adding the feed URL. Forazure-storage-extensions, that drops its configuredCFLAGSvalue. Pass the already-defined variable into Linux containers withCIBW_ENVIRONMENT_PASS_LINUXso package-specific settings remain effective.
- pwsh: |
eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py:719
- The existing pyproject extension test covers only declarative
[tool.setuptools].ext-modules; this new sibling-setup.pyfallback is untested. Add a fixture containing both files with theExtension(...)declared only insetup.py, then assert thatParsedSetup.from_pathrecoversext_packageandext_modules, since this result now controls routing to cibuildwheel.
if not ext_modules:
sibling_setup_py = os.path.join(package_directory, "setup.py")
if os.path.exists(sibling_setup_py):
try:
setup_py_result = parse_setup_py(sibling_setup_py)
ext_package = ext_package or setup_py_result[11] # ext_package
ext_modules = setup_py_result[12] # ext_modules
eng/pipelines/templates/steps/build-package-artifacts.yml:148
$ErrorActionPreference = 'Stop'does not make failed native executables terminate thispwshscript. If the first NuGet install fails but the second succeeds, this step still reports success and leaves the AMD64 cache missing, causing cibuildwheel to retry the blocked endpoint later. Enable native-command error propagation, as the existing Prep Environment step does.
$ErrorActionPreference = 'Stop'
$feed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json"
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
eng/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py:719
- The new fallback is not exercised by the existing parser tests:
test_parse_pyproject_extensionsuses declarative[tool.setuptools].ext-modules, so it never enters this branch. Add a pyproject fixture with no declarative extensions and a siblingsetup.pydefiningExtension(...), then assert thatParsedSetupdiscovers bothext_packageandext_modules; this is the behavior that determines whether the package is routed to cibuildwheel.
if not ext_modules:
sibling_setup_py = os.path.join(package_directory, "setup.py")
if os.path.exists(sibling_setup_py):
try:
setup_py_result = parse_setup_py(sibling_setup_py)
ext_package = ext_package or setup_py_result[11] # ext_package
ext_modules = setup_py_result[12] # ext_modules
No description provided.