Commit f6585ef5 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Corrections in device and context GitLab CI pipelines

parent 2508aea4
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -11,16 +11,13 @@ 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"
    - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/
    - docker tag "$IMAGE_NAME_TEST:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG"
    - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG"
  rules:
    - changes:
      - src/$IMAGE_NAME/**
      - .gitlab-ci.yml

# Pull, execute, and test the Docker image from the GitLab registry
test context:
# Pull, execute, and run unitary tests for the Docker image from the GitLab registry
test unitary context:
  variables:
    IMAGE_NAME: 'context' # name of the microservice
    IMAGE_NAME_TEST: 'context-test' # name of the microservice
@@ -34,10 +31,9 @@ test context:
  script:
    - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
    - docker run -d -p 1010:1010 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
    - docker ps > deploy_test_report.txt
    - docker run -d --name $IMAGE_NAME_TEST --network=teraflowbridge --rm "$IMAGE_NAME_TEST:$IMAGE_TAG" > pytest_report.txt
    - docker ps > $IMAGE_NAME--deploy_test_report.txt
    - docker exec -i $IMAGE --network=teraflowbridge "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" > $IMAGE_NAME--pytest_unitary_report.txt
  after_script:
    - docker stop $IMAGE_NAME_TEST
    - docker stop $IMAGE_NAME
  rules:
    - changes:
@@ -46,8 +42,8 @@ test context:
  artifacts:
    when: always
    paths:
      - deploy_test_report.txt
      - pytest_report.txt
      - $IMAGE_NAME--deploy_test_report.txt
      - $IMAGE_NAME--pytest_unitary_report.txt
    expire_in: 1 day

# Deployment of the monitoring service in Kubernetes Cluster
+1 −1
Original line number Diff line number Diff line
FROM context_service:develop
FROM context:latest

# Run integration tests
ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "context/tests/test_integration.py"]
+6 −10
Original line number Diff line number Diff line
@@ -11,16 +11,13 @@ 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"
    - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/
    - docker tag "$IMAGE_NAME_TEST:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG"
    - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME_TEST:$IMAGE_TAG"
  rules:
    - changes:
      - src/$IMAGE_NAME/**
      - .gitlab-ci.yml

# Pull, execute, and test the Docker image from the GitLab registry
test device:
# Pull, execute, and run unitary tests for the Docker image from the GitLab registry
test unitary device:
  variables:
    IMAGE_NAME: 'device' # name of the microservice
    IMAGE_NAME_TEST: 'device-test' # name of the microservice
@@ -34,10 +31,9 @@ test device:
  script:
    - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
    - docker run -d -p 1010:1010 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
    - docker ps > deploy_test_report.txt
    - docker run -d --name $IMAGE_NAME_TEST --network=teraflowbridge --rm "$IMAGE_NAME_TEST:$IMAGE_TAG" > pytest_report.txt
    - docker ps > $IMAGE_NAME--deploy_test_report.txt
    - docker exec -i $IMAGE --network=teraflowbridge "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" > $IMAGE_NAME--pytest_unitary_report.txt
  after_script:
    - docker stop $IMAGE_NAME_TEST
    - docker stop $IMAGE_NAME
  rules:
    - changes:
@@ -46,8 +42,8 @@ test device:
  artifacts:
    when: always
    paths:
      - deploy_test_report.txt
      - pytest_report.txt
      - $IMAGE_NAME--deploy_test_report.txt
      - $IMAGE_NAME--pytest_unitary_report.txt
    expire_in: 1 day

# Deployment of the monitoring service in Kubernetes Cluster
+1 −1
Original line number Diff line number Diff line
FROM device_service:develop
FROM device:latest

# Run integration tests
ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "device/tests/test_integration.py"]