From 695746a507ef1da969428bb19e6918fad54651d4 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Thu, 29 Sep 2022 15:09:17 +0200 Subject: [PATCH] Drone setup. --- .drone.yml | 107 +++++++++++++++++++++++++++++++++++ .scannerwork/.sonar_lock | 0 .scannerwork/report-task.txt | 6 ++ 3 files changed, 113 insertions(+) create mode 100644 .drone.yml create mode 100644 .scannerwork/.sonar_lock create mode 100644 .scannerwork/report-task.txt diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..7241e03 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,107 @@ +kind: pipeline +type: docker +name: analyseAndBuild + +steps: + - name: code-analysis + image: sonarsource/sonar-scanner-cli + detach: true + failure: ignore + commands: + - sonar-scanner -Dsonar.projectKey=cv -Dsonar.sources=. -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN + environment: + SONAR_HOST_URL: + from_secret: sonarScannerHostUrl + SONAR_LOGIN: + from_secret: sonarScannerLogin + + - name: lintAndBuild + image: node:14 + commands: + - npm install + - npm run lint + - npm run build:prod + environment: + VUE_APP_API_BASE_URL: + from_secret: baseurl + + - name: saveNodeModules + image: drillster/drone-volume-cache + volumes: + - name: cache + path: /cache + settings: + rebuild: true + mount: + - ./node_modules + cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] + +trigger: + event: + - push + - pull_request + +volumes: + - name: cache + host: + path: /tmp/cache +--- +kind: pipeline +type: docker +name: Deploy + +steps: + - name: getNodeModules + image: drillster/drone-volume-cache + volumes: + - name: cache + path: /cache + settings: + restore: true + mount: + - ./node_modules + cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] + + - name: build + image: node:14 + commands: + - npm run build:prod + environment: + VUE_APP_API_BASE_URL: + from_secret: baseurl + + - name: scpFiles + image: appleboy/drone-scp + settings: + host: amine-louveau.fr + username: ubuntu + key: + from_secret: privateKey + port: 22 + target: /home/ubuntu/courses + source: dist/* + + - name: deploy + image: appleboy/drone-ssh + settings: + host: amine-louveau.fr + user: ubuntu + key: + from_secret: privateKey + command_timeout: 2m + script: + - cd /home/ubuntu/courses + - mv dist/* ./ + - sudo chown www-data:www-data ./* + - sudo rm -rf /var/www/amine/courses/* + - sudo mv ./* /var/www/amine/courses/ +trigger: + event: + - promote + target: + - production + +volumes: + - name: cache + host: + path: /tmp/cache diff --git a/.scannerwork/.sonar_lock b/.scannerwork/.sonar_lock new file mode 100644 index 0000000..e69de29 diff --git a/.scannerwork/report-task.txt b/.scannerwork/report-task.txt new file mode 100644 index 0000000..9cadb0b --- /dev/null +++ b/.scannerwork/report-task.txt @@ -0,0 +1,6 @@ +projectKey=cv +serverUrl=http://18.0.0.7:9000 +serverVersion=9.6.0.59041 +dashboardUrl=http://18.0.0.7:9000/dashboard?id=cv +ceTaskId=AYOJWrb2HpE7RRVya8HT +ceTaskUrl=http://18.0.0.7:9000/api/ce/task?id=AYOJWrb2HpE7RRVya8HT