2022-08-25 22:14:48 +02:00
|
|
|
kind: pipeline
|
2023-01-15 21:54:03 +01:00
|
|
|
type: docker
|
|
|
|
name: build
|
2023-01-16 01:47:58 +01:00
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: arm64
|
2022-08-25 22:14:48 +02:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
- main
|
2023-01-15 21:54:03 +01:00
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
2023-01-15 21:06:01 +01:00
|
|
|
|
2023-01-15 21:21:59 +01:00
|
|
|
steps:
|
2023-01-15 21:54:03 +01:00
|
|
|
# test if it compiles correctly
|
|
|
|
- name: build
|
|
|
|
image: maven:3-eclipse-temurin-16
|
|
|
|
commands:
|
|
|
|
- mvn verify --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
2023-01-15 17:53:07 +01:00
|
|
|
|
2023-01-15 21:54:03 +01:00
|
|
|
# run unit tests
|
|
|
|
- name: test
|
|
|
|
image: maven:3-eclipse-temurin-16
|
|
|
|
commands:
|
|
|
|
- mvn test --no-transfer-progress -B -V
|
2023-01-15 21:25:08 +01:00
|
|
|
|
2023-01-15 21:54:03 +01:00
|
|
|
# run code analysis
|
|
|
|
- name: code-analysis
|
|
|
|
image: maven:3-eclipse-temurin-16
|
|
|
|
commands:
|
|
|
|
- mvn sonar:sonar --no-transfer-progress -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.login=$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: default
|
2023-01-16 01:47:58 +01:00
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: arm64
|
2023-01-15 21:54:03 +01:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# skip all previous steps because they were already ran in the "build" phase; we don't need to re-analyze the code.
|
2023-01-15 21:56:24 +01:00
|
|
|
|
2023-01-15 21:54:03 +01:00
|
|
|
# upload to maven repository
|
|
|
|
- name: maven-deploy
|
|
|
|
image: maven:3-eclipse-temurin-16
|
|
|
|
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
|