Skip to content

Commit 245d4b6

Browse files
rakshithakamath94Rakshitha Kamath
authored andcommitted
Merge pull request #80 from rakshithakamath94/job-code_compilation
Update the job code_compilation
2 parents 2df194a + e7f7f87 commit 245d4b6

File tree

8 files changed

+150
-16
lines changed

8 files changed

+150
-16
lines changed

build_scripts/code-compilation/client.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ do
3232
cd /mnt/nfs
3333
if [ $once -eq 0 ]
3434
then
35-
yum -y install bison flex cmake gcc-c++ libacl-devel krb5-devel dbus-devel libnfsidmap-devel libwbclient-devel libcap-devel libblkid-devel rpm-build redhat-rpm-config
35+
if [ "${CENTOS_VERSION}" == "7" ]; then
36+
yum -y install bison flex cmake gcc-c++ libacl-devel krb5-devel dbus-devel libnfsidmap-devel libwbclient-devel libcap-devel libblkid-devel rpm-build redhat-rpm-config userspace-rcu-devel userspace-rcu libnsl2-devel libcephfs-devel
37+
elif [ "${CENTOS_VERSION}" == "8s" ]; then
38+
yum -y install bison flex cmake gcc-c++ libacl-devel krb5-devel dbus-devel libcap-devel libblkid-devel rpm-build redhat-rpm-config glusterfs-api
39+
yum -y --enablerepo=powertools install libnfsidmap-devel libwbclient-devel userspace-rcu-devel userspace-rcu libnsl2-devel libcephfs-devel
40+
else
41+
echo "Check the parameter $CENTOS_VERSION"
42+
fi
3643
git clone --depth=1 https://review.gerrithub.io/ffilz/nfs-ganesha
3744
fi
3845
cd nfs-ganesha

build_scripts/common/basic-gluster.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ systemctl start rpcbind
4141
echo 'TODO: this is BAD, needs a fix in the selinux-policy'
4242
setenforce 0
4343

44-
systemctl stop firewalld
44+
systemctl stop firewalld || true
4545

4646
if [ -n "${YUM_REPO}" ]
4747
then
@@ -69,13 +69,14 @@ else
6969
GIT_URL="https://${GERRIT_HOST}/${GERRIT_PROJECT}"
7070

7171
BASE_PACKAGES="git bison flex cmake gcc-c++ libacl-devel krb5-devel dbus-devel rpm-build redhat-rpm-config"
72+
BUILDREQUIRES_EXTRA="libnsl2-devel libnfsidmap-devel libwbclient-devel libcephfs-devel userspace-rcu-devel"
7273
if [ "${CENTOS_VERSION}" = "7" ]; then
7374
yum -y install libgfapi-devel
7475
yum -y install ${BASE_PACKAGES} libnfsidmap-devel libwbclient-devel libcap-devel libblkid-devel userspace-rcu-devel userspace-rcu
75-
elif [ "${CENTOS_VERSION}" = "8-stream" ]; then
76-
yum -y install libgfapi-devel
77-
yum -y install ${BASE_PACKAGES}
78-
yum -y --enablerepo=powertools install libnfsidmap-devel libwbclient-devel libcap-devel libblkid-devel userspace-rcu-devel
76+
elif [ "${CENTOS_VERSION}" = "8s" ]; then
77+
yum install -y ${BASE_PACKAGES} libacl-devel libblkid-devel libcap-devel redhat-rpm-config rpm-build libgfapi-devel xfsprogs-devel python2-devel
78+
yum install --enablerepo=powertools -y ${BUILDREQUIRES_EXTRA}
79+
yum -y install selinux-policy-devel sqlite
7980
fi
8081

