This commit is contained in:
aminecmi 2022-10-01 14:37:50 +02:00
parent c7b0bcde49
commit 81ae5785c5
3 changed files with 70 additions and 0 deletions

66
.drone.yml Normal file
View File

@ -0,0 +1,66 @@
kind: pipeline
type: docker
name: analyseAndBuild
steps:
- name: buildAndTest
image: gradle:jdk8
commands:
- ./gradlew build
- ./gradlew test
- name: analyse
image: maven:3-jdk-11
failure: ignore
commands:
- ./gradlew sonarqube -Dsonar.projectKey=cv-api -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN
environment:
SONAR_HOST_URL:
from_secret: sonarScannerHostUrl
SONAR_LOGIN:
from_secret: sonarScannerLogin
trigger:
event:
- push
- pull_request
---
kind: pipeline
type: docker
name: Deploy
steps:
- name: build
image: gradle:jdk8
commands:
- ./gradlew assemble
- name: scpFiles
image: appleboy/drone-scp
settings:
host: amine-louveau.fr
username: ubuntu
key:
from_secret: privateKey
port: 22
target: /home/ubuntu/cv-api
source: build/libs/*
- name: deploy
image: appleboy/drone-ssh
settings:
host: amine-louveau.fr
user: ubuntu
key:
from_secret: privateKey
command_timeout: 2m
script:
- sudo service cv-api stop
- cd /home/ubuntu/cv-api
- sudo chown ubuntu:ubuntu ./*
- sudo mv -f ./cvApi-1.0-SNAPSHOT.jar /usr/local/bin/ #todo change file to variable
- cd /usr/local/bin/
- sudo mv cv-api.jar cv-api.jar.back
- sudo ln -s cvApi-1.0-SNAPSHOT.jar cv-api.jar #todo change file to variable
- sudo service cv-api start
trigger:
event:
- promote
target:
- production

View File

@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.squareup.sqldelight")
id("org.sonarqube")
kotlin("jvm") version "1.7.10"
}

View File

@ -12,6 +12,9 @@ pluginManagement {
if (requested.id.id == "com.squareup.sqldelight") {
useModule("com.squareup.sqldelight:gradle-plugin:1.5.3")
}
if (requested.id.id == "org.sonarqube") {
useModule("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513")
}
}
}
}