Skip to content

Commit fbea4d3

Browse files
committed
Add a dedicated CodeQL job for python and javascript
S360 grades this repo on 'python' and 'javascript' for Microsoft.Security.CodeQL.10000. Today both databases come from the central CodeQL AutoBuilds service rather than from this repo's own pipelines, while the auto-injected CodeQL in the e2e and horton pipelines uploads competing databases from jobs that only provision Azure resources. S360 records arg_max(SnapshotDate) per (repo, language), so whichever uploads last wins. Add an explicit, cheap CodeQL job to vsts/build.yaml. Both languages are interpreted, so CodeQL extracts them straight from the checked-out sources and no build step is needed between Init and Finalize. ('javascript' is graded because of sdklab/meantimerecovery/aedes/aedes_server.js.) CodeQL is turned off at pipeline level so the five-way python test matrix does not each build and upload a database, and off in vsts/python-e2e.yaml and vsts/horton-e2e.yaml, which build nothing. CodeQL is enabled only on main; these pipelines also run on PRs, which do not need to produce a snapshot. CodeQL AutoBuilds remains as a backstop for periods with no commits to main.
1 parent 5ffa377 commit fbea4d3

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎vsts/build.yaml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
11
resources:
22
- repo: self
3+
4+
variables:
5+
# CodeQL is auto-injected into every job by the 1ES policy decorator. Off by
6+
# default so the python test matrix (5 parallel jobs) does not each build and
7+
# upload a competing database -- S360 records arg_max(SnapshotDate) per
8+
# (repo, language). The dedicated 'CodeQL' job below opts back in.
9+
# See https://aka.ms/codeql3000 and https://aka.ms/sdlfaqcodeql.
10+
Codeql.Enabled: false
11+
312
#Multi-configuration and multi-agent job options are not exported to YAML. Configure these options using documentation guidance: https://docs.microsoft.com/vsts/pipelines/process/phases
413
jobs:
514

15+
# Owns the 'python' and 'javascript' CodeQL snapshots for this repo
16+
# (Microsoft.Security.CodeQL.10000). Both are interpreted languages, so CodeQL
17+
# extracts them straight from the checked-out sources and no build step is
18+
# needed between Init and Finalize. 'javascript' is graded because of
19+
# sdklab/meantimerecovery/aedes/aedes_server.js.
20+
- job: 'CodeQL'
21+
displayName: 'CodeQL (python, javascript)'
22+
variables:
23+
# Only on main; this pipeline also runs on PRs, which need no snapshot.
24+
Codeql.Enabled: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
25+
Codeql.Language: python,javascript
26+
pool:
27+
vmImage: 'ubuntu-24.04'
28+
steps:
29+
- task: UsePythonVersion@0
30+
inputs:
31+
versionSpec: '3.x'
32+
architecture: 'x64'
33+
- task: CodeQL3000Init@0
34+
displayName: 'Initialize CodeQL'
35+
- task: CodeQL3000Finalize@0
36+
displayName: 'Finalize CodeQL'
37+
condition: always()
38+
639
- job: 'Static_Analysis'
740
condition: false # Disabling this job since it is failing on recent runs. Must be re-enabled asap.
841
pool:

‎vsts/horton-e2e.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ variables:
55
Horton.Repo: $(Build.Repository.Uri)
66
Horton.Commit: $(Build.SourceBranch)
77
Horton.ForcedImage: ''
8+
# This is an e2e gate, not the SDL scanning pipeline. Auto-injected CodeQL here
9+
# produces incidental databases that displace the ones from the dedicated
10+
# 'CodeQL' job in vsts/build.yaml, because S360 records arg_max(SnapshotDate)
11+
# per (repo, language). See https://aka.ms/codeql3000.
12+
Codeql.Enabled: false
813

914
resources:
1015
repositories:

‎vsts/python-e2e.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
name: $(BuildID)_$(BuildDefinitionName)_$(SourceBranchName)
22

3+
variables:
4+
# E2E pipeline: it provisions an IoT Hub and runs tests, it does not build the
5+
# product. Auto-injected CodeQL here produces incidental databases that
6+
# displace the ones from the dedicated 'CodeQL' job in vsts/build.yaml,
7+
# because S360 records arg_max(SnapshotDate) per (repo, language).
8+
# See https://aka.ms/codeql3000.
9+
Codeql.Enabled: false
10+
311
stages:
412
- stage: setup
513
jobs:

0 commit comments

Comments
 (0)