Commit 99ee63b9 authored by fabian serin's avatar fabian serin Committed by Luc Yriarte
Browse files

Cicd gitlab

parent 25ec4402
stages:
- pytest
- build
- test
- push
build:
stage: test
stage: pytest
image: python:3.7-slim-buster
script:
- echo ---- ---- ---- SYSTEM DEPENDENCIES ---- ---- ----
......@@ -14,18 +15,24 @@ build:
- pip3 install -r requirements_opengroup.txt
- pip3 install -r requirements_dev.txt
- echo ---- ---- ---- UNIT TESTS ---- ---- ----
- pytest tests --junitxml=report.xml
- pytest --junit-xml=unit_tests_report.xml --cov=app --cov-report=xml:coverage.xml --cov-report=term ./tests/unit
coverage: '/^(?i)(TOTAL).*\s+(\d+\%)$/'
artifacts:
when: always
reports:
junit: report.xml
junit: unit_tests_report.xml
cobertura: coverage.xml
deploy:
stage: push
image: docker:18-dind
stage: build
image: docker:18.09.7-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
- name: docker:18.09.7-dind
entrypoint: ["env", "-u", "DOCKER_TLS_CERTDIR"]
command: ["dockerd-entrypoint.sh"]
script:
......@@ -44,8 +51,13 @@ deploy:
- commit_branch=$commit_id
- echo $commit_branch
- echo ---- ---- BUILD IMAGE
- docker build -t $CI_REGISTRY_IMAGE:$tag_name -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch
- docker build -t $IMAGE_TAG -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- echo ---- ---- PUSH IMAGE
- docker push $CI_REGISTRY_IMAGE:$tag_name
- docker push $IMAGE_TAG
- docker push $CI_REGISTRY_IMAGE:latest
#Scanning for vulnerabilities
include:
- template: Container-Scanning.gitlab-ci.yml
- template: Dependency-Scanning.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
\ No newline at end of file
......@@ -14,7 +14,6 @@ jsonpath-ng # jsonpath-rw maintenance is it bit abandoned
httpx>=0.12.1
typing-extensions>=3.7.4.2
pydantic>=1.5
opencensus
opencensus-ext-stackdriver
opencensus-ext-ocagent
......@@ -3,4 +3,4 @@ pytest-asyncio
pytest-cov
pytest-mock
mockito
requests # used by starlette.TestClient for testing
\ No newline at end of file
requests # used by starlette.TestClient for testing
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment