This commit is contained in:
82
.drone.yml
82
.drone.yml
@@ -1,76 +1,14 @@
|
|||||||
kind: pipeline
|
kind: template
|
||||||
type: docker
|
load: java-build-deploy.yaml
|
||||||
name: build
|
data:
|
||||||
platform:
|
build_branches:
|
||||||
os: {{.input.os}}
|
|
||||||
arch: {{.input.arch}}
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- main
|
- main
|
||||||
event:
|
build_events:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
sonar_project_key: my-java-project
|
||||||
steps:
|
deploy_targets:
|
||||||
# test if it compiles correctly
|
|
||||||
- name: build
|
|
||||||
image: maven:3-eclipse-temurin-21
|
|
||||||
commands:
|
|
||||||
- mvn verify --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
|
||||||
|
|
||||||
# run unit tests
|
|
||||||
- name: test
|
|
||||||
image: maven:3-eclipse-temurin-21
|
|
||||||
commands:
|
|
||||||
- mvn test --no-transfer-progress -B -V
|
|
||||||
|
|
||||||
# check maven dependencies
|
|
||||||
- name: dependency-check
|
|
||||||
image: maven:3-eclipse-temurin-21
|
|
||||||
commands:
|
|
||||||
- mvn dependency-check:check --no-transfer-progress -B -V -DnvdApiKey=$NVD_API_KEY
|
|
||||||
environment:
|
|
||||||
NVD_API_KEY:
|
|
||||||
from_secret: nvd_api_key
|
|
||||||
|
|
||||||
# run code analysis
|
|
||||||
- name: code-analysis
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
image: maven:3-eclipse-temurin-21
|
|
||||||
commands:
|
|
||||||
- mvn sonar:sonar --no-transfer-progress -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.token=$SONAR_LOGIN_KEY -B -V
|
|
||||||
environment:
|
|
||||||
SONAR_PROJECT_KEY:
|
|
||||||
from_secret: sonar_project_key
|
|
||||||
SONAR_INSTANCE_URL:
|
|
||||||
from_secret: sonar_instance_url
|
|
||||||
SONAR_LOGIN_KEY:
|
|
||||||
from_secret: sonar_login_key
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: deploy
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
target:
|
|
||||||
- production
|
- production
|
||||||
|
envs:
|
||||||
steps:
|
- name: SONAR_PROJECT_KEY
|
||||||
# skip all previous steps because they were already ran in the "build" phase; we don't need to re-analyze the code.
|
value: HidekoBot
|
||||||
|
|
||||||
# upload to maven repository
|
|
||||||
- name: maven-deploy
|
|
||||||
image: maven:3-eclipse-temurin-21
|
|
||||||
commands:
|
|
||||||
- mvn deploy --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V -gs settings.xml -Dmaven.repo.username=$MAVEN_REPO_USERNAME -Dmaven.repo.password=$MAVEN_REPO_PASSWORD
|
|
||||||
environment:
|
|
||||||
MAVEN_REPO_USERNAME:
|
|
||||||
from_secret: maven_repo_username
|
|
||||||
MAVEN_REPO_PASSWORD:
|
|
||||||
from_secret: maven_repo_password
|
|
||||||
Reference in New Issue
Block a user