diff --git a/src/compute/.gitlab-ci.yml b/src/compute/.gitlab-ci.yml
index 9021dd3f4fe948176b7427814596fada13de99bf..948092ea3b896ce5e487bd7b9e42a6aff6743626 100644
--- a/src/compute/.gitlab-ci.yml
+++ b/src/compute/.gitlab-ci.yml
@@ -1,8 +1,7 @@
-# Build, tag, and push the Docker images to the GitLab Docker registry
+# Build, tag and push the Docker image to the GitLab registry
 build compute:
   variables:
     IMAGE_NAME: 'compute' # name of the microservice
-    IMAGE_NAME_TEST: 'compute-test' # name of the microservice
     IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: build
   before_script:
@@ -11,50 +10,72 @@ build compute:
     - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/
     - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
     - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
+#  after_script:
+#    - docker rmi $(docker images --quiet --filter=dangling=true)
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
-# Pull, execute, and run unitary tests for the Docker image from the GitLab registry
-unit_test compute:
+# Apply unit test to the component
+unit test compute:
   variables:
     IMAGE_NAME: 'compute' # name of the microservice
-    IMAGE_NAME_TEST: 'compute-test' # name of the microservice
     IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: unit_test
   needs:
     - build compute
   before_script:
     - 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
   script:
     - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-    - docker run -d -p 9090:9090 --name $IMAGE_NAME --network=teraflowbridge "$IMAGE_NAME:$IMAGE_TAG"
-    - docker ps -a
+    - docker run --name $IMAGE_NAME -d -p 9090:9090 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
     - sleep 5
     - docker ps -a
-    - docker logs $IMAGE_NAME
     - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py"
   after_script:
-    - docker stop $IMAGE_NAME
-    - docker rm $IMAGE_NAME
+    - docker rm -f $IMAGE_NAME
+    - docker network rm teraflowbridge
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - src/$IMAGE_NAME/tests/Dockerfile
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
 # Deployment of the service in Kubernetes Cluster
 deploy compute:
+  variables:
+    IMAGE_NAME: 'compute' # name of the microservice
+    IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: deploy
   needs:
-    - build compute
-    - unit_test compute
-    - dependencies all
-    - integ_test execute
+    - unit test compute
+    # - integ_test execute
   script:
+    - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/$IMAGE_NAMEservice.yaml'
     - kubectl version
     - kubectl get all
-    - kubectl apply -f "manifests/computeservice.yaml"
-    - kubectl delete pods --selector app=computeservice
+    - kubectl apply -f "manifests/$IMAGE_NAMEservice.yaml"
     - kubectl get all
+  # environment:
+  #   name: test
+  #   url: https://example.com
+  #   kubernetes:
+  #     namespace: test
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
+      when: manual    
+    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
+      when: manual
diff --git a/src/context/.gitlab-ci.yml b/src/context/.gitlab-ci.yml
index 8803cc9c2802ec5991f8ce330c2d86a9e5c763eb..23949213fed4941813b38ab39255648b8ad9364b 100644
--- a/src/context/.gitlab-ci.yml
+++ b/src/context/.gitlab-ci.yml
@@ -1,8 +1,7 @@
-# Build, tag, and push the Docker images to the GitLab Docker registry
+# Build, tag and push the Docker image to the GitLab registry
 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
   before_script:
@@ -11,52 +10,76 @@ build context:
     - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/
     - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
     - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
+#  after_script:
+#    - docker rmi $(docker images --quiet --filter=dangling=true)
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
-# Pull, execute, and run unitary tests for the Docker image from the GitLab registry
-unit_test context:
+# Apply unit test to the component
+unit test 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: unit_test
   needs:
     - build context
   before_script:
     - 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 redis; then docker rm -f redis; else echo "redis image is not in the system"; 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
   script:
     - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
     - docker pull "redis:6.2"
-    - docker run -d --name $IMAGE_NAME-redis --network=teraflowbridge redis:6.2
-    - docker run -d --name $IMAGE_NAME --network=teraflowbridge --env "LOG_LEVEL=INFO" --env "DB_BACKEND=redis" --env "REDIS_SERVICE_HOST=$IMAGE_NAME-redis" --env "REDIS_SERVICE_PORT=6379" --env "REDIS_DATABASE_ID=0" "$IMAGE_NAME:$IMAGE_TAG"
+    - docker run --name redis -d --network=teraflowbridge --rm redis:6.2
+    - docker run --name $IMAGE_NAME -d -p 1010:1010 --env "DB_BACKEND=redis" --env "REDIS_SERVICE_HOST=redis" --env "REDIS_SERVICE_PORT=6379" --env "REDIS_DATABASE_ID=0" --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
+    - sleep 10
     - docker ps -a
-    - sleep 5
-    - docker ps -a
-    - docker logs $IMAGE_NAME
     - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py"
   after_script:
-    - docker stop $IMAGE_NAME $IMAGE_NAME-redis
-    - docker rm $IMAGE_NAME $IMAGE_NAME-redis
+    - docker rm -f $IMAGE_NAME
+    - docker rm -f  redis
+    - docker network rm teraflowbridge
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - src/$IMAGE_NAME/tests/Dockerfile
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
 # Deployment of the service in Kubernetes Cluster
 deploy context:
