Skip to content

Commit

Permalink
add ado agent for codeql reporting. (#224)
Browse files Browse the repository at this point in the history
* add ado agent for codeql reporting

* update branch condition

* add excludepath pattern

* remove javascript build task

* remove test folder from code scan

* add codeql cadence to test pipeline frequently

* experiemnt building test java and test dotnet projects
  • Loading branch information
arroyc authored Apr 25, 2024
1 parent 1eed3b2 commit 77c36a1
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 0 deletions.
163 changes: 163 additions & 0 deletions ado-codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
jobs:
- job: "Javascript_AND_Powershell_CodeQL_Reporting"
variables:
ApplicationInsightAgentVersion: 3.4.16
Codeql.Enabled: true
Codeql.Language: javascript, powershell
Codeql.Cadence: 0

pool:
name: '1ES-Hosted-AzFunc'
demands:
- ImageOverride -equals MMS2019TLS

steps:
- checkout: self
- task: CodeQL3000Init@0
inputs:
Enabled: true
Language: javascript, powershell
Cadence: 0
# ExcludePathPatterns: $(Build.SourcesDirectory)\tests

- task: CodeQL3000Finalize@0
condition: always()

- job: "Java_CodeQL_Reporting"
variables:
ApplicationInsightAgentVersion: 3.4.16
Codeql.Enabled: true
Codeql.Language: java
Codeql.Cadence: 0

pool:
name: '1ES-Hosted-AzFunc'
demands:
- ImageOverride -equals MMS2022TLS

steps:
- checkout: self
- task: CodeQL3000Init@0
inputs:
Enabled: true
Language: java
Cadence: 0
# ExcludePathPatterns: $(Build.SourcesDirectory)\tests

# Build tasks needed for java
- bash: |
echo $BuildFolderPath
cd $BuildFolderPath
mvn clean package
mvn azure-functions:package
displayName: 'Build project for java language'
env:
BuildFolderPath: '$(Build.Repository.LocalPath)\tests\e2e\java8'
- task: CodeQL3000Finalize@0
condition: always()

- job: "Csharp_CodeQL_Reporting"
variables:
ApplicationInsightAgentVersion: 3.4.16
Codeql.Enabled: true
Codeql.Language: csharp
Codeql.Cadence: 0

pool:
name: '1ES-Hosted-AzFunc'
demands:
- ImageOverride -equals MMS2022TLS

steps:
- checkout: self
- task: CodeQL3000Init@0
inputs:
Enabled: true
Language: csharp
Cadence: 0
# ExcludePathPatterns: $(Build.SourcesDirectory)\tests

# Build task needed for csharp
# CodeQL WILL NOT WORK for compiled languages if there are no build tasks here
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.x
installationPath: $(Agent.ToolsDirectory)\dotnet

- pwsh: |
echo $env:BuildFolderPath
cd $env:BuildFolderPath
dotnet --version
dotnet build
displayName: 'Build project for csharp language'
env:
BuildFolderPath: '$(Build.Repository.LocalPath)\tests\e2e\dotnet3'
- task: CodeQL3000Finalize@0
condition: always()


- job: "Python_CodeQL_Reporting"
variables:
ApplicationInsightAgentVersion: 3.4.16
BuildFolderPath: '$(Build.Repository.LocalPath)\tests\e2e\python3'
Codeql.Enabled: true
Codeql.Language: python
Codeql.Cadence: 0

pool:
name: '1ES-Hosted-AzFunc'
demands:
- ImageOverride -equals MMS2022TLS

steps:
- checkout: self
- task: CodeQL3000Init@0
inputs:
Enabled: true
Language: python
Cadence: 0
# ExcludePathPatterns: $(Build.SourcesDirectory)\tests

# Build task needed for python
# CodeQL WILL NOT WORK for compiled languages if there are no build tasks here
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'

- bash: |
echo $BuildFolderPy37Path
pushd $BuildFolderPy37Path
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
cd $BuildFolderPath
python --version
# Add your build commands here
displayName: 'Build project for python language'
env:
BuildFolderPy37Path: '$(Build.Repository.LocalPath)\tests\e2e\python37'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'

- bash: |
echo $BuildFolderPy310Path
pushd $BuildFolderPy310Path
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
displayName: 'Build project for python 3.10'
env:
BuildFolderPy310Path: '$(Build.Repository.LocalPath)\tests\e2e\python310'
- task: CodeQL3000Finalize@0
condition: always()
2 changes: 2 additions & 0 deletions release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ if ($node_module_exists) {

# Restore package
npm install --production
# added 'npm i --save-dev @types/q' as the build was failing with the error 'Cannot find name 'Q''
npm i --save-dev @types/q
npm run build

# Remove node_modules/ and lib/ from .gitignore
Expand Down

0 comments on commit 77c36a1

Please sign in to comment.