-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathcoverity-gpr.yml
57 lines (57 loc) · 2.37 KB
/
coverity-gpr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
pool:
name: private-linux
jobs:
- job: Build
workspace:
clean: all
steps:
- task: Maven@4
displayName: 'Maven Build'
inputs:
options: '-B -DskipTests'
- job: Coverity
dependsOn: Build
workspace:
clean: all
# Coverity enabled on Builds or Pull Requests for main, stage or release branches
condition: |
or(in(variables['Build.SourceBranchName'],'main','stage','release'),
in(variables['System.PullRequest.TargetBranch'],'refs/heads/main','refs/heads/stage','refs/heads/release'))
variables:
- group: poc222.coverity.synopsys.com
- name: COVERITY_TOOL_HOME
value: /opt/coverity/analysis/2024.12.0
- name: COVERITY_PROJECT
value: $(Build.Repository.Name)
steps:
# use Coverity plugin for full scans of CI Builds
- task: synopsys-coverity@1
inputs:
coverityService: 'poc222.coverity.synopsys.com'
projectName: '$(Build.Repository.Name)'
streamName: '$(Build.Repository.Name)-$(Build.SourceBranchName)'
checkIssues: true
issueView: 'Outstanding Issues'
issueStatus: 'unstable'
buildCommand: 'mvn -B -DskipTests package'
customCommandArgs: true
covBuildArgs: '--fs-capture-search $(Build.SourcesDirectory)'
covAnalyzeArgs: '--ticker-mode none --strip-path $(Build.SourcesDirectory) --webapp-security'
covCommitArgs: '--ticker-mode none --description $(Build.BuildURI) --version $(Build.SourceVersion) --scm git'
allowUntrusted: true
displayName: 'Full Scan'
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
# use cov-run-desktop for incremental scans of GPRs
- bash: |
REMOVE="refs/heads/"
export SYSTEM_PULLREQUEST_TARGETBRANCHNAME="${SYSTEM_PULLREQUEST_TARGETBRANCH//$REMOVE/}"
export CHANGE_SET=$(git --no-pager diff origin/$SYSTEM_PULLREQUEST_TARGETBRANCHNAME --name-only)
export STREAM="$(COVERITY_PROJECT)-$SYSTEM_PULLREQUEST_TARGETBRANCHNAME"
export PATH=$PATH:$COVERITY_TOOL_HOME/bin
set -ex
cov-run-desktop --dir idir --url $(COVERITY_URL) --stream $STREAM --build mvn -B -DskipTests package
cov-run-desktop --dir idir --url $(COVERITY_URL) --stream $STREAM --present-in-reference false --ignore-uncapturable-inputs true --exit1-if-defects true $CHANGE_SET
env:
COVERITY_PASSPHRASE: $(COVERITY_PASSPHRASE)
displayName: 'Incremental Scan'
condition: eq(variables['Build.Reason'], 'PullRequest')