Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Software Quality Assurance
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Metrics
Incidents
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
id2
S
Software
S
services
FAIR
Software Quality Assurance
Commits
0eb50f5b
Commit
0eb50f5b
authored
Mar 22, 2020
by
Maximilian Dolling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "add version to report and -v"
parent
f6edd771
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
63 additions
and
30 deletions
+63
-30
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
README.md
README.md
+1
-1
build/docker/dev/Dockerfile
build/docker/dev/Dockerfile
+1
-0
build/docker/dev/docker-entrypoint.sh
build/docker/dev/docker-entrypoint.sh
+14
-8
build/docker/dev/entrypoint-manual.txt
build/docker/dev/entrypoint-manual.txt
+2
-1
build/docker/production/Dockerfile
build/docker/production/Dockerfile
+1
-0
build/docker/production/docker-entrypoint.sh
build/docker/production/docker-entrypoint.sh
+14
-8
build/docker/production/entrypoint-manual.txt
build/docker/production/entrypoint-manual.txt
+2
-1
meta/ci-services-report.md
meta/ci-services-report.md
+9
-7
src/services/language_detection/service_language_detection.rb
...services/language_detection/service_language_detection.rb
+4
-0
src/services/report/service_report.py
src/services/report/service_report.py
+7
-2
src/services/test/service_test.py
src/services/test/service_test.py
+4
-0
test/test_report.md
test/test_report.md
+3
-1
No files found.
.gitlab-ci.yml
View file @
0eb50f5b
...
...
@@ -5,7 +5,7 @@ stages:
-
ci-services
variables
:
VERSION
:
0.
0.4
VERSION
:
0.
1.0
DOCKER_DST_IMAGE_NAME
:
ci-services
build-deploy:dep:
...
...
README.md
View file @
0eb50f5b
...
...
@@ -2,7 +2,7 @@
---
This
F
ramework provides various services for the GitLab CI regarding to software quality.
This
f
ramework provides various services for the GitLab CI regarding to software quality.
## Description
...
...
build/docker/dev/Dockerfile
View file @
0eb50f5b
...
...
@@ -9,6 +9,7 @@ RUN apk upgrade
# copy entrypoint script to executables
COPY
./build/docker/dev/docker-entrypoint.sh /usr/local/bin/
COPY
./build/docker/dev/entrypoint-manual.txt /usr/local/bin/
RUN
echo
'0.1.0'
>
/version.txt
# copy service scripts to root dir
COPY
./src/services /services
...
...
build/docker/dev/docker-entrypoint.sh
View file @
0eb50f5b
...
...
@@ -10,17 +10,23 @@ then
fi
# checks for command line argument to start respective service
if
[
"
$1
"
=
"--all"
]
||
[
"
$1
"
=
"-a"
]
then
/services/language_detection/service_language_detection.sh
/services/report/service_report.sh
"
$2
"
chmod
-R
777 /repo/meta
exit
0
fi
if
[
"
$1
"
=
"--help"
]
||
[
"
$1
"
=
"-h"
]
then
cat
/usr/local/bin/entrypoint-manual.txt
exit
0
fi
if
[
"
$1
"
=
"--
test"
]
||
[
"
$1
"
=
"-t
"
]
if
[
"
$1
"
=
"--
language"
]
||
[
"
$1
"
=
"-l
"
]
then
/services/test/service_test.sh
/services/language_detection/service_language_detection.sh
/services/report/service_report.sh
--test
--debug
chmod
-R
777 /repo/meta
exit
0
fi
...
...
@@ -32,18 +38,18 @@ then
exit
0
fi
if
[
"
$1
"
=
"--
language"
]
||
[
"
$1
"
=
"-l
"
]
if
[
"
$1
"
=
"--
test"
]
||
[
"
$1
"
=
"-t
"
]
then
/services/test/service_test.sh
/services/language_detection/service_language_detection.sh
/services/report/service_report.sh
--test
--debug
chmod
-R
777 /repo/meta
exit
0
fi
if
[
"
$1
"
=
"--
all"
]
||
[
"
$1
"
=
"-a
"
]
if
[
"
$1
"
=
"--
version"
]
||
[
"
$1
"
=
"-v
"
]
then
/services/language_detection/service_language_detection.sh
/services/report/service_report.sh
"
$2
"
chmod
-R
777 /repo/meta
cat
/version.txt
exit
0
fi
...
...
build/docker/dev/entrypoint-manual.txt
View file @
0eb50f5b
...
...
@@ -13,4 +13,5 @@ Available services:
generates markdown report
-t, --test show the content of the repo to run services on
and list all available services
and runs all available services with certain debug flags
\ No newline at end of file
and runs all available services with certain debug flags
-v, --version returns version of ci-services
\ No newline at end of file
build/docker/production/Dockerfile
View file @
0eb50f5b
...
...
@@ -9,6 +9,7 @@ RUN apk upgrade
# copy entrypoint script to executables
COPY
./build/docker/production/docker-entrypoint.sh /usr/local/bin/
COPY
./build/docker/production/entrypoint-manual.txt /usr/local/bin/
RUN
echo
'0.1.0'
>
/version.txt
# copy service scripts to root dir
COPY
./src/services /services
...
...
build/docker/production/docker-entrypoint.sh
View file @
0eb50f5b
...
...
@@ -10,16 +10,17 @@ then
fi
# checks for command line argument to start respective service
if
[
"
$1
"
=
"--
help"
]
||
[
"
$1
"
=
"-h
"
]
if
[
"
$1
"
=
"--
all"
]
||
[
"
$1
"
=
"-a
"
]
then
cat
/usr/local/bin/entrypoint-manual.txt
/services/language_detection/service_language_detection.sh
/services/report/service_report.sh
chmod
-R
777 /repo/meta
exit
0
fi
if
[
"
$1
"
=
"--
report"
]
||
[
"
$1
"
=
"-r
"
]
if
[
"
$1
"
=
"--
help"
]
||
[
"
$1
"
=
"-h
"
]
then
/services/report/service_report.sh
chmod
-R
777 /repo/meta
cat
/usr/local/bin/entrypoint-manual.txt
exit
0
fi
...
...
@@ -30,14 +31,19 @@ then
exit
0
fi
if
[
"
$1
"
=
"--
all"
]
||
[
"
$1
"
=
"-a
"
]
if
[
"
$1
"
=
"--
report"
]
||
[
"
$1
"
=
"-r
"
]
then
/services/language_detection/service_language_detection.sh
/services/report/service_report.sh
"
$2
"
/services/report/service_report.sh
chmod
-R
777 /repo/meta
exit
0
fi
if
[
"
$1
"
=
"--version"
]
||
[
"
$1
"
=
"-v"
]
then
cat
/version.txt
exit
0
fi
# if no suitable argument was found, shows help page
echo
echo
"Unknown command line argument! Showing help page..."
...
...
build/docker/production/entrypoint-manual.txt
View file @
0eb50f5b
...
...
@@ -10,4 +10,5 @@ Available services:
-h, --help shows this help page
-l, --language lists used programming languages in given repo
-r, --report consolidates reports from previous ran services
generates markdown report
\ No newline at end of file
generates markdown report
-v, --version returns version of ci-services
\ No newline at end of file
meta/ci-services-report.md
View file @
0eb50f5b
...
...
@@ -9,13 +9,15 @@
**Software Location:**
[
gitext
](
https://gitext.gfz-potsdam.de/hifis/software-services/fair/ci-services
)
**Last Commit:**
168465c558f94e0d1b92c51060b1d956eeb85c91
**Last Commit:**
93b84e30e87c5b611d84f0a18830e2c62ffb485a
**Report Time:**
22/03/2020 14:27:53
**Report Time:**
22/03/2020 20:57:31
**Report Version:**
0.1.0
---
### Completed
Test
s
### Completed
Service
s
**Programming Language Detection**
...
...
@@ -23,7 +25,7 @@
|name|result|
|---|---|
|Dockerfile|1
745
|
|Python|
4626
|
|Ruby|1
350
|
|Shell|
2959
|
|Dockerfile|1
809
|
|Python|
5017
|
|Ruby|1
502
|
|Shell|
3118
|
src/services/language_detection/service_language_detection.rb
View file @
0eb50f5b
...
...
@@ -21,6 +21,9 @@ last_commit_ref = last_commit_ref[0, 40]
report_time
=
Time
.
now
.
strftime
(
"%d/%m/%Y %H:%M:%S"
)
report_version
=
File
.
read
(
"/version.txt"
)
report_version
=
report_version
[
0
,
report_version
.
length
-
1
]
# language detection
repo
=
Rugged
::
Repository
.
new
(
repo_dir
)
project
=
Linguist
::
Repository
.
new
(
repo
,
repo
.
head
.
target_id
)
...
...
@@ -30,6 +33,7 @@ report = {'last commit hash' => last_commit_ref,
'name'
=>
project_name
,
'report time'
=>
report_time
,
'location'
=>
project_location
,
'report version'
=>
report_version
,
'Programming Language Detection'
=>
{
'description'
=>
'Detects used programming languages. Output values are bytes of code.'
,
'result'
=>
project
.
languages
}}
...
...
src/services/report/service_report.py
View file @
0eb50f5b
...
...
@@ -18,6 +18,10 @@ if "--test" in sys.argv:
if
"--debug"
in
sys
.
argv
:
cleanup
=
False
report_version
=
''
with
open
(
'/version.txt'
,
'r'
)
as
file
:
report_version
=
file
.
read
().
replace
(
'
\n
'
,
''
)
# assure that report directory exists
Path
(
working_dir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
...
...
@@ -29,7 +33,7 @@ Path(working_dir).mkdir(parents=True, exist_ok=True)
report_time
=
datetime
.
now
().
strftime
(
"%d/%m/%Y %H:%M:%S"
)
# consolidate subreports
report_dict
=
{}
report_dict
=
{
'report version'
:
report_version
}
for
root
,
dirs
,
files
in
os
.
walk
(
working_dir
,
topdown
=
False
):
for
file
in
files
:
...
...
@@ -79,10 +83,11 @@ with open(working_dir + '/ci-services-report.md', "a+") as md:
md
.
write
(
"**Software Location:** local
\n\n
"
)
md
.
write
(
"**Last Commit:** {}
\n\n
"
.
format
(
report_dict_ordered
[
'last commit hash'
]))
md
.
write
(
"**Report Time:** {}
\n\n
"
.
format
(
report_dict_ordered
[
'report time'
]))
md
.
write
(
"**Report Version:** {}
\n\n
"
.
format
(
report_dict_ordered
[
'report version'
]))
md
.
write
(
'---
\n\n
'
)
# write test results
md
.
write
(
"### Completed
Test
s
\n
"
)
md
.
write
(
"### Completed
Service
s
\n
"
)
for
subreport
in
report_dict_ordered
:
if
isinstance
(
report_dict_ordered
[
subreport
],
dict
):
md
.
write
(
"
\n
**{}**
\n\n
"
.
format
(
subreport
))
...
...
src/services/test/service_test.py
View file @
0eb50f5b
...
...
@@ -14,12 +14,16 @@ project_location = os.popen('echo $CI_PROJECT_URL').read()[:-1]
if
project_location
==
''
:
project_location
=
'local'
report_time
=
datetime
.
now
().
strftime
(
"%d/%m/%Y %H:%M:%S"
)
report_version
=
''
with
open
(
'/version.txt'
,
'r'
)
as
file
:
report_version
=
file
.
read
().
replace
(
'
\n
'
,
''
)
# generate report as dict
report
=
{
'name'
:
project_name
,
'report time'
:
report_time
,
'last commit hash'
:
last_commit_ref
,
'location'
:
project_location
,
'report version'
:
report_version
,
'test'
:
{
'description'
:
'used for debug output in test cases'
,
'result'
:
{
'test'
:
'passed'
}}}
...
...
test/test_report.md
View file @
0eb50f5b
...
...
@@ -13,9 +13,11 @@
**Report Time:**
0
**Report Version:**
0.1.0
---
### Completed
Test
s
### Completed
Service
s
**Programming Language Detection**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment