Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
devops
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osm
devops
Commits
905094b2
Commit
905094b2
authored
7 years ago
by
Mike Marchetti
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "add license scan to stage_2"
parents
0e4186c7
771f06aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jenkins/ci-pipelines/ci_stage_2.groovy
+4
-0
4 additions, 0 deletions
jenkins/ci-pipelines/ci_stage_2.groovy
tools/license_scan.sh
+75
-0
75 additions, 0 deletions
tools/license_scan.sh
with
79 additions
and
0 deletions
jenkins/ci-pipelines/ci_stage_2.groovy
+
4
−
0
View file @
905094b2
...
...
@@ -38,6 +38,10 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,build_system) {
project_checkout
(
url_prefix
,
project
,
refspec
,
revision
)
}
stage
(
'License Scan'
)
{
sh
"devops/tools/license_scan.sh"
}
container_name
=
"${project}-${branch}"
.
toLowerCase
()
stage
(
'Docker-Build'
)
{
...
...
This diff is collapsed.
Click to expand it.
tools/license_scan.sh
0 → 100755
+
75
−
0
View file @
905094b2
#
# Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#!/bin/sh
echo
GERRIT BRANCH is
$GERRIT_BRANCH
dpkg
-l
wget &>/dev/null
||
sudo
apt-get
install
-y
wget
dpkg
-l
curl &>/dev/null
||
sudo
apt-get
install
-y
curl
#Curl can be used instead of wget:
#curl -s -X POST -d @$file https://osm.etsi.org/fossology/?mod=agent_nomos_once
apache
=
0
nolicense
=
0
other
=
0
git fetch
RE
=
"FATAL: your file did not get passed through"
for
file
in
$(
git diff
--name-only
origin/
$GERRIT_BRANCH
)
;
do
if
[
-f
$file
]
;
then
if
[
-s
$file
]
;
then
license
=
$(
wget
-qO
-
--post-file
$file
https://osm.etsi.org/fossology/?mod
=
agent_nomos_once |sed
"s/^[
\t
]*//;s/[
\t
]*
$/
/"
)
if
[[
$license
=
~
$RE
]]
;
then
# possibly we have exceeded the post rate
sleep
10
license
=
$(
wget
-qO
-
--post-file
$file
https://osm.etsi.org/fossology/?mod
=
agent_nomos_once |sed
"s/^[
\t
]*//;s/[
\t
]*
$/
/"
)
fi
else
license
=
"No_license_found"
fi
else
license
=
"DELETED"
fi
echo
"
$file
$license
"
case
"
$license
"
in
"Apache-2.0"
)
apache
=
$((
apache
+
1
))
;;
"No_license_found"
)
nolicense
=
$((
nolicense
+
1
))
;;
"DELETED"
)
;;
"FATAL:*"
)
;;
*
)
echo
"BAD LICENSE ON FILE
$file
"
other
=
$((
other
+
1
))
;;
esac
done
if
[
$other
-gt
0
]
;
then
echo
"FATAL: Non-apache licenses detected"
exit
2
fi
if
[
$nolicense
-gt
0
]
;
then
echo
"WARNING: Unlicensed files found"
fi
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment