Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
TFS
controller
Commits
47f2fa09
Commit
47f2fa09
authored
2 years ago
by
Carlos Natalino Da Silva
Browse files
Options
Downloads
Patches
Plain Diff
Improving CI/CD pipeline of the DBSCANServing component.
parent
ba0fea63
No related branches found
No related tags found
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!97
Optical cybersecurity scenario
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dbscanserving/.gitlab-ci.yml
+8
-6
8 additions, 6 deletions
src/dbscanserving/.gitlab-ci.yml
with
8 additions
and
6 deletions
src/dbscanserving/.gitlab-ci.yml
+
8
−
6
View file @
47f2fa09
# Copyright 202
1
-2023
H2020
TeraFlow
(https://www.teraflow-h2020.eu
/)
# Copyright 202
2
-2023
ETSI
TeraFlow
SDN - TFS OSG (https://tfs.etsi.org
/)
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
#
b
uild, tag and push the Docker image to the
g
it
l
ab registry
#
B
uild, tag
,
and push the Docker image to the
G
it
L
ab
Docker
registry
build dbscanserving
:
build dbscanserving
:
variables
:
variables
:
IMAGE_NAME
:
'
dbscanserving'
# name of the microservice
IMAGE_NAME
:
'
dbscanserving'
# name of the microservice
...
@@ -28,16 +28,15 @@ build dbscanserving:
...
@@ -28,16 +28,15 @@ build dbscanserving:
-
docker images --filter="dangling=true" --quiet | xargs -r docker rmi
-
docker images --filter="dangling=true" --quiet | xargs -r docker rmi
rules
:
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"
&&
($CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"develop"
||
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
$CI_DEFAULT_BRANCH)'
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"
&&
($CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"develop"
||
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
$CI_DEFAULT_BRANCH)'
-
if
:
'
$CI_PIPELINE_SOURCE
==
"push"
&&
$CI_COMMIT_BRANCH
==
"develop"'
-
if
:
'
$CI_PIPELINE_SOURCE
==
"push"
&&
$CI_COMMIT_BRANCH
==
"develop"'
-
changes
:
-
changes
:
-
src/$IMAGE_NAME/**/*.{py,in,yml}
-
src/$IMAGE_NAME/**/*.{py,in,yml}
-
src/$IMAGE_NAME/Dockerfile
-
src/$IMAGE_NAME/Dockerfile
-
src/$IMAGE_NAME/tests/*.py
-
src/$IMAGE_NAME/tests/*.py
-
src/$IMAGE_NAME/tests/Dockerfile
-
manifests/${IMAGE_NAME}service.yaml
-
manifests/${IMAGE_NAME}service.yaml
-
.gitlab-ci.yml
-
.gitlab-ci.yml
#
a
pply unit test to the
dbscanserving
component
#
A
pply unit test to the component
unit_test dbscanserving
:
unit_test dbscanserving
:
variables
:
variables
:
IMAGE_NAME
:
'
dbscanserving'
# name of the microservice
IMAGE_NAME
:
'
dbscanserving'
# name of the microservice
...
@@ -48,13 +47,16 @@ unit_test dbscanserving:
...
@@ -48,13 +47,16 @@ unit_test dbscanserving:
before_script
:
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi
-
if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi
-
if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME
image
is not in the system"; fi
-
if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME
container
is not in the system"; fi
script
:
script
:
-
docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-
docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-
docker run --name $IMAGE_NAME -d -p 10008:10008 -v "$PWD/src/$IMAGE_NAME/tests:/home/${IMAGE_NAME}/results" --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
-
docker run --name $IMAGE_NAME -d -p 10008:10008 -v "$PWD/src/$IMAGE_NAME/tests:/home/${IMAGE_NAME}/results" --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
-
sleep
5
-
sleep
5
-
docker ps -a
-
docker ps -a
-
docker logs $IMAGE_NAME
-
docker logs $IMAGE_NAME
-
docker exec ps -a
-
sleep
5
-
docker logs $IMAGE_NAME
-
docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/home/${IMAGE_NAME}/results/${IMAGE_NAME}_report.xml"
-
docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/home/${IMAGE_NAME}/results/${IMAGE_NAME}_report.xml"
-
docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
-
docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
coverage
:
'
/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
coverage
:
'
/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
...
...
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