kind: pipeline
type: docker
name: CI-pipeline

trigger:
  branch: 
    - master
  event: 
    - push

steps:
  

  - name: code-inspection
    image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8
    secrets: [ SECRET_SONAR_LOGIN ]
    settings:
      sonar_host: https://codefirst.iut.uca.fr/sonar/
      sonar_token:
        from_secret: SECRET_SONAR_LOGIN
    commands:
      - dotnet sonarscanner begin /k:WF-Website /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} 

      - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
      - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}

  # database container deployment
  - name: deploy-container-mysql-WIKI_FANTASY
    image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
    environment:
        IMAGENAME: mysql:latest
        CONTAINERNAME: mysql
        COMMAND: create
        OVERWRITE: false
        PRIVATE: true

        CODEFIRST_CLIENTDRONE_ENV_MYSQL_ROOT_PASSWORD:
          from_secret: db_root_password
        CODEFIRST_CLIENTDRONE_ENV_MYSQL_DATABASE:
          from_secret: db_database
        CODEFIRST_CLIENTDRONE_ENV_MYSQL_USER:
          from_secret: db_user
        CODEFIRST_CLIENTDRONE_ENV_MYSQL_PASSWORD:
          from_secret: db_password
        ADMINS:  kentinbrongniart , kevinmondejar , lenibeaulaton , louisguichard-montguers , maximerocher , tommynguyen , matthieurestituito

    
  - name: generate-and-deploy-docs
    image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer
    failure: ignore
    volumes:
      - name: 
        path: 
    commands:
      - /entrypoint.sh
    when:
      branch:
        - master
      event:
        - push
        - pull_request
    depends_on: []
