69 lines
1.7 KiB
YAML
69 lines
1.7 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: analyseAndBuild
|
|
|
|
steps:
|
|
- name: test
|
|
image: maven:3-jdk-11
|
|
commands:
|
|
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
|
- mvn test -B
|
|
- name: analyse
|
|
image: maven:3-jdk-11
|
|
failure: ignore
|
|
commands:
|
|
- echo $SONAR_HOST_URL
|
|
- echo $SONAR_LOGIN
|
|
- mvn clean verify sonar:sonar -Dsonar.projectKey=LDC -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: maven:3-jdk-11
|
|
commands:
|
|
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true
|
|
- name: scpFiles
|
|
image: appleboy/drone-scp
|
|
settings:
|
|
host: amine-louveau.fr
|
|
username: ubuntu
|
|
key:
|
|
from_secret: privateKey
|
|
port: 22
|
|
target: /home/ubuntu/courses-jar
|
|
source: target/*
|
|
- name: deploy
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host: amine-louveau.fr
|
|
user: ubuntu
|
|
key:
|
|
from_secret: privateKey
|
|
command_timeout: 2m
|
|
script:
|
|
- sudo service ldc stop
|
|
- cd /home/ubuntu/courses-jar
|
|
- mv target/* ./
|
|
- sudo chown ubuntu:ubuntu ./*
|
|
- sudo mv ./liste-de-courses-1.4-SNAPSHOT-jar-with-dependencies.jar /usr/local/bin/ #todo change file to variable
|
|
- cd /usr/local/bin/
|
|
- sudo rm ldc.jar
|
|
- sudo ln -s liste-de-courses-1.4-SNAPSHOT-jar-with-dependencies.jar ldc.jar #todo change file to variable
|
|
- sudo service ldc start
|
|
trigger:
|
|
event:
|
|
- promote
|
|
target:
|
|
- production |