Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit 4f948c4

Browse files
authored
CORTX-29985: DTM integration test (#2062)
This script will compile the code with dtm-enable flag and then run dtm integration test. Signed-off-by: Rinku Kothiya <[email protected]>
1 parent 6c5d6e4 commit 4f948c4

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env groovy
2+
pipeline {
3+
agent {
4+
node {
5+
label 'dtm-integration'
6+
}
7+
}
8+
9+
parameters {
10+
string(name: 'MOTR_BRANCH', defaultValue: 'main', description: 'Motr branch name', trim: true)
11+
string(name: 'HARE_BRANCH', defaultValue: 'main', description: 'Hare branch name', trim: true)
12+
string(name: 'MOTR_REPO', defaultValue: 'https://github.com/Seagate/cortx-motr', description: 'Motr Repository URL', trim: true)
13+
string(name: 'HARE_REPO', defaultValue: 'https://github.com/Seagate/cortx-hare', description: 'Hare Repository URL', trim: true)
14+
}
15+
16+
options {
17+
timeout(time: 40, unit: 'MINUTES')
18+
timestamps()
19+
ansiColor('xterm')
20+
buildDiscarder(logRotator(numToKeepStr: "30"))
21+
}
22+
23+
environment {
24+
release_tag = "last_successful_prod"
25+
REPO_NAME = 'cortx-motr'
26+
GITHUB_TOKEN = credentials('cortx-admin-github') // To clone cortx-motr repo
27+
GPR_REPO = "https://github.com/${ghprbGhRepository}"
28+
MOTR_REPO = "${ghprbGhRepository != null ? GPR_REPO : MOTR_REPO}"
29+
MOTR_BRANCH = "${sha1 != null ? sha1 : MOTR_BRANCH}"
30+
MOTR_GPR_REFSPEC = "+refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*"
31+
MOTR_BRANCH_REFSPEC = "+refs/heads/*:refs/remotes/origin/*"
32+
MOTR_PR_REFSPEC = "${ghprbPullId != null ? MOTR_GPR_REFSPEC : MOTR_BRANCH_REFSPEC}"
33+
repoURL = "${MOTR_REPO}".replace("github.com", "$GITHUB_TOKEN@github.com")
34+
}
35+
36+
stages {
37+
stage ('Cleanup VM') {
38+
steps {
39+
script {
40+
sh label: 'Clean up VM before use', script: '''
41+
hostname
42+
pwd
43+
cd "$WORKSPACE"
44+
./scripts/install/usr/libexec/cortx-motr/motr-cleanup || true
45+
losetup -D
46+
make uninstall || true
47+
cd "$WORKSPACE/../cortx-hare" || true
48+
make uninstall || true
49+
cd "$WORKSPACE/.."
50+
rm -rf cortx-hare cortx-motr
51+
yum remove cortx-hare cortx-motr{,-devel} cortx-py-utils consul -y
52+
rm -rf /var/crash/* /var/log/seagate/* /var/log/hare/* /var/log/motr/* /var/lib/hare/* /var/motr/* /etc/motr/*
53+
rm -rf /root/.cache/dhall* /root/rpmbuild
54+
rm -rf /etc/yum.repos.d/motr_last_successful.repo /etc/yum.repos.d/motr_uploads.repo /etc/yum.repos.d/lustre_release.repo
55+
'''
56+
}
57+
}
58+
}
59+
60+
stage ('Compile motr and hare') {
61+
steps {
62+
script { build_stage = env.STAGE_NAME }
63+
sh label: 'Clean up and build motr and run ut for code coverage', script: '''
64+
hostname
65+
pkill -9 m0d || true
66+
pkill -9 mkfs || true
67+
pkill -9 m0 || true
68+
hctl shutdown || true
69+
rm -rf "$WORKSPACE"/cortx-motr "$WORKSPACE"/cortx-hare "$WORKSPACE"/cortx-utils /var/motr/*
70+
cd "$WORKSPACE"
71+
git clone --recursive ${MOTR_REPO} cortx-motr && cd cortx-motr && git checkout ${MOTR_BRANCH}
72+
cd "$WORKSPACE"/cortx-motr
73+
sudo ./scripts/install-build-deps
74+
./autogen.sh
75+
./configure --enable-dtm0 --enable-debug
76+
make -j6
77+
scripts/install-motr-service --link
78+
cd "$WORKSPACE"/
79+
git clone --recursive -b ${HARE_BRANCH} ${HARE_REPO}
80+
yum -y install python3 python3-devel yum-utils
81+
yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
82+
yum -y install consul-1.9.1
83+
#yum install -y gcc rpm-build python36 python36-pip python36-devel python36-setuptools openssl-devel libffi-devel python36-dbus # for centos7.9
84+
yum install -y gcc rpm-build python38 python38-pip python38-devel python38-setuptools openssl-devel libffi-devel python3-dbus
85+
cd "$WORKSPACE"/
86+
git clone --recursive https://github.com/Seagate/cortx-utils -b main
87+
cd "$WORKSPACE"/cortx-utils
88+
./jenkins/build.sh -v 2.0.0 -b 2
89+
# yum install -y gcc python36 python36-pip python36-devel python36-setuptools openssl-devel libffi-devel python36-dbus # for centos7.9
90+
yum install -y gcc python38 python38-pip python38-devel python38-setuptools openssl-devel libffi-devel python3-dbus
91+
sudo pip3 install -r https://raw.githubusercontent.com/Seagate/cortx-utils/main/py-utils/python_requirements.txt
92+
sudo pip3 install -r https://raw.githubusercontent.com/Seagate/cortx-utils/main/py-utils/python_requirements.ext.txt
93+
cd "$WORKSPACE"/cortx-utils/py-utils/dist
94+
yum localinstall -y cortx-py-utils-*.noarch.rpm
95+
cd "$WORKSPACE"/cortx-hare
96+
make uninstall && make clean && make distclean
97+
make -j6 && make devinstall
98+
'''
99+
}
100+
}
101+
stage ('execute dtm integration test') {
102+
steps {
103+
sh '''
104+
HOST=$(hostname)
105+
sed -i "s/localhost/$HOST/g" "$WORKSPACE"/cortx-motr/dtm0/it/all2all/cdf.yaml
106+
cd "$WORKSPACE"/cortx-motr/dtm0/it/all2all ; ./all2all rec
107+
cd "$WORKSPACE"/cortx-motr ; sudo ./utils/m0run -- m0ut -t dtm0-ut -n 2
108+
'''
109+
}
110+
111+
post {
112+
success {
113+
script {
114+
sh label: 'Clean up workspace', script: '''
115+
pkill -9 m0d || true
116+
pkill -9 mkfs || true
117+
pkill -9 m0 || true
118+
hctl shutdown || true
119+
cd "$WORKSPACE"/cortx-hare ; make uninstall && make clean && make distclean
120+
cd "$WORKSPACE"/cortx-motr ; make uninstall && make clean && make distclean
121+
rm -rf "$WORKSPACE"/cortx-motr
122+
rm -rf "$WORKSPACE"/cortx-hare
123+
rm -rf "$WORKSPACE"/cortx-utils
124+
'''
125+
cleanWs()
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}

0 commit comments

Comments
 (0)