Skip to content

Commit 6ced6e2

Browse files
add jenkinsfile (#232)
* add jenkinsfile Co-authored-by: Ville Koskela <[email protected]>
1 parent e7877a1 commit 6ced6e2

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

Jenkinsfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
pipeline {
2+
agent {
3+
kubernetes {
4+
yamlFile 'kubes-pod.yaml'
5+
defaultContainer 'ubuntu'
6+
activeDeadlineSeconds 3600
7+
idleMinutes 15
8+
}
9+
}
10+
stages {
11+
stage('Init') {
12+
steps {
13+
checkout scm
14+
}
15+
}
16+
stage('Setup build') {
17+
when { not { buildingTag() } }
18+
steps {
19+
script {
20+
target = "install"
21+
}
22+
}
23+
}
24+
stage('Setup release') {
25+
when { buildingTag(); not { changeRequest() } }
26+
steps {
27+
script {
28+
target = "install deploy -P release --settings settings.xml"
29+
}
30+
}
31+
}
32+
stage('Build') {
33+
steps {
34+
withCredentials([usernamePassword(credentialsId: 'jenkins-dockerhub', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD'),
35+
usernamePassword(credentialsId: 'jenkins-ossrh', usernameVariable: 'OSSRH_USER', passwordVariable: 'OSSRH_PASS'),
36+
string(credentialsId: 'jenkins-gpg', variable: 'GPG_PASS')]) {
37+
withMaven {
38+
sh "./jdk-wrapper.sh ./mvnw clean $target -P rpm -U -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
39+
}
40+
}
41+
}
42+
}
43+
stage('Analysis') {
44+
steps {
45+
recordIssues(
46+
enabledForFailure: true, aggregatingResults: true,
47+
tools: [java(), checkStyle(reportEncoding: 'UTF-8'), spotBugs()])
48+
}
49+
}
50+
}
51+
}

kubes-pod.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
spec:
2+
containers:
3+
- env:
4+
- name: "DOCKER_TLS_CERTDIR"
5+
value: "/certs"
6+
image: "docker:20.10-dind"
7+
imagePullPolicy: "Always"
8+
name: "dind"
9+
securityContext:
10+
privileged: true
11+
runAsUser: 0
12+
volumeMounts:
13+
- mountPath: "/certs/client"
14+
name: "docker-secrets"
15+
readOnly: false
16+
# - mountPath: "/var/lib/docker"
17+
# name: "docker-cache"
18+
# readOnly: false
19+
- env:
20+
- name: "DOCKER_TLS_VERIFY"
21+
value: "1"
22+
- name: "DOCKER_HOST"
23+
value: "tcp://localhost:2376"
24+
- name: "DOCKER_CERT_PATH"
25+
value: "/certs/client"
26+
- name: "_JAVA_OPTIONS"
27+
value: "-Duser.home=/home/jenkins"
28+
- name: "JDKW_VERBOSE"
29+
value: "1"
30+
- name: "HOME"
31+
value: "/home/jenkins"
32+
image: "docker.arpnetworking.com/build-base"
33+
imagePullPolicy: "Always"
34+
name: "ubuntu"
35+
tty: true
36+
securityContext:
37+
runAsUser: 1000
38+
volumeMounts:
39+
- mountPath: "/cache"
40+
name: "build-cache"
41+
readOnly: false
42+
- mountPath: "/certs/client"
43+
name: "docker-secrets"
44+
readOnly: false
45+
volumes:
46+
- name: "docker-secrets"
47+
emptyDir:
48+
medium: "Memory"
49+
- name: "build-cache"
50+
persistentVolumeClaim:
51+
claimName: "jenkins-build-cache"
52+
readOnly: false
53+
# - name: "docker-cache"
54+
# persistentVolumeClaim:
55+
# claimName: "jenkins-docker-cache"
56+
# readOnly: false

0 commit comments

Comments
 (0)