blob: 10249bed05442f8cbc06d345d30b6f17524d48fd [file] [log] [blame]
Joey Armstrongbeef4cd2023-01-18 09:59:58 -05001// Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
Jeremy Ronquillob8f07bb2020-12-03 12:01:45 -08002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// omec-reuse-scan.groovy
16// checks an omec-project repo against reuse in a docker container
17
18pipeline {
19
20 agent {
21 docker {
22 image "registry.aetherproject.org/ci/cppcheck-verify:latest"
23 label "${params.buildNode}"
24 registryUrl "https://registry.aetherproject.org/"
25 registryCredentialsId "registry.aetherproject.org"
26 }
27 }
28
29 options {
30 timeout(15)
31 }
32
33 stages {
34 stage ("Clean Workspace") {
35 steps {
36 sh 'rm -rf *'
37 }
38 }
39
40 stage ("Checkout Pull Request") {
41 when {
42 expression {return params.ghprbPullId != ""}
43 }
44 steps {
45 checkout([
46 $class: 'GitSCM',
47 userRemoteConfigs: [[ url: "https://github.com/${params.ghprbGhRepository}", refspec: "pull/${params.ghprbPullId}/head" ]],
48 extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.project}"]],
49 ],
50 )
51 }
52 }
53
54 stage ("Checkout Repo (manual)") {
55 when {
56 expression {return params.ghprbPullId == ""}
57 }
58 steps {
59 checkout([
60 $class: 'GitSCM',
61 userRemoteConfigs: [[ url: "https://github.com/${params.ghprbGhRepository}" ]],
62 extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.project}"]],
63 ],
64 )
65 }
66 }
67
68 stage("Run cppcheck"){
69 steps {
70 script {
71 sh """
72 cd ${params.project}
73 if [ ! -z ${params.ghprbPullId} ]
74 then
75 git checkout FETCH_HEAD
76 else
77 git checkout ${params.branch}
78 fi
79 git show
80 make cppcheck
81 """
82 }
83 }
84 }
85 }
86}