cv-api/.drone.yml
aminecmi 758e03c350
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Path issues.
2022-10-01 21:26:37 +02:00

67 lines
1.5 KiB
YAML

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 build
- 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/build/libs
- sudo chown ubuntu:ubuntu ./*
- sudo mv -f ./cvApi-1.0-SNAPSHOT-all.jar /usr/local/bin/ #todo change file to variable
- cd /usr/local/bin/
- sudo mv -f cv-api.jar cv-api.jar.back
- sudo ln -s cvApi-1.0-SNAPSHOT-all.jar cv-api.jar #todo change file to variable
- sudo service cv-api start
trigger:
event:
- promote
target:
- production