cicd: Require commit messages are tagged
This commit is contained in:
parent
54d6855b3d
commit
9ca94756e5
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
commitmsg = ""
|
||||||
|
|
||||||
|
with open('.git/COMMIT_EDITMSG', mode='r') as f:
|
||||||
|
commitmsg = f.readline().strip()
|
||||||
|
|
||||||
|
print("Commit message is: " + commitmsg)
|
||||||
|
|
||||||
|
ALLOWED_COMMIT_TYPES = [
|
||||||
|
"cicd",
|
||||||
|
"typo",
|
||||||
|
"fmt",
|
||||||
|
"doc",
|
||||||
|
"bugfix",
|
||||||
|
"security",
|
||||||
|
"feature",
|
||||||
|
]
|
||||||
|
|
||||||
|
for allowedType in ALLOWED_COMMIT_TYPES:
|
||||||
|
if commitmsg.startswith(allowedType + ":"):
|
||||||
|
print("Allowing commit type: ", allowedType)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
print("Commit message should start with commit type. One of: ", ", ".join(ALLOWED_COMMIT_TYPES))
|
||||||
|
sys.exit(1)
|
||||||
5
Makefile
5
Makefile
|
|
@ -22,6 +22,9 @@ daemon-unittests:
|
||||||
go test ./... -coverprofile reports/unittests.out
|
go test ./... -coverprofile reports/unittests.out
|
||||||
go tool cover -html=reports/unittests.out -o reports/unittests.html
|
go tool cover -html=reports/unittests.out -o reports/unittests.html
|
||||||
|
|
||||||
|
githooks:
|
||||||
|
cp -v .githooks/* .git/hooks/
|
||||||
|
|
||||||
go-tools:
|
go-tools:
|
||||||
go install "github.com/bufbuild/buf/cmd/buf"
|
go install "github.com/bufbuild/buf/cmd/buf"
|
||||||
go install "github.com/fzipp/gocyclo/cmd/gocyclo"
|
go install "github.com/fzipp/gocyclo/cmd/gocyclo"
|
||||||
|
|
@ -31,7 +34,7 @@ go-tools:
|
||||||
go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
|
go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
|
||||||
go install "google.golang.org/protobuf/cmd/protoc-gen-go"
|
go install "google.golang.org/protobuf/cmd/protoc-gen-go"
|
||||||
|
|
||||||
grpc: go-tools
|
grpc: githooks go-tools
|
||||||
buf generate
|
buf generate
|
||||||
|
|
||||||
podman-image:
|
podman-image:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue