Skip to content
Snippets Groups Projects
Commit f6585ef5 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Corrections in device and context GitLab CI pipelines

parent 2508aea4
No related branches found
No related tags found
1 merge request!54Release 2.0.0
...@@ -11,16 +11,13 @@ build context: ...@@ -11,16 +11,13 @@ build context:
- 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/
- 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"
- docker push "$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: rules:
- changes: - changes:
- src/$IMAGE_NAME/** - src/$IMAGE_NAME/**
- .gitlab-ci.yml - .gitlab-ci.yml
# Pull, execute, and test the Docker image from the GitLab registry # Pull, execute, and run unitary tests for the Docker image from the GitLab registry
test context: test unitary context:
variables: variables:
IMAGE_NAME: 'context' # name of the microservice IMAGE_NAME: 'context' # name of the microservice
IMAGE_NAME_TEST: 'context-test' # name of the microservice IMAGE_NAME_TEST: 'context-test' # name of the microservice
...@@ -34,10 +31,9 @@ test context: ...@@ -34,10 +31,9 @@ test context:
script: script:
- docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - 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 run -d -p 1010:1010 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
- docker ps > deploy_test_report.txt - docker ps > $IMAGE_NAME--deploy_test_report.txt
- docker run -d --name $IMAGE_NAME_TEST --network=teraflowbridge --rm "$IMAGE_NAME_TEST:$IMAGE_TAG" > pytest_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: after_script:
- docker stop $IMAGE_NAME_TEST
- docker stop $IMAGE_NAME - docker stop $IMAGE_NAME
rules: rules:
- changes: - changes:
...@@ -46,8 +42,8 @@ test context: ...@@ -46,8 +42,8 @@ test context:
artifacts: artifacts:
when: always when: always
paths: paths:
- deploy_test_report.txt - $IMAGE_NAME--deploy_test_report.txt
- pytest_report.txt - $IMAGE_NAME--pytest_unitary_report.txt
expire_in: 1 day expire_in: 1 day
# Deployment of the monitoring service in Kubernetes Cluster # Deployment of the monitoring service in Kubernetes Cluster
......
FROM context_service:develop FROM context:latest
# Run integration tests # Run integration tests
ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "context/tests/test_integration.py"] ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "context/tests/test_integration.py"]
...@@ -11,16 +11,13 @@ build device: ...@@ -11,16 +11,13 @@ build device:
- 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/
- 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"
- docker push "$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: rules:
- changes: - changes:
- src/$IMAGE_NAME/** - src/$IMAGE_NAME/**
- .gitlab-ci.yml - .gitlab-ci.yml
# Pull, execute, and test the Docker image from the GitLab registry # Pull, execute, and run unitary tests for the Docker image from the GitLab registry
test device: test unitary device:
variables: variables:
IMAGE_NAME: 'device' # name of the microservice IMAGE_NAME: 'device' # name of the microservice
IMAGE_NAME_TEST: 'device-test' # name of the microservice IMAGE_NAME_TEST: 'device-test' # name of the microservice
...@@ -34,10 +31,9 @@ test device: ...@@ -34,10 +31,9 @@ test device:
script: script:
- docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - 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 run -d -p 1010:1010 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG"
- docker ps > deploy_test_report.txt - docker ps > $IMAGE_NAME--deploy_test_report.txt
- docker run -d --name $IMAGE_NAME_TEST --network=teraflowbridge --rm "$IMAGE_NAME_TEST:$IMAGE_TAG" > pytest_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: after_script:
- docker stop $IMAGE_NAME_TEST
- docker stop $IMAGE_NAME - docker stop $IMAGE_NAME
rules: rules:
- changes: - changes:
...@@ -46,8 +42,8 @@ test device: ...@@ -46,8 +42,8 @@ test device:
artifacts: artifacts:
when: always when: always
paths: paths:
- deploy_test_report.txt - $IMAGE_NAME--deploy_test_report.txt
- pytest_report.txt - $IMAGE_NAME--pytest_unitary_report.txt
expire_in: 1 day expire_in: 1 day
# Deployment of the monitoring service in Kubernetes Cluster # Deployment of the monitoring service in Kubernetes Cluster
......
FROM device_service:develop FROM device:latest
# Run integration tests # Run integration tests
ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "device/tests/test_integration.py"] ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "device/tests/test_integration.py"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment