Skip to content

Commit 0ed47a2

Browse files
Merge pull request #105 from Manimaran-MM/mani-vfs-fix
[Job Fix]: Run FSAL_VFS tests instead of FSAL_GLUSTER
2 parents 96d550b + a488fef commit 0ed47a2

File tree

3 files changed

+116
-64
lines changed

3 files changed

+116
-64
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
# these variables need to be set
6+
[ -n "${GERRIT_HOST}" ]
7+
[ -n "${GERRIT_PROJECT}" ]
8+
[ -n "${GERRIT_REFSPEC}" ]
9+
10+
# only use https for now
11+
GIT_REPO="https://${GERRIT_HOST}/${GERRIT_PROJECT}"
12+
13+
# enable the Storage SIG Gluster and Ceph repositories
14+
dnf -y install centos-release-gluster yum-utils centos-release-ceph epel-release
15+
16+
BUILDREQUIRES="git bison flex cmake gcc-c++ libacl-devel krb5-devel dbus-devel rpm-build redhat-rpm-config libblkid-devel libcap-devel libgfapi-devel xfsprogs-devel"
17+
BUILDREQUIRES_EXTRA="libnsl2-devel libnfsidmap-devel libwbclient-devel libcephfs-devel userspace-rcu-devel"
18+
19+
# basic packages to install
20+
case "${CENTOS_VERSION}" in
21+
9s)
22+
dnf install -y ${BUILDREQUIRES}
23+
dnf install --enablerepo=crb -y ${BUILDREQUIRES_EXTRA}
24+
;;
25+
esac
26+
27+
git init $(basename "${GERRIT_PROJECT}")
28+
cd $(basename "${GERRIT_PROJECT}")
29+
git remote add origin ${GIT_REPO}
30+
git fetch --depth=1 origin ${GERRIT_REFSPEC}
31+
git checkout FETCH_HEAD
32+
33+
# update libntirpc
34+
git submodule update --recursive --init || git submodule sync --recursive
35+
36+
# cleanup old build dir
37+
[ -d build ] && rm -rf build
38+
39+
mkdir build
40+
cd build
41+
42+
( cmake ../src -DCMAKE_BUILD_TYPE=Maintainer -DUSE_FSAL_VFS=ON -DUSE_FSAL_GLUSTER=OFF -DUSE_FSAL_CEPH=OFF -DUSE_FSAL_RGW=OFF -DUSE_FSAL_GPFS=OFF -DUSE_MONITORING=ON && make) || touch FAILED
43+
44+
# we accept different return values
45+
# 0 - SUCCESS
46+
# 1 - FAILED
47+
48+
if [ -e FAILED ]; then
49+
exit 1
50+
else
51+
exit 0
52+
fi
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
pipeline {{
2+
agent {{ label 'cico-workspace' }}
3+
4+
stages {{
5+
stage('Trigger FSAL Jobs in Parallel') {{
6+
steps {{
7+
script {{
8+
def gerritParams = [
9+
'GERRIT_PATCHSET_REVISION', 'GERRIT_REFSPEC', 'GERRIT_PROJECT', 'GERRIT_HOST'
10+
]
11+
12+
def sharedParams = gerritParams.collect {{ paramName ->
13+
string(name: paramName, value: env.getProperty(paramName) ?: '')
14+
}}
15+
16+
def jobList = ['fsal-cephfs', 'fsal-vfs', 'fsal-gpfs', 'fsal-rgw']
17+
def results = [:]
18+
def messages = ["**FSAL Job Results:**\\n"]
19+
20+
parallel jobList.collectEntries {{ job ->
21+
[(job): {{
22+
def build = build job: job, parameters: sharedParams, propagate: false, wait: true
23+
results[job] = build
24+
25+
def msg = ''
26+
try {{
27+
def jobUrl = build.absoluteUrl
28+
def artifactUrl = "${{jobUrl}}artifact/result_message.txt"
29+
sh "curl -s -o tmp_result_message_${{job}}.txt '${{artifactUrl}}'"
30+
msg = readFile("tmp_result_message_${{job}}.txt").trim()
31+
}} catch (Exception e) {{
32+
msg = "**🔴 ${{job}}: ERROR fetching result_message.txt**"
33+
}}
34+
35+
messages << msg
36+
}}]
37+
}}
38+
39+
def finalMessage = messages.join("\\n")
40+
writeFile file: 'gerrit_message.txt', text: finalMessage
41+
42+
def notifyFlag = '--notify NONE'
43+
if (finalMessage.contains('FAILED')) {{
44+
notifyFlag = '--notify ALL'
45+
}}
46+
47+
withCredentials([file(credentialsId: 'GERRITHUB_PRIVATE_KEY', variable: 'GERRITHUB_KEY_FILE')]) {{
48+
sh """
49+
ssh -i $GERRITHUB_KEY_FILE -l jenkins-glusterorg -o StrictHostKeyChecking=no -p 29418 $GERRIT_HOST \\
50+
gerrit review \\
51+
$notifyFlag \\
52+
--message "'$(cat gerrit_message.txt)'" \\
53+
--project $GERRIT_PROJECT \\
54+
$GERRIT_PATCHSET_REVISION
55+
"""
56+
}}
57+
}}
58+
}}
59+
}}
60+
}}
61+
}}

