-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
115 lines (89 loc) · 2.77 KB
/
Jenkinsfile
File metadata and controls
115 lines (89 loc) · 2.77 KB
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
pipeline {
agent any
environment {
imagename = 'avatar/ma'
dockerImage = ''
JAVA_OPTS = "-Xms4096m -Xmx4096m -XX:MaxMetaspaceSize=1024m ${sh(script:'echo $JAVA_OPTS', returnStdout: true).trim()}"
}
tools {
jdk 'OpenJDK17'
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
stages {
stage('clean workspace and checkout') {
steps {
cleanWs()
checkout scm
}
}
stage('Build') {
steps {
echo "I am building app on branch: ${env.GIT_BRANCH}"
sh "./gradlew clean build -x testOSGi --info --stacktrace -Dmaven.repo.local=${WORKSPACE}/.m2"
}
}
stage('Snapshot Integration Tests') {
when {
branch 'develop'
}
steps {
echo "I am running integration tests on branch: ${env.GIT_BRANCH}"
script {
sh "./gradlew testOSGi --info --stacktrace -Dmaven.repo.local=${WORKSPACE}/.m2"
junit '**/generated/test-reports/**/*.xml'
}
}
}
stage('Snapshot branch release') {
when {
branch 'develop'
}
steps {
echo "I am building on ${env.JOB_NAME}"
sh "./gradlew release --info --stacktrace -Dmaven.repo.local=${WORKSPACE}/.m2"
sh "mkdir -p $JENKINS_HOME/repo.gecko/snapshot/DataInMotion/MA"
sh "rm -rf $JENKINS_HOME/repo.gecko/snapshot/DataInMotion/MA/*"
sh "cp -r cnf/release/* $JENKINS_HOME/repo.gecko/snapshot/DataInMotion/MA"
}
}
stage('Resolve Application'){
steps {
echo "I am exporting applications on branch: ${env.GIT_BRANCH}"
sh "./gradlew de.avatar.ma.runtime:resolve.modelatlas.runtime_base --info --stacktrace -Dmaven.repo.local=${WORKSPACE}/.m2"
}
}
stage('Export Application'){
steps {
echo "I am exporting applications on branch: ${env.GIT_BRANCH}"
sh "./gradlew de.avatar.ma.runtime:export.modelatlas.runtime_docker --info --stacktrace -Dmaven.repo.local=${WORKSPACE}/.m2"
}
}
stage('Prepare Docker'){
/* when {
branch 'main'
}
*/
steps {
echo "I am building and publishing a docker image on branch: ${env.GIT_BRANCH}"
sh "./gradlew prepareDocker --info --stacktrace -Dmaven.repo.local=${WORKSPACE}/.m2"
}
}
stage('Docker image build'){
/* when {
branch 'main'
}
*/
steps {
echo "I am building and publishing a docker image on branch: ${env.GIT_BRANCH}"
step([$class: 'DockerBuilderPublisher',
dockerFileDirectory: 'docker',
cloud: 'docker',
tagsString: 'devel.data-in-motion.biz:6000/avatar/ma:latest',
pushOnSuccess: true,
pushCredentialsId: 'dim-nexus'])
}
}
}
}