Skip to content

Commit 2487099

Browse files
author
Serhat Bolsu
committed
Merge pull request #3 in TECHQA/api_sit_test_framework_javascript from feature/jenkins_config to master
* commit '75b2930deed814840d99e609560178848d189826': config added
2 parents b806ea8 + 75b2930 commit 2487099

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

Jenkinsfile

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env groovy
2+
3+
4+
// properties([
5+
// parameters([
6+
// string(defaultValue: "http://xxx" ,
7+
// description: 'Application main url', name: 'BASE_URL'),
8+
// ])
9+
// ])
10+
11+
12+
def podDefinition = """
13+
apiVersion: v1
14+
kind: Pod
15+
spec:
16+
containers:
17+
- name: oraclelinux
18+
image: 'oraclelinux:7-slim'
19+
tty: true
20+
command:
21+
- 'cat'
22+
env:
23+
- name: "GIT_SSL_NO_VERIFY"
24+
value: "true"
25+
resources:
26+
limits:
27+
memory: "1000Mi"
28+
cpu: "1000m"
29+
requests:
30+
memory: "500Mi"
31+
cpu: "500m"
32+
nodeSelector:
33+
env: "dev"
34+
restartPolicy: "Never"
35+
securityContext: {}
36+
"""
37+
38+
39+
podTemplate(yaml: podDefinition) {
40+
node(POD_LABEL) {
41+
timestamps {
42+
ansiColor('xterm') {
43+
try {
44+
stage('GIT checkout') {
45+
container('oraclelinux') {
46+
checkout scm
47+
}
48+
}
49+
50+
stage('Install Dependencies') {
51+
container('oraclelinux') {
52+
print "### Installing Dependencies ###"
53+
sh 'node -v'
54+
sh 'npm -v'
55+
sh 'npm install -g allure-commandline'
56+
// sh 'npm install -D wiremock-standalone'
57+
sh 'npm install'
58+
}
59+
}
60+
61+
// ** Un-comment if you need oracleClient
62+
/* stage('Install OracleClient') {
63+
container('oraclelinux') {
64+
print "### Installing OracleClient ###"
65+
66+
// download and install python
67+
sh '''
68+
cat /etc/os-release
69+
yum -y install oracle-nodejs-release-el7 oracle-release-el7
70+
yum-config-manager --enable ol7_oracle_instantclient
71+
yum -y install oracle-instantclient19.6-basic oracle-instantclient19.6-devel oracle-instantclient19.6-sqlplus
72+
sqlplus -v
73+
74+
yum -y install python3 pkgconfig make gcc curl sudo git libaio wget unzip pixman gcc-c++ nodejs binutils libtool autoconf automake
75+
yum -y groupinstall 'Development Tools'
76+
python3 --version
77+
'''
78+
79+
80+
// download and place oracle client
81+
sh '''
82+
# download and place oracle client
83+
curl https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip --silent --output instantclient-basic-linux.x64-19.6.0.0.0dbru.zip
84+
unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip
85+
rm instantclient-basic-linux.x64-19.6.0.0.0dbru.zip
86+
ls
87+
mkdir -p /opt/oracle
88+
mv instantclient_19_6 /opt/oracle
89+
chmod -R 755 /opt/oracle
90+
91+
echo $LD_LIBRARY_PATH
92+
export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_6
93+
echo $LD_LIBRARY_PATH
94+
95+
npm i oracledb
96+
'''
97+
}
98+
} */
99+
100+
stage('API Tests') {
101+
container('oraclelinux') {
102+
print "### Triggering API tests ###"
103+
sh """
104+
export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_6
105+
npm run test
106+
"""
107+
}
108+
}
109+
110+
} catch (err) {
111+
echo "FAILURE - please check the log"
112+
throw err
113+
} finally {
114+
stage('Allure report') {
115+
steps {
116+
script {
117+
allure([
118+
includeProperties: false,
119+
jdk: '',
120+
properties: [],
121+
reportBuildPolicy: 'ALWAYS',
122+
results: [[path: 'allure-results']]
123+
])
124+
}
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}

0 commit comments

Comments
 (0)