+  variables:
+    IMAGE_NAME: 'context' # name of the microservice
+    IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: deploy
   needs:
-    - build context
-    - unit_test context
-    - dependencies all
-    - integ_test execute
+    - unit test context
+    # - integ_test execute
   script:
+    - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/$IMAGE_NAMEservice.yaml'
     - kubectl version
     - kubectl get all
-    - kubectl apply -f "manifests/contextservice.yaml"
-    - kubectl delete pods --selector app=contextservice
+    - kubectl apply -f "manifests/$IMAGE_NAMEservice.yaml"
     - kubectl get all
+  # environment:
+  #   name: test
+  #   url: https://example.com
+  #   kubernetes:
+  #     namespace: test
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
+      when: manual    
+    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
+      when: manual
diff --git a/src/device/.gitlab-ci.yml b/src/device/.gitlab-ci.yml
index e6ee81e379f8eeeca6c715bff5dfc6f2cf1c3d23..840c698a006a647cbdead60507a3fea86692b58c 100644
--- a/src/device/.gitlab-ci.yml
+++ b/src/device/.gitlab-ci.yml
@@ -1,8 +1,7 @@
-# Build, tag, and push the Docker images to the GitLab Docker registry
+# Build, tag and push the Docker image to the GitLab registry
 build device:
   variables:
     IMAGE_NAME: 'device' # name of the microservice
-    IMAGE_NAME_TEST: 'device-test' # name of the microservice
     IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: build
   before_script:
@@ -11,50 +10,72 @@ build device:
     - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/
     - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
     - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
+#  after_script:
+#    - docker rmi $(docker images --quiet --filter=dangling=true)
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
-# Pull, execute, and run unitary tests for the Docker image from the GitLab registry
-unit_test device:
+# Apply unit test to the component
+unit test device:
   variables:
     IMAGE_NAME: 'device' # name of the microservice
-    IMAGE_NAME_TEST: 'device-test' # name of the microservice
     IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: unit_test
   needs:
     - build device
   before_script:
     - 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
   script:
     - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-    - docker run -d -p 2020:2020 --name $IMAGE_NAME --network=teraflowbridge "$IMAGE_NAME:$IMAGE_TAG"
-    - docker ps -a
+    - docker run --name $IMAGE_NAME -d -p 2020:2020 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
     - sleep 5
     - docker ps -a
-    - docker logs $IMAGE_NAME
     - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary_driverapi.py $IMAGE_NAME/tests/test_unitary.py"
   after_script:
-    - docker stop $IMAGE_NAME
-    - docker rm $IMAGE_NAME
+    - docker rm -f $IMAGE_NAME
+    - docker network rm teraflowbridge
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - src/$IMAGE_NAME/tests/Dockerfile
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
 # Deployment of the service in Kubernetes Cluster
 deploy device:
+  variables:
+    IMAGE_NAME: 'device' # name of the microservice
+    IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: deploy
   needs:
-    - build device
-    - unit_test device
-    - dependencies all
-    - integ_test execute
+    - unit test device
+    # - integ_test execute
   script:
+    - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/$IMAGE_NAMEservice.yaml'
     - kubectl version
     - kubectl get all
-    - kubectl apply -f "manifests/deviceservice.yaml"
-    - kubectl delete pods --selector app=deviceservice
+    - kubectl apply -f "manifests/$IMAGE_NAMEservice.yaml"
     - kubectl get all
+  # environment:
+  #   name: test
+  #   url: https://example.com
+  #   kubernetes:
+  #     namespace: test
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
+      when: manual    
+    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
+      when: manual
diff --git a/src/monitoring/.gitlab-ci.yml b/src/monitoring/.gitlab-ci.yml
index ca7773f947afd9103ec109f21ae0d30de10753fe..4b475bb26f7fa462743f7586060487174f02c2da 100644
--- a/src/monitoring/.gitlab-ci.yml
+++ b/src/monitoring/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-# build, tag and push the Docker image to the gitlab registry
+# Build, tag and push the Docker image to the GitLab registry
 build monitoring:
   variables:
     IMAGE_NAME: 'monitoring' # name of the microservice
