Skip to content

Commit 96d550b

Browse files
Merge pull request #102 from Manimaran-MM/mani-fsal-fix
[FSAL] Consildate FSAL messages
2 parents 7150282 + 7d3a04d commit 96d550b

File tree

7 files changed

+125
-38
lines changed

7 files changed

+125
-38
lines changed

build_scripts/build-fsal/build-fsal_cephfs.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ case "${CENTOS_VERSION}" in
3535
;;
3636
esac
3737

38-
git clone --depth=1 ${GIT_REPO}
38+
git init $(basename "${GERRIT_PROJECT}")
3939
cd $(basename "${GERRIT_PROJECT}")
40-
git fetch origin ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
40+
git remote add origin ${GIT_REPO}
41+
git fetch --depth=1 origin ${GERRIT_REFSPEC}
42+
git checkout FETCH_HEAD
4143

4244
# update libntirpc
4345
git submodule update --recursive --init || git submodule sync --recursive

build_scripts/build-fsal/build-fsal_gluster.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# ==========================================================================
3+
# DEPRECATED: This script is no longer supported. This will be removed soon.
4+
# ==========================================================================
25

36
set -e
47

build_scripts/build-fsal/build-fsal_gpfs.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ case "${CENTOS_VERSION}" in
3232
;;
3333
esac
3434

35-
git clone --depth=1 ${GIT_REPO}
35+
git init $(basename "${GERRIT_PROJECT}")
3636
cd $(basename "${GERRIT_PROJECT}")
37-
git fetch origin ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
37+
git remote add origin ${GIT_REPO}
38+
git fetch --depth=1 origin ${GERRIT_REFSPEC}
39+
git checkout FETCH_HEAD
3840

3941
# update libntirpc
4042
git submodule update --recursive --init || git submodule sync --recursive

build_scripts/build-fsal/build-fsal_rgw.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ case "${CENTOS_VERSION}" in
3838
;;
3939
esac
4040

41-
git clone --depth=1 ${GIT_REPO}
41+
git init $(basename "${GERRIT_PROJECT}")
4242
cd $(basename "${GERRIT_PROJECT}")
43-
git fetch origin ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
43+
git remote add origin ${GIT_REPO}
44+
git fetch --depth=1 origin ${GERRIT_REFSPEC}
45+
git checkout FETCH_HEAD
4446

4547
# update libntirpc
4648
git submodule update --recursive --init || git submodule sync --recursive

jobs/fsal_template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# DEPRECATED: This workflow is no longer used or maintained.
2+
# Please use jobs/trigger-fsal-on-new-patch.yml instead.
13
- project:
24
name: 'fsal'
35
product:

jobs/scripts/fsal-build.sh

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,29 @@ RET=$?
1616

1717
case ${RET} in
1818
0)
19-
MESSAGE="${BUILD_URL}/console : SUCCESS"
20-
VERIFIED='--verified +1'
21-
NOTIFY='--notify NONE'
19+
MESSAGE="**🟢 $JOB_NAME:** \`SUCCESS\` - ${BUILD_URL}/console"
2220
EXIT=0
2321
;;
2422
1)
25-
MESSAGE="${BUILD_URL}/console : FAILED"
26-
VERIFIED='--verified -1'
27-
NOTIFY='--notify ALL'
23+
MESSAGE="**🔴 $JOB_NAME:** \`FAILED\` - ${BUILD_URL}/console"
2824
EXIT=1
2925
;;
3026
10)
31-
MESSAGE="${BUILD_URL}/console : SUCCESS (skipping vote)"
32-
VERIFIED=''
33-
NOTIFY='--notify NONE'
27+
MESSAGE="**🟢 $JOB_NAME:** \`SUCCESS - WIP\` - ${BUILD_URL}/console"
3428
EXIT=0
3529
;;
3630
11)
37-
MESSAGE="${BUILD_URL}/console : FAILED (skipping vote)"
38-
VERIFIED=''
39-
NOTIFY='--notify NONE'
31+
MESSAGE="**🔴 $JOB_NAME:** \`FAILED - WIP\` - ${BUILD_URL}/console"
4032
EXIT=1
4133
;;
4234
*)
43-
MESSAGE="${BUILD_URL}/console : unknown return value ${RET}"
44-
VERIFIED=''
45-
NOTIFY='--notify NONE'
35+
MESSAGE="**🔴 $JOB_NAME:** \`FAILED : unknown return value ${RET}\` - ${BUILD_URL}/console"
4636
EXIT=1
4737
;;
4838
esac
4939

5040
echo "${MESSAGE}"
51-
52-
# Update Gerrit with the success/failure status
53-
if [ -n "${GERRIT_PATCHSET_REVISION}" ]
54-
then
55-
ssh \
56-
-l jenkins-glusterorg \
57-
-i $GERRITHUB_KEY \
58-
-o StrictHostKeyChecking=no \
59-
-p 29418 \
60-
${GERRIT_HOST} \
61-
gerrit review \
62-
--message "'${MESSAGE}'" \
63-
--project ${GERRIT_PROJECT} \
64-
${VERIFIED} \
65-
${NOTIFY} \
66-
${GERRIT_PATCHSET_REVISION}
67-
fi
41+
echo "${MESSAGE}" > result_message.txt
6842

6943
# exit with SUCCESS or FAIL only
7044
exit ${EXIT}

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

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
- pipeline:
2+
name: trigger-fsal-on-new-patch
3+
node: cico-workspace
4+
description: >-
5+
Run fsal-cephfs, fsal-gluster, fsal-gpfs, fsal-rgw on nfs-ganesha. This job is triggered by
6+
sending a change to
7+
https://review.gerrithub.io/#/q/project:ffilz/nfs-ganesha for review.
8+
9+
Note: it is possible to retrigger a test for a change by including recheck
10+
fsal in a comment on GerritHub.
11+
project-type: pipeline
12+
concurrent: true
13+
allow-manual-triggers: false
14+
15+
scm:
16+
- ci-tests
17+
18+
discard-old-builds:
19+
days-to-keep: 14
20+
num-to-keep: 14
21+
22+
builders:
23+
- get-node
24+
- shell: !include-raw-verbatim: scripts/fsal-build.sh
25+
26+
triggers:
27+
- gerrit:
28+
server-name: nfs-ganesha-gerrithub
29+
silent: true
30+
trigger-on:
31+
- patchset-created-event:
32+
exclude-drafts: true
33+
- comment-added-contains-event:
34+
comment-contains-value: "recheck fsal"
35+
projects:
36+
- project-compare-type: PLAIN
37+
project-pattern: "ffilz/nfs-ganesha"
38+
branches:
39+
- branch-pattern: "**"
40+
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+
}

0 commit comments

Comments
 (0)