8182
git init "${GIT_REPO}"
@@ -107,7 +108,7 @@ else
107108
ntirpc_version=$(rpm -q --qf '%{VERSION}-%{RELEASE}' -p ${rpm_arch}/libntirpc-devel*.rpm)
108109
ntirpc_rpm=${rpm_arch}/libntirpc-${ntirpc_version}.${rpm_arch}.rpm
109110
fi
110-
yum -y install ${ntirpc_rpm} ${rpm_arch}/nfs-ganesha-{,gluster-}${ganesha_version}.${rpm_arch}.rpm
111+
yum -y install {x86_64,noarch}/*.rpm
111112

112113
# start nfs-ganesha service with an empty configuration
113114
echo "NFSv4 { Graceless = true; }" > /etc/ganesha/ganesha.conf
@@ -122,7 +123,12 @@ else
122123
fi
123124

124125
# create and start gluster volume
125-
yum -y install glusterfs-server
126+
if [ "${CENTOS_VERSION}" = "7" ]; then
127+
yum -y install glusterfs-server
128+
elif [ "${CENTOS_VERSION}" = "8s" ]; then
129+
yum -y install --enablerepo=powertools glusterfs-server
130+
fi
131+
126132
systemctl start glusterd
127133
mkdir -p /bricks/${GLUSTER_VOLUME}
128134
gluster volume create ${GLUSTER_VOLUME} \
@@ -142,7 +148,7 @@ gluster vol status
142148

143149
# TODO: open only the ports needed?
144150
# disable the firewall, otherwise the client can not connect
145-
systemctl stop firewalld || service iptables stop
151+
systemctl stop firewalld || service iptables stop || true
146152

147153
mount -t glusterfs $(hostname --fqdn):/${GLUSTER_VOLUME} /mnt
148154
mount

jobs/nfs-ganesha_code_compilation.yml renamed to jobs/code_compilation.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
node: cico-workspace
44
description: 'Run code compilation for nfs-ganesha against the latest build of Ganesha with FSAL_GLUSTER.'
55
project-type: freestyle
6-
concurrent: false
6+
concurrent: true
77
allow-manual-triggers: true
88

99
scm:
@@ -31,9 +31,11 @@
3131
option: 'code_compilation'
3232

3333
builders:
34+
- shell: !include-raw: scripts/common/get-node.sh
3435
- shell: !include-raw: scripts/common.sh
3536

3637
wrappers:
38+
- gerrithub_key
3739
- cleanup-ws
3840

3941
publishers:

jobs/macros.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@
104104
parameters:
105105
- choice:
106106
choices:
107+
- "8s"
107108
- "7"
108-
- "6"
109109
description: 'CentOS version to run the tests on (server + client)'
110110
name: CENTOS_VERSION
111111
- choice:
@@ -135,4 +135,4 @@
135135
- log-text: Build was aborted
136136
operator: OR
137137
script:
138-
!include-raw: ../build_scripts/common/return-node.sh
138+
!include-raw: scripts/common/return-node.sh
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
SERVER_TEST_SCRIPT=${SERVER_TEST_SCRIPT}
4+
CLIENT_TEST_SCRIPT=${CLIENT_TEST_SCRIPT}
5+
6+
server_env="export GERRIT_HOST='${GERRIT_HOST}'"
7+
server_env+=" GERRIT_PROJECT='${GERRIT_PROJECT}'"
8+
server_env+=" GERRIT_REFSPEC='${GERRIT_REFSPEC}'"
9+
server_env+=" YUM_REPO='${YUM_REPO}'"
10+
11+
if [ $CENTOS_VERSION ]; then
12+
server_env+=" CENTOS_VERSION='${CENTOS_VERSION}'"
13+
fi
14+
15+
if [ "$JOB_NAME" == "nfs_ganesha_iozone_vfs" ] || [ "$JOB_NAME" == "nfs_ganesha_iozone_vfs_minmdcache" ]; then
16+
server_env+=" VFS_VOLUME='${EXPORT}'"
17+
else
18+
server_env+=" GLUSTER_VOLUME='${EXPORT}'"
19+
fi
20+
21+
SERVER_IP=$(cat $WORKSPACE/hosts | sed -n '1p')
22+
CLIENT_IP=$(cat $WORKSPACE/hosts | sed -n '2p')
23+
24+
echo $server_env > $WORKSPACE/SERVER_ENV.txt
25+
26+
SSH_OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
27+
28+
#add the export with environment to ~/.bashrc
29+
scp ${SSH_OPTIONS} "$WORKSPACE/SERVER_ENV.txt" "root@${SERVER_IP}:./SERVER_ENV.txt"
30+
31+
ssh -t ${SSH_OPTIONS} root@${SERVER_IP} "tee -a ~/.bashrc < ./SERVER_ENV.txt"
32+
33+
scp ${SSH_OPTIONS} ${SERVER_TEST_SCRIPT} root@${SERVER_IP}:./$(basename ${SERVER_TEST_SCRIPT})
34+
35+
ssh -t ${SSH_OPTIONS} root@${SERVER_IP} "bash ./$(basename ${SERVER_TEST_SCRIPT})"
36+
RETURN_CODE=$?
37+
38+
if [ $RETURN_CODE == 0 ]; then
39+
client_env="export SERVER='${SERVER_IP}'"
40+
client_env+=" EXPORT='/${EXPORT}'"
41+
client_env+=" CENTOS_VERSION='${CENTOS_VERSION}'"
42+
43+
echo $client_env > $WORKSPACE/CLIENT_ENV.txt
44+
45+
scp ${SSH_OPTIONS} "$WORKSPACE/CLIENT_ENV.txt" "root@${CLIENT_IP}:./CLIENT_ENV.txt"
46+
47+
ssh -t ${SSH_OPTIONS} root@$CLIENT_IP 'tee -a ~/.bashrc < ./CLIENT_ENV.txt'
48+
49+
scp ${SSH_OPTIONS} ${CLIENT_TEST_SCRIPT} root@${CLIENT_IP}:./$(basename ${CLIENT_TEST_SCRIPT})
50+
51+
ssh -t ${SSH_OPTIONS} root@${CLIENT_IP} "bash ./$(basename ${CLIENT_TEST_SCRIPT})"
52+
RETURN_CODE_CLIENT=$?
53+
54+
exit $RETURN_CODE_CLIENT
55+
else
56+
echo "The SERVER script failed!"
57+
exit $RETURN_CODE
58+
fi

jobs/scripts/common.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
export CENTOS_VERSION=7
2-
export CENTOS_ARCH=x86_64
1+
export CENTOS_VERSION=${CENTOS_VERSION}
2+
export CENTOS_ARCH=${CENTOS_ARCH}
33
export GERRIT_HOST=${GERRIT_HOST}
44
export GERRIT_PROJECT=${GERRIT_PROJECT}
55
export GERRIT_REFSPEC=${GERRIT_REFSPEC}
66
export LAST_TRIGGERED_JOB_NAME=$JOB_NAME
77
export BUILD_NUMBER=${BUILD_NUMBER}
88

9-
python $WORKSPACE/ci-tests/build_scripts/common/basic-gluster-duffy.py
10-
RET=$?
9+
if [ "$JOB_NAME" == "nfs_ganesha_dbench" ]; then
10+
bash $WORKSPACE/ci-tests/jobs/scripts/dbench/basic-gluster-duffy.sh
11+
RET=$?
12+
elif [ "$JOB_NAME" == "nfs_ganesha_code_compilation" ]; then
13+
bash $WORKSPACE/ci-tests/jobs/scripts/code_compilation/basic-gluster-duffy.sh
14+
RET=$?
15+
fi
1116

1217
JOB_OUTPUT="${JENKINS_URL}/job/${LAST_TRIGGERED_JOB_NAME}/${BUILD_NUMBER}/console"
1318

jobs/scripts/common/get-node.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
set +x
4+
5+
mkdir -p ~/.config
6+
7+
cat > ~/.config/duffy <<EOF
8+
client:
9+
url: https://duffy.ci.centos.org/api/v1
10+
auth:
11+
name: nfs-ganesha
12+
key: ${CICO_API_KEY}
13+
EOF
14+
15+
readarray -t POOLS < <(duffy client list-pools | jq -r '.pools[].name')
16+
17+
LIST_POOLS=()
18+
for i in "${POOLS[@]}"
19+
do
20+
if [[ $i =~ ${CENTOS_VERSION}(s)*-x86_64 ]]; then
21+
LIST_POOLS+=($i)
22+
fi
23+
done
24+
25+
if [ "$JOB_NAME" == "nfs-ganesha_trigger-fsal_cephfs" ] || [ "$JOB_NAME" == "nfs-ganesha_trigger-fsal_gluster" ] || [ "$JOB_NAME" == "nfs-ganesha_trigger-fsal_rgw" ]; then
26+
node_count=1
27+
else
28+
node_count=2
29+
fi
30+
31+
32+
for my_pool in ${LIST_POOLS[@]};
33+
do
34+
if [[ $(duffy client show-pool $my_pool | jq -r '.pool.levels.ready') -gt 1 ]]; then
35+
SESSION=$(duffy client request-session pool="${my_pool}",quantity=$node_count)
36+
echo "${SESSION}" | jq -r '.session.nodes[].ipaddr' > "${WORKSPACE}"/hosts
37+
echo "${SESSION}" | jq -r '.session.id' > "${WORKSPACE}"/session_id
38+
break
39+
fi
40+
41+
sleep 60
42+
echo -n "."
43+
done
44+
45+
if [ -z "${SESSION}" ]; then
46+
echo "Failed to reserve node"
47+
exit 1
48+
fi

jobs/scripts/common/return-node.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# A script that releases nodes from session ids
3+
4+
set +x
5+
6+
SESSION_ID=$(cat "${WORKSPACE}"/session_id)
7+
8+
duffy client retire-session "${SESSION_ID}" > /dev/null

0 commit comments

Comments
 (0)