Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo PR with protobuf mismatch #48366

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Make targets:

Check failure on line 1 in Makefile

View workflow job for this annotation

GitHub Actions / Lint (Proto)

protos gRPC are out-of-date

Please run the command `make grpc`
#
# all : builds all binaries in development mode
# full : builds all binaries for PRODUCTION use
Expand Down Expand Up @@ -1543,8 +1543,7 @@
.PHONY: derive-up-to-date
derive-up-to-date: must-start-clean/host derive
@if ! git diff --quiet; then \
echo 'Please run make derive.'; \
git diff; \
./build.assets/tooling/cmd/please-run.sh "derived functions" "make derive"; \
exit 1; \
fi

Expand Down Expand Up @@ -1579,16 +1578,14 @@
.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.'; \
git diff; \
./build.assets/tooling/cmd/please-run.sh "protos gRPC" "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.'; \
git diff; \
./build.assets/tooling/cmd/please-run.sh "protos gRPC" "make grpc"; \
exit 1; \
fi

Expand All @@ -1597,14 +1594,12 @@
crds-up-to-date: must-start-clean/host
$(MAKE) -C integrations/operator manifests
@if ! git diff --quiet; then \
echo 'Please run make -C integrations/operator manifests.'; \
git diff; \
./build.assets/tooling/cmd/please-run.sh "operator CRD manifests" "make -C integrations/operator crd"; \
exit 1; \
fi
$(MAKE) -C integrations/operator crd-docs
@if ! git diff --quiet; then \
echo 'Please run make -C integrations/operator crd-docs.'; \
git diff; \
./build.assets/tooling/cmd/please-run.sh "operator CRD docs" "make -C integrations/operator crd"; \
exit 1; \
fi

Expand All @@ -1613,8 +1608,7 @@
terraform-resources-up-to-date: must-start-clean/host
$(MAKE) -C integrations/terraform docs
@if ! git diff --quiet; then \
echo 'Please run make -C integrations/terraform docs.'; \
git diff; \
./build.assets/tooling/cmd/please-run.sh "TF provider docs" "make -C integrations/terraform docs"; \
exit 1; \
fi

Expand Down
2 changes: 2 additions & 0 deletions api/proto/teleport/accesslist/v1/accesslist.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ message AccessListSpec {
AccessListRequires ownership_requires = 5;

// grants describes the access granted by membership to this Access List.
// This is a totally new comment
// And I forgot to run the generation commands.
AccessListGrants grants = 6;

// title is a plaintext short description of the Access List.
Expand Down
40 changes: 40 additions & 0 deletions build.assets/tooling/cmd/please-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env sh

# This script is a helper that tells developers what generated content is out of date
# and which command to run.
# When running on GitHub actions, the script will also create an error in the PR and
# collapse the diff to improve readability.

set -eu

KIND="$1"
GENERATE_COMMAND="$2"

TITLE="$KIND are out-of-date"
MESSAGE="Please run the command \`$GENERATE_COMMAND\`"

if [ -z ${GITHUB_ACTIONS+x} ];
then
# We are not in GitHub Actions
echo "============="
echo "$TITLE"
echo "$MESSAGE"
echo "============="

git diff || true
else
# We are in GitHub Actions

# Create a GitHub error
echo "::error file=Makefile,title=$TITLE::$MESSAGE"

# Also write to the job logs
echo "============="
echo "$TITLE"
echo "$MESSAGE"
echo "============="

echo "::group::Diff output"
git diff || true
echo "::endgroup::"
fi
3 changes: 3 additions & 0 deletions integrations/operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ help: ## Display this help.

##@ Development

.PHONY: crd ## Single command to generate anything CRD-related (manifests and docs)
crd: crdgen crd-docs

.PHONY: crdgen
crdgen: ## Generate CRDs
make -C crdgen
Expand Down
Loading