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.
211 lines
7.1 KiB
211 lines
7.1 KiB
kind: pipeline
|
|
type: docker
|
|
name: CI_ApiPm
|
|
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
- pull_request
|
|
- tag
|
|
branch:
|
|
exclude:
|
|
- master
|
|
|
|
volumes:
|
|
- name: docs
|
|
temp: {}
|
|
|
|
steps:
|
|
- name: restore & build
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet build WF_EF_Api/WF_EF_Api.sln --configuration Release
|
|
depends_on: [clone]
|
|
|
|
- name: test
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj
|
|
depends_on: [restore & build]
|
|
|
|
- name: publish
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet publish WF_EF_Api/WfApi/WfApi.csproj -c Release -o out
|
|
depends_on: [restore & build, test]
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
type: docker
|
|
name: CI_ApiPm_Master
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
branch:
|
|
- master
|
|
|
|
volumes:
|
|
- name: doc
|
|
temp: {}
|
|
|
|
steps:
|
|
- name: restore & build
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet build WF_EF_Api/WF_EF_Api.sln --configuration Release
|
|
depends_on: [clone]
|
|
|
|
- name: test
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj
|
|
depends_on: [restore & build]
|
|
|
|
- name: generate doc
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
volumes:
|
|
- name: doc
|
|
path: /doc
|
|
commands:
|
|
- dotnet new tool-manifest
|
|
- dotnet tool install NSwag.ConsoleCore
|
|
- dotnet restore WF_EF_Api/WF_EF_Api.sln
|
|
- dotnet clean WF_EF_Api/WfApi/WfApi.csproj
|
|
- cd WF_EF_Api/WfApi
|
|
- dotnet nswag aspnetcore2openapi /output:/doc/swagger.json
|
|
depends_on: [clone, restore & build , test]
|
|
|
|
- name: code-inspection
|
|
image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8
|
|
secrets: [ SECRET_SONAR_LOGIN ]
|
|
environment:
|
|
sonar_host: https://codefirst.iut.uca.fr/sonar/
|
|
sonar_token_wtf:
|
|
from_secret: SECRET_SONAR_LOGIN
|
|
project_key: wtf-service
|
|
commands:
|
|
- dotnet restore WF_EF_Api/WF_EF_Api.sln
|
|
- dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.login=$${sonar_token_wtf}
|
|
- dotnet build WF_EF_Api/WF_EF_Api.sln -c Release --no-restore
|
|
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
|
|
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
|
|
- dotnet sonarscanner end /d:sonar.login=$${sonar_token_wtf}
|
|
depends_on: [test,generate doc]
|
|
|
|
- name: publish
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
commands:
|
|
- dotnet publish WF_EF_Api/WfApi/WfApi.csproj -c Release -o out
|
|
depends_on: [restore & build, test]
|
|
|
|
- name: deploy-api-db
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
|
environment:
|
|
IMAGENAME: postgres:16.8-alpine3.20
|
|
CONTAINERNAME: wtf-api
|
|
COMMAND: create
|
|
PRIVATE: true
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD:
|
|
from_secret: POSTGRES_PASSWORD_API
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER:
|
|
from_secret: POSTGRES_USER_API
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
|
|
from_secret: POSTGRES_DB_API
|
|
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
|
|
|
- name: deploy-auth-db
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
|
environment:
|
|
IMAGENAME: postgres:16.8-alpine3.20
|
|
CONTAINERNAME: wtf-api-auth
|
|
COMMAND: create
|
|
PRIVATE: true
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD:
|
|
from_secret: POSTGRES_PASSWORD_AUTH
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER:
|
|
from_secret: POSTGRES_USER_AUTH
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
|
|
from_secret: POSTGRES_DB_AUTH
|
|
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
|
|
|
- name: deploy-test-db
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
|
environment:
|
|
IMAGENAME: postgres:16.8-alpine3.20
|
|
CONTAINERNAME: wtf-api-test
|
|
COMMAND: create
|
|
PRIVATE: true
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD: "test"
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER: "test"
|
|
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB: "wtf-test"
|
|
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
|
|
|
|
|
- name: update-database
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
DB_SERVER: "WhatTheFantasy-wtf-api"
|
|
DB_NAME:
|
|
from_secret: POSTGRES_DB_API
|
|
USER_ID:
|
|
from_secret: POSTGRES_USER_API
|
|
PASSWORD:
|
|
from_secret: POSTGRES_PASSWORD_API
|
|
#DB_PATH_AUTH: "WhatTheFantasy-wtf-api-auth"
|
|
commands:
|
|
- cd WF_EF_Api/StubbedContextLib
|
|
- dotnet tool install --global dotnet-ef
|
|
- export PATH="$PATH:/root/.dotnet/tools"
|
|
- dotnet ef database update --connection "Host=$${DB_SERVER};Database=$${DB_NAME};Username=$${DB_USER};Password=$${DB_PASSWORD};"
|
|
depends_on: [deploy-api-db,deploy-auth-db,deploy-test-db]
|
|
|
|
- name: publish-to-registry
|
|
image: plugins/docker
|
|
settings:
|
|
dockerfile: WF_EF_Api/WfApi/Dockerfile
|
|
context: WF_EF_Api/
|
|
registry: hub.codefirst.iut.uca.fr
|
|
repo: hub.codefirst.iut.uca.fr/whatthefantasy/wf-pmapi
|
|
username:
|
|
from_secret: SECRET_REGISTRY_USERNAME
|
|
password:
|
|
from_secret: SECRET_REGISTRY_PASSWORD
|
|
depends_on: [restore & build, test, code-inspection, publish]
|
|
|
|
- name: deploy-container
|
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
|
environment:
|
|
IMAGENAME: hub.codefirst.iut.uca.fr/whatthefantasy/wf-pmapi:latest
|
|
CONTAINERNAME: web-services
|
|
COMMAND: create
|
|
OVERWRITE: true
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API: "WhatTheFantasy-wtf-api"
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_USER_API:
|
|
from_secret: POSTGRES_USER_API
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_API:
|
|
from_secret: POSTGRES_PASSWORD_API
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_API:
|
|
from_secret: POSTGRES_DB_API
|
|
|
|
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_AUTH: "WhatTheFantasy-wtf-api-auth"
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_USER_AUTH:
|
|
from_secret: POSTGRES_USER_AUTH
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_AUTH:
|
|
from_secret: POSTGRES_PASSWORD_AUTH
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_AUTH:
|
|
from_secret: POSTGRES_DB_AUTH
|
|
|
|
|
|
#CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "WhatTheFantasy-wtf-api-test"
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "api-test"
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_USER_API_TEST: "test"
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_API_TEST: "test"
|
|
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_API_TEST: "wtf-db-test"
|
|
|
|
|
|
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
|
depends_on: [restore & build, test, code-inspection, publish, publish-to-registry]
|