You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Dotnet-WebAPI/ci/.drone.yml

81 lines
2.7 KiB

kind: pipeline
type: docker
name: "CI/CD"
steps:
- image: mcr.microsoft.com/dotnet/sdk:8.0
name: "Run Tests and sonar"
commands:
- apt update && apt install openjdk-17-jre -y
- dotnet tool install --global dotnet-sonarscanner
- dotnet tool install --global dotnet-coverage
- export PATH="$PATH:/root/.dotnet/tools"
- dotnet sonarscanner begin /k:"IQBall-WebAPI" /d:sonar.host.url="https://codefirst.iut.uca.fr/sonar" /d:sonar.login="sqp_b16ad09dcce1b9dde920e313b10c2fe85566624c" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
- dotnet build
- dotnet-coverage collect "dotnet test" -f xml -o coverage.xml
- dotnet sonarscanner end /d:sonar.login="sqp_b16ad09dcce1b9dde920e313b10c2fe85566624c"
- image: plugins/docker
name: "build and push docker image"
depends_on:
- "Run Tests and sonar"
settings:
dockerfile: ci/API.dockerfile
context: .
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/maxime.batista/iqball-api-dotnet
tags:
- ${DRONE_BRANCH/\//_}
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
from_secret: SECRET_REGISTRY_PASSWORD
# deploy staging database and server on codefirst
- image: ubuntu:latest
name: "Instantiate docker images on staging server"
depends_on:
- "build and push docker image"
environment:
PRIVATE_KEY:
from_secret: PRIVATE_KEY
commands:
- chmod +x ci/deploy_staging_server_step.sh
- ci/deploy_staging_server_step.sh
# Deploy the production database and server on codefirst
# - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
# name: "Instantiate dotnet api docker image on codefirst"
# depends_on:
# - "build and push docker image"
# environment:
# IMAGENAME: hub.codefirst.iut.uca.fr/maxime.batista/iqball-api-dotnet:master
# CONTAINERNAME: iqball_production_dotnet_webserver
# OVERWRITE: true
# COMMAND: create
#
# CODEFIRST_CLIENTDRONE_ENV_PGSQL_DSN:
# from_secret: POSTGRES_DSN
# ADMINS: maximebatista
#
# - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
# name: "Instantiate pgsql database docker image on codefirst"
# depends_on:
# - "build and push docker image"
# environment:
# IMAGENAME: postgres
# CONTAINERNAME: iqball_production_database
# COMMAND: create
#
# CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD:
# from_secret: POSTGRES_PASSWORD
# CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER:
# from_secret: POSTGRES_USER
# CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
# from_secret: POSTGRES_DB
# ADMINS: maximebatista