mirror of
https://github.com/gravitational/teleport
synced 2024-10-19 08:43:58 +00:00
Add check if protos are up to date. (#21066)
* Add check if protos are up to date. A new check has been added that will detect if protobufs are up to date. The script will exit abnormally if protobufs need to be regenerated. * Alan's feedback. * Restoring the script. * Update script comment. * Add in the set -eu. * Add a comment for the pull_request/merge_group bit in the new github action. * Remove helper script. * Reduce the runner size.
This commit is contained in:
parent
cc36d290a1
commit
6bf65b0f4d
30
.github/workflows/protos-up-to-date.yaml
vendored
Normal file
30
.github/workflows/protos-up-to-date.yaml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
name: Protobufs up to date
|
||||
run-name: make protos-up-to-date
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
# These are required for the check to run on PRs.
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
jobs:
|
||||
protos-up-to-date:
|
||||
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
|
||||
name: Protobufs up to date
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
container:
|
||||
image: ghcr.io/gravitational/teleport-buildbox:teleport13
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check if protobufs are up to date
|
||||
# We have to add the current directory as a safe directory or else git commands will not work as expected.
|
||||
run: git config --global --add safe.directory $(realpath .) && make protos-up-to-date/host
|
23
Makefile
23
Makefile
|
@ -29,6 +29,7 @@ BINDIR ?= /usr/local/bin
|
|||
DATADIR ?= /usr/local/share/teleport
|
||||
ADDFLAGS ?=
|
||||
PWD ?= `pwd`
|
||||
GIT ?= git
|
||||
TELEPORT_DEBUG ?= false
|
||||
GITTAG=v$(VERSION)
|
||||
CGOFLAG ?= CGO_ENABLED=1
|
||||
|
@ -1044,6 +1045,28 @@ grpc:
|
|||
grpc/host: protos/all
|
||||
@build.assets/genproto.sh
|
||||
|
||||
# protos-up-to-date checks if the generated GRPC stubs are up to date.
|
||||
# This target runs in the buildbox container.
|
||||
.PHONY: protos-up-to-date
|
||||
protos-up-to-date:
|
||||
$(MAKE) -C build.assets protos-up-to-date
|
||||
|
||||
# protos-up-to-date/host checks if the generated GRPC stubs are up to date.
|
||||
# Unlike protos-up-to-date, this target runs locally.
|
||||
.PHONY: protos-up-to-date/host
|
||||
protos-up-to-date/host: must-start-clean/host grpc/host
|
||||
@if ! $(GIT) diff --quiet; then \
|
||||
echo 'Please run make grpc.'; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: must-start-clean/host
|
||||
must-start-clean/host:
|
||||
@if ! $(GIT) diff --quiet; then \
|
||||
echo 'This must be run from a repo with no unstaged commits.'; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
print/env:
|
||||
env
|
||||
|
||||
|
|
|
@ -247,6 +247,13 @@ grpc: buildbox
|
|||
$(DOCKERFLAGS) -t $(BUILDBOX) \
|
||||
make -C /go/src/github.com/gravitational/teleport grpc/host
|
||||
|
||||
# protos-up-to-date checks if GRPC stubs are up to date from inside the buildbox
|
||||
.PHONY: protos-up-to-date
|
||||
protos-up-to-date: buildbox
|
||||
docker run \
|
||||
$(DOCKERFLAGS) -t $(BUILDBOX) \
|
||||
make -C /go/src/github.com/gravitational/teleport protos-up-to-date/host
|
||||
|
||||
# fix-imports runs GCI to sort and re-order Go imports in a deterministic way.
|
||||
.PHONY: fix-imports
|
||||
fix-imports: buildbox
|
||||
|
|
Loading…
Reference in a new issue