Skip to content

Commit e4d1f82

Browse files
committed
Add build step that checks commit fixup and DCO.
This is a transparent copy of the steps previously added to the firecracker-containerd repo. Signed-off-by: Erik Sipsma <[email protected]>
1 parent a4afb10 commit e4d1f82

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.buildkite/logcheck.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/sh
2+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License"). You may
5+
# not use this file except in compliance with the License. A copy of the
6+
# License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0/
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
15+
if [ -z "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]; then
16+
# only run on pull requests
17+
exit 0
18+
fi
19+
20+
found_fixups=0
21+
missing_dco=0
22+
23+
for sha in $(git log --no-merges --pretty=%H --no-decorate \
24+
"${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"..HEAD); do
25+
git show --pretty=oneline --no-decorate --no-patch $sha \
26+
| fgrep -q 'fixup!' && {
27+
found_fixups=1
28+
echo "Found fixup commit $sha"
29+
}
30+
31+
git show --pretty=medium --no-decorate --no-patch $sha \
32+
| fgrep -q Signed-off-by: || {
33+
missing_dco=1
34+
echo "Missing DCO on $sha"
35+
}
36+
done
37+
38+
status=0
39+
if [ $found_fixups -gt 0 ]; then
40+
status=1
41+
else
42+
echo "Found no fixup commits"
43+
fi
44+
45+
if [ $missing_dco -gt 0 ]; then
46+
status=1
47+
else
48+
echo "All commits have Signed-off-by signature"
49+
fi
50+
51+
exit $status

.buildkite/pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ steps:
3333
# multiple go builds are downloading to the same cache.
3434
- wait
3535

36+
- label: 'git log validation'
37+
command: './.buildkite/logcheck.sh'
38+
3639
- label: 'build'
3740
commands:
3841
- 'make'

0 commit comments

Comments
 (0)