@@ -19,10 +19,10 @@ build monitoring:
       - src/$IMAGE_NAME/**/*.{py,in,yml}
       - src/$IMAGE_NAME/Dockerfile
       - src/$IMAGE_NAME/tests/*.py
-      - manifests/$IMAGE_NAME.yaml
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
-# apply unit test to the monitoring component
+# Apply unit test to the component
 unit test monitoring:
   variables:
     IMAGE_NAME: 'monitoring' # name of the microservice
@@ -39,7 +39,7 @@ unit test monitoring:
     - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
     - docker run --name influxdb -d -p 8086:8086 -e INFLUXDB_DB=$INFLUXDB_DATABASE -e INFLUXDB_ADMIN_USER=$INFLUXDB_USER -e INFLUXDB_ADMIN_PASSWORD=$INFLUXDB_PASSWORD -e INFLUXDB_HTTP_AUTH_ENABLED=True --network=teraflowbridge --rm influxdb:1.8
     - sleep 10
-    - docker run --name $IMAGE_NAME -d -p 7070:7070 --env INFLUXDB_USER=$INFLUXDB_USER --env INFLUXDB_PASSWORD=$INFLUXDB_PASSWORD --env INFLUXDB_DATABASE=$INFLUXDB_DATABASE --env INFLUXDB_HOSTNAME=influxdb -v "$PWD/src/$IMAGE_NAME/tests:/opt/results" --network=teraflowbridge  --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
+    - docker run --name $IMAGE_NAME -d -p 7070:7070 --env INFLUXDB_USER=$INFLUXDB_USER --env INFLUXDB_PASSWORD=$INFLUXDB_PASSWORD --env INFLUXDB_DATABASE=$INFLUXDB_DATABASE --env INFLUXDB_HOSTNAME=influxdb -v "$PWD/src/$IMAGE_NAME/tests:/opt/results" --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
     - sleep 30
     - docker ps -a
     - docker exec -i $IMAGE_NAME bash -c "pytest --junitxml=/opt/results/report.xml"
@@ -55,14 +55,14 @@ unit test monitoring:
       - src/$IMAGE_NAME/Dockerfile
       - src/$IMAGE_NAME/tests/*.py
       - src/$IMAGE_NAME/tests/Dockerfile
-      - manifests/$IMAGE_NAME.yaml
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
   artifacts:
       when: always
       reports:
         junit: src/$IMAGE_NAME/tests/report.xml
 
-# Deployment of the monitoring service in Kubernetes Cluster
+# Deployment of the service in Kubernetes Cluster
 deploy monitoring:
   variables:
     IMAGE_NAME: 'monitoring' # name of the microservice
diff --git a/src/service/.gitlab-ci.yml b/src/service/.gitlab-ci.yml
index edff5aad2ab260310668f60e04fd7e64dc2d0154..9b579ac863f972fa02d18bcc16218555f5a78259 100644
--- a/src/service/.gitlab-ci.yml
+++ b/src/service/.gitlab-ci.yml
@@ -1,8 +1,7 @@
-# Build, tag, and push the Docker images to the GitLab Docker registry
+# Build, tag and push the Docker image to the GitLab registry
 build service:
   variables:
     IMAGE_NAME: 'service' # name of the microservice
-    IMAGE_NAME_TEST: 'service-test' # name of the microservice
     IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: build
   before_script:
@@ -11,50 +10,72 @@ build service:
     - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/
     - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
     - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
+#  after_script:
+#    - docker rmi $(docker images --quiet --filter=dangling=true)
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
-# Pull, execute, and run unitary tests for the Docker image from the GitLab registry
-unit_test service:
+# Apply unit test to the component
+unit test service:
   variables:
     IMAGE_NAME: 'service' # name of the microservice
-    IMAGE_NAME_TEST: 'service-test' # name of the microservice
     IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: unit_test
   needs:
     - build service
   before_script:
     - 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
   script:
     - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-    - docker run -d -p 3030:3030 --name $IMAGE_NAME --network=teraflowbridge "$IMAGE_NAME:$IMAGE_TAG"
-    - docker ps -a
+    - docker run --name $IMAGE_NAME -d -p 3030:3030 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
     - sleep 5
     - docker ps -a
-    - docker logs $IMAGE_NAME
     - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py"
   after_script:
-    - docker stop $IMAGE_NAME
-    - docker rm $IMAGE_NAME
+    - docker rm -f $IMAGE_NAME
+    - docker network rm teraflowbridge
   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 == "push" && $CI_COMMIT_BRANCH == "develop"' 
     - changes:
-      - src/$IMAGE_NAME/**
+      - src/$IMAGE_NAME/**/*.{py,in,yml}
+      - src/$IMAGE_NAME/Dockerfile
+      - src/$IMAGE_NAME/tests/*.py
+      - src/$IMAGE_NAME/tests/Dockerfile
+      - manifests/$IMAGE_NAMEservice.yaml
       - .gitlab-ci.yml
 
 # Deployment of the service in Kubernetes Cluster
 deploy service:
+  variables:
+    IMAGE_NAME: 'service' # name of the microservice
+    IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
   stage: deploy
   needs:
-    - build service
-    - unit_test service
-    - dependencies all
-    - integ_test execute
+    - unit test service
+    # - integ_test execute
   script:
+    - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/$IMAGE_NAMEservice.yaml'
     - kubectl version
     - kubectl get all
-    - kubectl apply -f "manifests/serviceservice.yaml"
-    - kubectl delete pods --selector app=serviceservice
+    - kubectl apply -f "manifests/$IMAGE_NAMEservice.yaml"
     - kubectl get all
+  # environment:
+  #   name: test
+  #   url: https://example.com
+  #   kubernetes:
+  #     namespace: test
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
+      when: manual    
+    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
+      when: manual