jobs/trigger-fsal-on-new-patch.yml

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
- pipeline:
1+
- job:
22
name: trigger-fsal-on-new-patch
33
node: cico-workspace
44
description: >-
5-
Run fsal-cephfs, fsal-gluster, fsal-gpfs, fsal-rgw on nfs-ganesha. This job is triggered by
5+
Run fsal-cephfs, fsal-vfs, fsal-gpfs, fsal-rgw on nfs-ganesha. This job is triggered by
66
sending a change to
77
https://review.gerrithub.io/#/q/project:ffilz/nfs-ganesha for review.
88
@@ -38,65 +38,4 @@
3838
branches:
3939
- branch-pattern: "**"
4040
branch-compare-type: ANT
41-
dsl: |
42-
pipeline {
43-
agent { label 'cico-workspace' }
44-
45-
stages {
46-
stage('Trigger FSAL Jobs in Parallel') {
47-
steps {
48-
script {
49-
def gerritParams = [
50-
'GERRIT_PATCHSET_REVISION', 'GERRIT_REFSPEC', 'GERRIT_PROJECT','GERRIT_HOST'
51-
]
52-
53-
def sharedParams = gerritParams.collect { paramName ->
54-
string(name: paramName, value: env.getProperty(paramName) ?: '')
55-
}
56-
57-
def jobList = ['fsal-cephfs', 'fsal-gluster', 'fsal-gpfs', 'fsal-rgw']
58-
def results = [:]
59-
def messages = ["**FSAL Job Results:**\\n"]
60-
61-
parallel jobList.collectEntries { job ->
62-
[(job): {
63-
def build = build job: job, parameters: sharedParams, propagate: false, wait: true
64-
results[job] = build
65-
66-
def msg = ''
67-
try {
68-
def jobUrl = build.absoluteUrl
69-
def artifactUrl = "\${jobUrl}artifact/result_message.txt"
70-
sh "curl -s -o tmp_result_message_\${job}.txt '\${artifactUrl}'"
71-
msg = readFile("tmp_result_message_\${job}.txt").trim()
72-
} catch (Exception e) {
73-
msg = "**🔴 \${job}: ERROR fetching result_message.txt**"
74-
}
75-
76-
messages << msg
77-
}]
78-
}
79-
80-
def finalMessage = messages.join("\\n")
81-
writeFile file: 'gerrit_message.txt', text: finalMessage
82-
83-
def notifyFlag = '--notify NONE' // default
84-
if (finalMessage.contains('FAILED')) {
85-
notifyFlag = '--notify ALL'
86-
}
87-
88-
withCredentials([file(credentialsId: 'GERRITHUB_PRIVATE_KEY', variable: 'GERRITHUB_KEY_FILE')]) {
89-
sh """
90-
ssh -i \$GERRITHUB_KEY_FILE -l jenkins-glusterorg -o StrictHostKeyChecking=no -p 29418 \$GERRIT_HOST \\
91-
gerrit review \\
92-
$notifyFlag \\
93-
--message "'$(cat gerrit_message.txt)'" \\
94-
--project $GERRIT_PROJECT \\
95-
$GERRIT_PATCHSET_REVISION
96-
'''
97-
}
98-
}
99-
}
100-
}
101-
}
102-
}
41+
dsl: !include-raw: scripts/trigger-fsal-on-new-patch.groovy

0 commit comments

Comments
 (0)