Fichiers de configuration de Drone

Fichier docker-compose.yml

version: "3"
networks:
    gogs:
services:
    gogs:
        image: gogs/gogs:latest
        ports:
            - "10022:22"
            - "3000:3000"
        restart: always
        volumes:
            - ./gogs:/data
        networks:
            gogs:
                aliases:
                    - vps711171.ovh.net
    drone-server:
        image: drone/drone:1.3
        ports:
            - "80:80"
        volumes:
            - /var/lib/drone:/data
            - /var/run/docker.sock:/var/run/docker.sock
        depends_on:
            - gogs
        restart: always
        environment:
            - DRONE_GIT_ALWAYS_AUTH=false
            - DRONE_GOGS_SERVER=http://gogs:3000
            - DRONE_RUNNER_CAPACITY=2
            - DRONE_SERVER_HOST=drone-server
            - DRONE_SERVER_PROTO=http
            - DRONE_TLS_AUTOCERT=false
            - DRONE_RUNNER_NETWORKS=drone_gogs
        networks:
            gogs:
    drone-agent:
      image: drone/agent:1.3
      restart: "unless-stopped"
      container_name: "drone-agent"
      command: agent
      networks:
        - web
      depends_on:
        - drone
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      environment:
        - DRONE_RPC_HOST=drone
        - DRONE_RPC_PROTO=http
        - DRONE_RPC_SECRET=toto
        - DRONE_RUNNER_CAPACITY=2
        - DRONE_RUNNER_NAME="local"
     volumes:
        db-data:
        driver: local
        gogs-data:
        driver: local

Fichier .drone.yml pour la fonctionnalité bus-api-ihm

kind: pipeline
name: default
notify:
    image: plugins/matrix
    settings:
        homeserver: https://matrix.org
        roomid: "!NPHgWPeUXMcpQViJTo:matrix.org"
        username:
            from_secret: username
        password:
            from_secret: password
        template: >
            {{#success build.status}}
                hey all! build {{build.number}} succeded.
            {{else error build.status}}
                hey all! build {{build.number}} Failed.Please fix it!
            {{/success}}

steps:
- name: get_build_number
  image: alpine
  commands: 
    - "echo build${DRONE_BUILD_NUMBER} > ihm.version"

- name: bus-api-ihm
    image: plugins/docker
    settings:
        username:
            from_secret: harbor_username
        password:
            from_secret: harbor_password
        registry: harbor.nolwenn.bobbyblues.com
        repo: "harbor.nolwenn.bobbyblues.com/projet_python/bus-api-ihm"
        tags:
            - latest
            - build${DRONE_BUILD_NUMBER}

## Cette partie ne peut fonctionner que si Drone a accès à kube
## = il faut avoir un noeud Kube installé sur la machine où est installé Drone
## car sinon, il y a double NAT (VM + Drone) et donc ça ne peut pas marcher
#- name: deploy_in_kube
#  image: quay.io/honestbee/drone-kubernetes
#  commands:
#    - kubectl patch deploy -n prod ihmdeploy --patch '{"spec": {"template": {"spec": {"containers": [{"image": "'"harbor.nolwenn.bobbyblues.com/projet_python/bus-api-ihm:build${DRONE_BUILD_NUMBER}"'","name": "'"python-ihm"'"}]}}}}'
#  settings:
#    kubernetes_token: 
#      from_secret: kubernetes
#    kubernetes_server: https://192.168.1.210/#/overview?namespace=default
#    namespace: prod
#    deployment: ihmdeploy
#    repo: harbor.nolwenn.bobbyblues.com/projet_python/bus-api-ihm
#    container: python-ihm
#    tag: build${DRONE_BUILD_NUMBER}

- name: notify
    image: plugins/matrix
    settings:
        homeserver: https://matrix.org
        roomid: "!NPHgWPeUXMcpQViJTo:matrix.org"
        username:
            from_secret: username
        password:
            from_secret: password
        template: >
            {{#success build.status}}
                hey all! build {{build.number}} succeded.
            {{else error build.status}}
                hey all! build {{build.number}} Failed.Please fix it!
            {{/success}}