forked from rcbops/jenkins-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gate-submodule-foodcritic
executable file
·58 lines (49 loc) · 1.41 KB
/
gate-submodule-foodcritic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -x
set -e
set -u
# Cleanup
rm -rf ${GIT_REPO} || :
# Clone the upstream repo
if ! ( git clone ${GIT_CLONE_URL} ); then
echo "Unable to clone git repo: ${GIT_CLONE_URL}"
exit 1
fi
# -- TRYING ANOTHER METHOD -- #
## Merge the proposed patch(es)
#cd ${GIT_REPO}
#if ! ( curl -s ${GIT_PATCH_URL} | git am ); then
# echo "Unable to merge proposed patch: ${GIT_PATCH_URL}"
# exit 1
#fi
#cd ../
# Apply the proposed diff
pushd ${GIT_REPO}
if ! ( curl -s ${GIT_DIFF_URL} | git apply ); then
echo "Unable to merge proposed patch: ${GIT_PATCH_URL}"
exit 1
fi
popd
# RVM is throwing an unbound variable error
set +x
set +u
# Tell RVM to use Ruby-1.9.3
source /usr/local/rvm/scripts/rvm
rvm use 1.9.3
# Run FoodCritic validations
echo "Running FoodCritic against ./${GIT_REPO}"
# stop complaining about FC024
if ! ( foodcritic -f any -f ~FC005 -f ~FC014 -f ~FC015 -f ~FC020 -f ~FC023 -f ~FC024 ${GIT_REPO} ); then
echo "Pull request does not conform to FoodCritic"
exit 1
else
echo "Pull request conforms to necessary foodcritic tests"
RETVAL=0
fi
# Commenting this block out, as the compiler warnings needs the source to sick around in the workspace
## Cleanup after ourselves
#echo "Cleaning up"
#cd ..
#rm -rf ${GIT_REPO}
curl -s -K ~/.rcbjenkins-git-creds ${GIT_COMMENT_URL} -X 'POST' -d '{"body": "Gate: Submodule Foodcritic\n * '${BUILD_URL}'consoleFull : SUCCESS"}'
exit ${RETVAL}