forked from nordic-institute/X-Road
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
89 lines (89 loc) · 3.49 KB
/
Jenkinsfile
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
pipeline {
agent any
stages {
stage('Output build parameters') {
steps {
sh 'env'
}
}
stage('Clean and clone repository') {
steps {
checkout([
$class : 'GitSCM',
branches : [[name: ghprbSourceBranch]],
doGenerateSubmoduleConfigurations: false,
extensions : [[$class: 'CleanBeforeCheckout']],
gitTool : 'Default',
submoduleCfg : [],
userRemoteConfigs : [
[
url: 'https://github.com/nordic-institute/X-Road.git',
refspec: '+refs/heads/*:refs/remotes/origin/* +refs/pull/*/head:refs/remotes/origin/pull/*'
]
]
])
}
}
stage('Compile Code') {
agent {
dockerfile {
dir 'src/packages/docker-compile'
additionalBuildArgs '--build-arg uid=$(id -u) --build-arg gid=$(id -g)'
reuseNode true
}
}
environment {
GRADLE_OPTS = '-Dorg.gradle.daemon=false -Dsonar.host.url=https://sonarqube.niis.org'
JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64/'
}
steps {
sh 'cd src && ./update_ruby_dependencies.sh'
withCredentials([string(credentialsId: 'sonarqube-user-token-2', variable: 'SONAR_TOKEN')]) {
sh 'cd src && ~/.rvm/bin/rvm jruby-$(cat .jruby-version) do ./gradlew -Dsonar.login=${SONAR_TOKEN} -Dsonar.pullrequest.key=${ghprbPullId} -Dsonar.pullrequest.branch=${ghprbSourceBranch} -Dsonar.pullrequest.base=${ghprbTargetBranch} --stacktrace --no-daemon buildAll runProxyTest runMetaserviceTest runProxymonitorMetaserviceTest jacocoTestReport dependencyCheckAggregate sonarqube'
}
}
}
stage('Ubuntu bionic packaging') {
agent {
dockerfile {
dir 'src/packages/docker/deb-bionic'
args '-v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -e HOME=/tmp'
reuseNode true
}
}
steps {
script {
sh './src/packages/build-deb.sh bionic'
}
}
}
stage('RHEL 7 packaging') {
agent {
dockerfile {
dir 'src/packages/docker/rpm'
args '-v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -e HOME=/workspace/src/packages'
reuseNode true
}
}
steps {
script {
sh './src/packages/build-rpm.sh'
}
}
}
stage('RHEL 8 packaging') {
agent {
dockerfile {
dir 'src/packages/docker/rpm-el8'
args '-e HOME=/workspace/src/packages'
reuseNode true
}
}
steps {
script {
sh './src/packages/build-rpm.sh'
}
}
}
}
}