-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile_integration_tests
More file actions
146 lines (139 loc) · 7.01 KB
/
Jenkinsfile_integration_tests
File metadata and controls
146 lines (139 loc) · 7.01 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
* (C) Copyright IBM Deutschland GmbH 2021, 2025
* (C) Copyright IBM Corp. 2021, 2025
*
* non-exclusively licensed to gematik GmbH
*/
pipeline {
agent {
node {
label 'dockerstage'
}
}
options {
disableConcurrentBuilds()
skipDefaultCheckout()
}
stages {
stage('CleanWs') {
steps {
cleanWs()
}
}
stage('Run integration tests') {
options {
throttle(['unit-test-category'])
}
agent {
docker {
label 'dockerstage'
image 'de.icr.io/erp_dev/erp-pc-ubuntu-build:2.3.1'
registryUrl 'https://de.icr.io/v2'
registryCredentialsId 'icr_image_puller_erp_dev_api_key'
reuseNode true
args '-u root:sudo -v $HOME/tools:$HOME/tools'
}
}
steps {
copyArtifacts(
projectName: "/eRp/eRp/erp-processing-context/${env.BRANCH_NAME_COPY_ARTIFACTS}",
selector: specific("${env.BRANCH_NAME_COPY_ARTIFACTS_BUILD_NUMBER}"),
filter: 'erp-tests.tar.gz',
flatten: true,
optional: false,
fingerprintArtifacts: true,
)
script {
sh """
sleep 120
for ATTEMPT in `seq 1 20`; do
echo "Detecting processing context availability (attempt \$ATTEMPT)"
if curl --fail --silent --output /dev/null https://\$ERP_SERVER_HOSTNAME/VAUCertificate; then
break
fi
sleep 10
done
"""
}
script {
withCredentials([usernamePassword(credentialsId: 'erp-build-bot', usernameVariable: 'NEXUS_USERNAME', passwordVariable: 'NEXUS_PASSWORD')]) {
def buildNumber = Jenkins.instance.getItemByFullName('eRp/eRp/erp-processing-context').getItem("${env.BRANCH_NAME}").lastSuccessfulBuild.displayName.split('v-')[1]
echo buildNumber
echo "running integration tests against ${env.ERP_SERVER_HOSTNAME}:${env.ERP_SERVER_PORT}"
sh """
tar xf erp-tests.tar.gz
rm erp-tests.tar.gz
#
# Download installation artifact from previous stage ...
#
mkdir erp-processing-context
wget --no-verbose --user="${env.NEXUS_USERNAME}" --password="${env.NEXUS_PASSWORD}" "https://nexus.epa-dev.net/repository/erp-raw-releases/com/ibm/erp/erp-processing-context/${buildNumber}/erp-processing-context-${buildNumber}.tar.gz"
tar xf "erp-processing-context-${buildNumber}.tar.gz" -C ./erp-processing-context
rm "erp-processing-context-${buildNumber}.tar.gz"
#
# and copy the shared objects into this environment:
#
mkdir -p build/RelWithDebInfo/lib
mv erp-processing-context/erp/lib/* build/RelWithDebInfo/lib
rm -rf erp-processing-context
#
#
export TEST_BASE=`pwd`
export TEST_RESOURCE_MANAGER_PATH=\${TEST_BASE}"/resources"
# copy generated_pki:
cp -R build/RelWithDebInfo/resources/* \${TEST_RESOURCE_MANAGER_PATH}/
cd build/RelWithDebInfo/bin
#
# The references resources have different base paths due to mixing of different build artifacts. Fixt it:
#
sed -i "s|${ERP_BUILD_ROOT}|\${TEST_BASE}|g" ./001_fhir-resource-groups.config.json
sed -i "s|${ERP_BUILD_ROOT}|\${TEST_BASE}|g" ./01_production.config.json
sed -i "s|${ERP_BUILD_ROOT}|\${TEST_BASE}|g" ./02_development.config.json
#
# Execute tests
#
LD_LIBRARY_PATH=../lib ERP_SERVER_HOST="\${ERP_SERVER_HOSTNAME}" ERP_SERVER_PORT="\${ERP_SERVER_PORT}" ERP_IDP_REGISTERED_FD_URI="\${ERP_IDP_REGISTERED_FD_URI}" TEST_QES_PEM_FILE_NAME="\${TEST_QES_PEM_FILE_NAME}" TEST_RESOURCE_MANAGER_PATH="\${TEST_RESOURCE_MANAGER_PATH}" ERP_ADMIN_RC_CREDENTIALS=cred ./erp-integration-test --gtest_output=xml:mvo-test-report.xml --gtest_filter=MVO_*
LD_LIBRARY_PATH=../lib ERP_SERVER_HOST="\${ERP_SERVER_HOSTNAME}" ERP_SERVER_PORT="\${ERP_SERVER_PORT}" ERP_IDP_REGISTERED_FD_URI="\${ERP_IDP_REGISTERED_FD_URI}" TEST_QES_PEM_FILE_NAME="\${TEST_QES_PEM_FILE_NAME}" TEST_RESOURCE_MANAGER_PATH="\${TEST_RESOURCE_MANAGER_PATH}" ERP_ADMIN_RC_CREDENTIALS=cred ./erp-integration-test --gtest_output=xml:erp-integration-test.xml --gtest_filter=-MVO_*
"""
}
}
}
post {
cleanup {
cleanWs()
}
always {
sh """
xsltproc scripts/test_report.xslt build/RelWithDebInfo/bin/mvo-test-report.xml > mvo-test-report.html
"""
archiveArtifacts artifacts: 'build/RelWithDebInfo/bin/mvo-test-report.xml, mvo-test-report.html', allowEmptyArchive: true, fingerprint: true, onlyIfSuccessful: false
junit 'build/RelWithDebInfo/bin/*.xml'
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: false,
reportDir: 'build/RelWithDebInfo/bin',
reportFiles: 'mvo-test-report.html',
reportName: 'MVO Test Report',
reportTitles: ''
])
}
failure {
script {
slackSendClient(
message: "${env.JOB_NAME} (<${env.BUILD_URL}/console|${currentBuild.displayName}>) failed",
channel: '#erp-cpp', color: 'danger'
)
}
}
fixed {
script {
slackSendClient(
message: "${env.JOB_NAME} is now successful again :green_heart:",
channel: '#erp-cpp')
}
}
}
}
}
}