Skip to content

[make] Fix .idl submodule check #6628

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

Merged
merged 1 commit into from
Jan 16, 2025
Merged
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
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,20 @@ $(STABLE_BIN)/$(PROTOC_VERSION_BIN): | $(STABLE_BIN)
# and last but not least: this avoids using `go` to make this check take only a couple seconds in CI,
# so the whole docker container doesn't have to be prepared.
.idl-status:
branches="$$(git submodule foreach git branch master --contains HEAD)"; \
if ! (echo "$$branches" | grep -q master); then \
>&2 echo "IDL submodule points to a commit ($$(git submodule foreach git rev-parse HEAD | tail -n 1)) that is not on master."; \
>&2 echo "Make sure the IDL PR has been merged, and this PR is updated, before merging here."; \
exit 1; \
fi
idlsha="$$(git ls-tree HEAD idls | awk '{print substr($$3,0,12)}')"; \
gosha="$$(grep github.com/uber/cadence-idl go.mod | tr '-' '\n' | tail -n1)"; \
if [[ "$$idlsha" != "$$gosha" ]]; then \
>&2 echo "IDL submodule sha ($$idlsha) does not match go module sha ($$gosha)."; \
>&2 echo "Make sure the IDL PR has been merged, and this PR is updated, before merging here."; \
exit 1; \
fi
$(Q) cd idls && \
SUBMODULE_COMMIT=$$(git rev-parse HEAD) && \
BRANCH_INFO=$$(git branch -r --contains "$$SUBMODULE_COMMIT" | head -n1) && \
if ! git branch -r --contains "$$SUBMODULE_COMMIT" | grep -q "origin/master"; then \
echo "Error: Submodule commit $$SUBMODULE_COMMIT belongs to $$BRANCH_INFO, not to master branch" && \
exit 1; \
fi
$(Q) idlsha=$$(git ls-tree HEAD idls | awk '{print substr($$3,0,12)}') && \
gosha=$$(grep github.com/uber/cadence-idl go.mod | tr '-' '\n' | tail -n1) && \
if [[ "$$idlsha" != "$$gosha" ]]; then \
echo "IDL submodule sha ($$idlsha) does not match go module sha ($$gosha)." >&2 && \
echo "Make sure the IDL PR has been merged, and this PR is updated, before merging here." >&2 && \
exit 1; \
fi


# ====================================
Expand Down
Loading