Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[main] Add CodeQL3000 tasks #8160

Merged
merged 2 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions .azure/pipelines/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ trigger:

schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
displayName: Daily midnight build (including CodeQL)
branches:
include:
- main
Expand Down Expand Up @@ -54,18 +54,35 @@ parameters:
- BVT
- SlowBVT
- Functional
- name: runCodeQL3000
default: false
displayName: Run CodeQL3000 tasks
type: boolean

variables:
Codeql.Enabled: true
build_flags: ' /m /v:m'
solution: 'Orleans.sln'
codesign_runtime: '2.1.x'
# Auto-injection is not necessary because the tasks are explicitly included where they're enabled.
Codeql.SkipTaskAutoInjection: true
${{ if eq(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
pool_name: 'orleans-pr-hosted-pool'
official_build: false
${{ else }}:
pool_name: 'orleans-build-hosted-pool'
official_build: true
# Do not let CodeQL3000 Extension gate scan frequency.
Codeql.Cadence: 0
# Enable CodeQL3000 unconditionally so it may be run on any branch.
Codeql.Enabled: true
# Ignore test and infrastructure code.
Codeql.SourceRoot: src
# CodeQL3000 needs this plumbed along as a variable to enable TSA. Don't use TSA in manual builds.
Codeql.TSAEnabled: ${{ eq(variables['Build.Reason'], 'Schedule') }}
# Default expects tsaoptions.json under SourceRoot.
Codeql.TSAOptionsPath: '$(Build.SourcesDirectory)/.config/tsaoptions.json'
# Do not slow builds down w/ the CodeQL3000 tasks unless this is a nightly build or it's requested.
runCodeQL3000: ${{ or(eq(variables['Build.Reason'], 'Schedule'), and(eq(variables['Build.Reason'], 'Manual'), eq(parameters.runCodeQL3000, 'true'))) }}

jobs:

Expand All @@ -79,6 +96,14 @@ jobs:
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
- ${{ if eq(variables.runCodeQL3000, 'true') }}:
- task: CodeQL3000Init@0
displayName: CodeQL Initialize
# This task only tags a build if it actually does CodeQL3000 work.
# Those tasks no-op while the analysis is considered up to date i.e. for runs w/in a few days of each other.
- script: "echo ##vso[build.addbuildtag]CodeQL3000"
displayName: 'Set CI CodeQL3000 tag'
condition: ne(variables.CODEQL_DIST,'')
- task: DotNetCoreCLI@2
displayName: Build
inputs:
Expand All @@ -89,6 +114,9 @@ jobs:
${{ if eq(parameters.include_suffix, true) }}:
VersionSuffix: ${{parameters.version_suffix}}
OfficialBuild: $(official_build)
- ${{ if eq(variables.runCodeQL3000, 'true') }}:
- task: CodeQL3000Finalize@0
displayName: CodeQL Finalize
# DLL code signing
- ${{ if eq(parameters.codesign, true) }}:
- task: UseDotNet@2
Expand Down Expand Up @@ -211,7 +239,7 @@ jobs:
ArtifactName: nuget

# Tests
- ${{ if eq(parameters.skip_test, false) }}:
- ${{ if and(eq(parameters.skip_test, false), ne(variables.runCodeQL3000, 'true')) }}:
- ${{ each category in parameters.tests_categories }}:
- ${{ each framework in parameters.frameworks }}:
- job:
Expand Down Expand Up @@ -245,5 +273,3 @@ jobs:
${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
env:
ORLEANS_SECRETFILE: $(secretFile.secureFilePath)


13 changes: 13 additions & 0 deletions .config/tsaoptions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"areaPath": "DevDiv\\ASP.NET Core\\Orleans",
"codebaseName": "Orleans",
"instanceUrl": "https://devdiv.visualstudio.com/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are still building on our own devops instance, should we change this value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know because the documentation of this file format is sorely lacking. I suspect this is the location where areaPath lives and where TSA bugs will be filed. Suggest we probably want to keep @danmoseley's bug in the same instance. @dcwhittaker do you know more❔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be resolved since this instance is definitely where the area path lives.

"iterationPath": "DevDiv",
"notificationAliases": [
"bpetit@microsoft.com",
"reuben.bond@microsoft.com"
],
"projectName": "DEVDIV",
"repositoryName": "Orleans",
"template": "TFSDEVDIV"
}