summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build-gluster-org/jobs/clang-format.yml55
-rw-r--r--build-gluster-org/scripts/clang-format.py11
2 files changed, 66 insertions, 0 deletions
diff --git a/build-gluster-org/jobs/clang-format.yml b/build-gluster-org/jobs/clang-format.yml
new file mode 100644
index 0000000..e788a90
--- /dev/null
+++ b/build-gluster-org/jobs/clang-format.yml
@@ -0,0 +1,55 @@
+- job:
+ name: clang-format
+ node: fedora
+ description: Pre-commit clang-format check
+ project-type: freestyle
+ concurrent: true
+
+ scm:
+ - glusterfs
+
+ properties:
+ - discard-after-x:
+ x: 10
+ - one-build-per-node
+
+ triggers:
+ - gerrit:
+ trigger-on:
+ - patchset-created-event:
+ exclude-drafts: false
+ exclude-trivial-rebase: false
+ exclude-no-code-change: false
+ - draft-published-event
+ - comment-added-contains-event:
+ comment-contains-value: "recheck smoke"
+ gerrit-build-failed-verified-value: 0
+ gerrit-build-successful-verified-value: 0
+ override-votes: true
+ server-name: review.gluster.org_for-smoke-jobs
+ projects:
+ - project-compare-type: 'PLAIN'
+ project-pattern: 'glusterfs'
+ branches:
+ - branch-compare-type: 'ANT'
+ branch-pattern: '**'
+
+ parameters:
+ - string:
+ default: refs/heads/master
+ description: 'For review 12345 and patch set 6, this will be refs/changes/45/12345/6. Default: Tip of master'
+ name: GERRIT_REFSPEC
+ - string:
+ default: master
+ description: 'Name of the branch you want to build from. We usually build from master'
+ name: GERRIT_BRANCH
+
+ builders:
+ - shell: !include-raw: ../scripts/clang-format.py
+
+ wrappers:
+ - timestamps
+ - timeout:
+ timeout: 30
+ abort: true
+ type: absolute
diff --git a/build-gluster-org/scripts/clang-format.py b/build-gluster-org/scripts/clang-format.py
new file mode 100644
index 0000000..7621bf9
--- /dev/null
+++ b/build-gluster-org/scripts/clang-format.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+import subprocess
+output = subprocess.check_output(["git", "clang-format", "--diff"])
+
+if output not in ['no modified files to format\n', 'clang-format did not modify any files\n']:
+ print "Run git clang-format, then commit.\n"
+ exit(1)
+else:
+ exit(0)
+