blob: 02f7ae4c1000019d9731d0babe1401f4d81296d2 [file] [log] [blame]
Joey Armstrong518f3572024-02-11 07:56:25 -05001// Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
Jeremy Ronquillo9adc0a92020-01-29 10:49: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 {
You Wang20287cc2020-11-17 14:30:56 -080022 image "registry.aetherproject.org/ci/reuse-verify:latest"
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080023 label "${params.buildNode}"
You Wang20287cc2020-11-17 14:30:56 -080024 registryUrl "https://registry.aetherproject.org/"
25 registryCredentialsId "registry.aetherproject.org"
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080026 }
27 }
28
29 options {
30 timeout(15)
31 }
32
33 stages {
34
35 stage ("Clean Workspace") {
36 steps {
37 sh 'rm -rf *'
38 }
39 }
40
41 stage ("Checkout Pull Request") {
Jeremy Ronquillo3ca065c2020-04-24 10:40:54 -070042 when {
43 expression {return params.ghprbPullId != ""}
44 }
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080045 steps {
46 checkout([
47 $class: 'GitSCM',
Jeremy Ronquillof86b8362020-03-17 13:20:10 -070048 userRemoteConfigs: [[ url: "https://github.com/${params.ghprbGhRepository}", refspec: "pull/${params.ghprbPullId}/head" ]],
49 extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.project}"]],
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080050 ],
51 )
52 }
53 }
54
Jeremy Ronquillo3ca065c2020-04-24 10:40:54 -070055 stage ("Checkout Repo (manual)") {
56 when {
57 expression {return params.ghprbPullId == ""}
58 }
59 steps {
60 checkout([
61 $class: 'GitSCM',
62 userRemoteConfigs: [[ url: "https://github.com/${params.ghprbGhRepository}" ]],
63 extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.project}"]],
64 ],
65 )
66 }
67 }
68
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080069 stage("Run REUSE Linter"){
70 steps {
Jeremy Ronquillo3ca065c2020-04-24 10:40:54 -070071 sh """
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080072 #!/usr/bin/env bash
73
Jeremy Ronquillo3ca065c2020-04-24 10:40:54 -070074 cd ${params.project}
Jeremy Ronquilloa4e0cc22020-04-24 21:57:58 -070075 if [ ! -z ${params.ghprbPullId} ]
Jeremy Ronquillo3ca065c2020-04-24 10:40:54 -070076 then
77 git checkout FETCH_HEAD
78 else
79 git checkout ${params.branch}
80 fi
Jeremy Ronquilloae95dac2020-02-11 15:17:28 -080081 git show
Jeremy Ronquillo1ec06c42020-04-23 10:24:05 -070082 reuse lint
Jeremy Ronquillo3ca065c2020-04-24 10:40:54 -070083 """
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -080084 }
85 }
86 }
87}