-
Notifications
You must be signed in to change notification settings - Fork 42
/
.gitlab-ci.yml
130 lines (111 loc) · 4.76 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
image: maven:latest
variables:
BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID -Dfile.encoding=UTF-8 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false"
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: " --batch-mode --errors --fail-at-end --show-version -s .mvn/settings.xml"
before_script:
- export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
cache:
key: "$CI_JOB_NAME"
paths:
- .m2/repository
.java:
stage: build
needs:
- job: java-11
artifacts: false
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
artifacts:
name: artifacts
when: on_failure
paths:
- target/*.jar
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
.java_extended:
extends: .java
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
java-11:
extends: .java
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
needs: [ ]
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP install
artifacts:
name: java-11
when: always
paths:
- target/*.jar
- target/*.zip
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java8:
extends: .java
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8
java-11-openj9:
extends: .java_extended
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11-openj9
java-8-openj9:
extends: .java_extended
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8-openj9
java-15:
extends: .java_extended
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-15
java-16:
extends: .java_extended
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-16
java-17:
extends: .java
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-17
java-18:
extends: .java_extended
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-18
java-19:
extends: .java_extended
image: $CI_REGISTRY_IMAGE/maven:3-eclipse-temurin-19-alpine
deploy:
stage: deploy
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
needs:
- job: java-11
script:
- export PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dclassifier="distribution" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="javadoc" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-java8-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="java8-standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="sources" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
when: manual
create-build-image:
stage: deploy
image: docker:latest
needs: [ ]
services:
- docker:dind
script:
- apk add bash
- bash .mvn/createBuildImages.sh
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- .mvn/createBuildImages.sh
owasp-check:
extends: .java
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
needs: [ ]
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP validate -Powasp-check
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- pom.xml
- owasp-suppressions.xml