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
642ff046
Commit
642ff046
authored
3 years ago
by
Sergio Gonzalez Diaz
Browse files
Options
Downloads
Patches
Plain Diff
update .gitlab-ci.yml
parent
dd10a45f
No related branches found
No related tags found
1 merge request
!54
Release 2.0.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/context/.gitlab-ci.yml
+49
-44
49 additions, 44 deletions
src/context/.gitlab-ci.yml
with
49 additions
and
44 deletions
src/context/.gitlab-ci.yml
+
49
−
44
View file @
642ff046
# build, tag and push the Docker image to the gitlab registry
variables
:
IMAGE_NAME
:
'
context'
# name of the microservice
IMAGE_NAME_TEST
:
'
context-test'
# name of the microservice
IMAGE_TAG
:
'
latest'
# tag of the container image (production, development, etc)
# build the Docker image
build context
:
build context
:
variables
:
IMAGE_NAME
:
'
context'
# name of the microservice
IMAGE_NAME_TEST
:
'
context-test'
# name of the microservice
IMAGE_TAG
:
'
latest'
# tag of the container image (production, development, etc)
stage
:
build
stage
:
build
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script
:
script
:
-
docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/
-
docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/
rules
:
-
changes
:
-
src/$IMAGE_NAME/**
-
.gitlab-ci.yml
# tags the Docker image
tag context
:
stage
:
build
script
:
-
docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-
docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
rules
:
-
changes
:
-
src/$IMAGE_NAME/**
-
.gitlab-ci.yml
# push the Docker image to the gitlab Docker registry
push context
:
stage
:
build
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script
:
-
docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-
docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
rules
:
rules
:
-
changes
:
-
changes
:
-
src/$IMAGE_NAME/*.{py,in,yml}
-
src/$IMAGE_NAME/**
-
src/$IMAGE_NAME/Dockerfile
-
src/$IMAGE_NAME/tests/*.py
-
src/$IMAGE_NAME/tests/Dockerfile
-
.gitlab-ci.yml
-
.gitlab-ci.yml
# test if the Docker image can be pulled from the gitlab registry
# test if the Docker image can be pulled from the gitlab registry
test context pull
:
test context pull
:
variables
:
IMAGE_NAME
:
'
context'
# name of the microservice
IMAGE_NAME_TEST
:
'
context-test'
# name of the microservice
IMAGE_TAG
:
'
latest'
# tag of the container image (production, development, etc)
stage
:
test
stage
:
test
needs
:
needs
:
-
build
context
-
push
context
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
script
:
script
:
-
docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-
docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
rules
:
rules
:
-
changes
:
-
changes
:
-
src/$IMAGE_NAME/*.{py,in,yml}
-
src/$IMAGE_NAME/**
-
src/$IMAGE_NAME/Dockerfile
-
src/$IMAGE_NAME/tests/*.py
-
src/$IMAGE_NAME/tests/Dockerfile
-
.gitlab-ci.yml
-
.gitlab-ci.yml
# test if the Docker image can be executed
# test if the Docker image can be executed
test context run
:
test context run
:
variables
:
IMAGE_NAME
:
'
context'
# name of the microservice
IMAGE_NAME_TEST
:
'
context-test'
# name of the microservice
IMAGE_TAG
:
'
latest'
# tag of the container image (production, development, etc)
stage
:
test
stage
:
test
needs
:
needs
:
-
build context
-
build context
...
@@ -53,16 +59,18 @@ test context run:
...
@@ -53,16 +59,18 @@ test context run:
-
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
script
:
script
:
-
docker run -d -p 1010:1010 --name context --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
-
docker run -d -p 1010:1010 --name context --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
-
docker ps
-
docker ps
> deploy_test_report.txt
after_script
:
after_script
:
-
docker stop context
-
docker stop context
rules
:
rules
:
-
changes
:
-
changes
:
-
src/$IMAGE_NAME/*.{py,in,yml}
-
src/$IMAGE_NAME/**
-
src/$IMAGE_NAME/Dockerfile
-
src/$IMAGE_NAME/tests/*.py
-
src/$IMAGE_NAME/tests/Dockerfile
-
.gitlab-ci.yml
-
.gitlab-ci.yml
artifacts
:
when
:
always
paths
:
-
deploy_test_report.txt
expire_in
:
1 day
# apply unit test to the context component
# apply unit test to the context component
test context pytest
:
test context pytest
:
...
@@ -73,10 +81,7 @@ test context pytest:
...
@@ -73,10 +81,7 @@ test context pytest:
-
docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ > pytest_report.txt
-
docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ > pytest_report.txt
rules
:
rules
:
-
changes
:
-
changes
:
-
src/$IMAGE_NAME/*.{py,in,yml}
-
src/$IMAGE_NAME/**
-
src/$IMAGE_NAME/Dockerfile
-
src/$IMAGE_NAME/tests/*.py
-
src/$IMAGE_NAME/tests/Dockerfile
-
.gitlab-ci.yml
-
.gitlab-ci.yml
artifacts
:
artifacts
:
when
:
always
when
:
always
...
@@ -85,14 +90,14 @@ test context pytest:
...
@@ -85,14 +90,14 @@ test context pytest:
expire_in
:
1 day
expire_in
:
1 day
# Deployment of the monitoring service in Kubernetes Cluster
# Deployment of the monitoring service in Kubernetes Cluster
#
deploy context:
deploy context
:
#
stage: deploy
stage
:
deploy
#
needs:
needs
:
#
- build context
-
build context
#
- test context run
-
test context run
#
script:
script
:
#
- kubectl version
-
kubectl version
#
- kubectl get all
-
kubectl get all
#
- kubectl apply -f "manifests/contextservice.yaml"
-
kubectl apply -f "manifests/contextservice.yaml"
#
- kubectl get all
-
kubectl get all
#
when: manual
when
:
manual
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