Loading src/monitoring/.gitlab-ci.yml +11 −8 Original line number Diff line number Diff line Loading @@ -12,6 +12,15 @@ build monitoring: - src/$IMAGE_NAME/** - .gitlab-ci.yml build monitoring test: stage: build script: - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ rules: - changes: - src/$IMAGE_NAME/** - .gitlab-ci.yml # tags the Docker image tag monitoring: stage: build Loading Loading @@ -75,17 +84,11 @@ test monitoring run: test monitoring pytest: stage: test needs: - build monitoring - build monitoring test before_script: - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi script: - docker run -d -p 7070:7070 --name monitoring-tests --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker exec -it monitoring-tests /bin/bash - docker exec -it monioting-tests pytest --junitxml=report.xml after_script: - docker stop monitoring-tests artifacts: when: always reports: junit: report.xml expire_in: 1 day src/monitoring/tests/Dockerfile 0 → 100644 +30 −0 Original line number Diff line number Diff line FROM python:3-slim RUN apt-get --yes --quiet --quiet update && \ apt-get --yes --quiet --quiet install wget g++ && \ rm -rf /var/lib/apt/lists/* # show python logs as they occur ENV PYTHONUNBUFFERED=0 # download the grpc health probe RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ chmod +x /bin/grpc_health_probe # get packages WORKDIR /var/monitoring RUN python3 -m pip install --upgrade pip setuptools wheel pip-tools COPY monitoring/requirements.in requirements.in RUN pip-compile --output-file=requirements.txt requirements.in RUN python3 -m pip install -r requirements.txt # add files into working directory COPY monitoring/. . COPY common/logger.py . # set listen port ENV PORT=7070 EXPOSE 7070 RUN pytest Loading
src/monitoring/.gitlab-ci.yml +11 −8 Original line number Diff line number Diff line Loading @@ -12,6 +12,15 @@ build monitoring: - src/$IMAGE_NAME/** - .gitlab-ci.yml build monitoring test: stage: build script: - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ rules: - changes: - src/$IMAGE_NAME/** - .gitlab-ci.yml # tags the Docker image tag monitoring: stage: build Loading Loading @@ -75,17 +84,11 @@ test monitoring run: test monitoring pytest: stage: test needs: - build monitoring - build monitoring test before_script: - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi script: - docker run -d -p 7070:7070 --name monitoring-tests --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker exec -it monitoring-tests /bin/bash - docker exec -it monioting-tests pytest --junitxml=report.xml after_script: - docker stop monitoring-tests artifacts: when: always reports: junit: report.xml expire_in: 1 day
src/monitoring/tests/Dockerfile 0 → 100644 +30 −0 Original line number Diff line number Diff line FROM python:3-slim RUN apt-get --yes --quiet --quiet update && \ apt-get --yes --quiet --quiet install wget g++ && \ rm -rf /var/lib/apt/lists/* # show python logs as they occur ENV PYTHONUNBUFFERED=0 # download the grpc health probe RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ chmod +x /bin/grpc_health_probe # get packages WORKDIR /var/monitoring RUN python3 -m pip install --upgrade pip setuptools wheel pip-tools COPY monitoring/requirements.in requirements.in RUN pip-compile --output-file=requirements.txt requirements.in RUN python3 -m pip install -r requirements.txt # add files into working directory COPY monitoring/. . COPY common/logger.py . # set listen port ENV PORT=7070 EXPOSE 7070 RUN pytest