Skip to content

Commit

Permalink
* Add pre-commit step to replace lock-api-state.sh, which ensures that
Browse files Browse the repository at this point in the history
  there are no buf image changes to commit. This was formerly run by rph
  at the beginning of a release.
  • Loading branch information
davidfluck-hpe committed Oct 8, 2024
1 parent 9faa0cb commit a75e9e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ repos:
description: "Runs `golangci-lint`, install https://github.com/golangci/golangci-lint"
exclude: ^(proto/pkg|hpc-ard-launcher-go/launcher/)
require_serial: true
- id: lock-api-state
name: "Generate buf image (lock-api-state.sh)"
entry: ./pre-commit/lock-api-state.sh
language: "script"
description: "Attempts to generate a new buf.image.bin, and fails if there are changes to commit."

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.28.0
Expand Down
10 changes: 10 additions & 0 deletions pre-commit/lock-api-state.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# Regenerate proto/buf.image.bin
make -C proto gen-buf-image

# If proto/buf.image.bin has been modified locally, then we have changes to
# commit, and the status check returns a 1 and fails. Otherwise, it returns a 0
# and succeeds.
git diff --exit-code -- proto/buf.image.bin
exit $?

0 comments on commit a75e9e0

Please sign in to comment.