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

Cobradocs sync: improve makefile, resync without commit hash #1904

Open
wants to merge 8 commits into
base: prod
Choose a base branch
from
Prev Previous commit
Next Next commit
Add binary to the commit message
Signed-off-by: Rohit Nayak <[email protected]>
rohit-nayak-ps committed Dec 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 33fa661dc342f3d5570df5403e0a0afc6e0cd0b1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ BINS := mysqlctl mysqlctld vtaclcheck topo2topo vtbackup vtclient vtcombo \
%-docs:
go run ./tools/cobradocs/ --vitess-dir "${VITESS_DIR}" --version-pairs "${COBRADOC_VERSION_PAIRS}" $(patsubst %-docs,%,$@)
Copy link
Collaborator

@mattlord mattlord Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't specify anything for COBRADOC_VERSION_PAIRS it does not work:

❯ make generated-docs
go run ./tools/cobradocs/ --vitess-dir "/Users/matt/git/vitess" --version-pairs ""main:22.0,v21.0.0:21.0,v20.0.3:20.0,v19.0.7:19.0"" mysqlctl
2024/12/26 16:58:00 exit status 1
exit status 1
make: *** [mysqlctl-docs] Error 1

❯ git status
On branch rohit/slimmer-docs
Your branch is ahead of 'origin/rohit/slimmer-docs' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	content/en/docs/21.0/reference/programs/mysqlctl/_index.md-e

nothing added to commit but untracked files present (use "git add" to track)

❯ git diff
diff --git a/content/en/docs/21.0/reference/programs/mysqlctl/mysqlctl_init.md b/content/en/docs/21.0/reference/programs/mysqlctl/mysqlctl_init.md
index 7d63ff46..5528f87a 100644
--- a/content/en/docs/21.0/reference/programs/mysqlctl/mysqlctl_init.md
+++ b/content/en/docs/21.0/reference/programs/mysqlctl/mysqlctl_init.md
@@ -44,7 +44,7 @@ mysqlctl \
       --config-file string                                          Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored.
       --config-file-not-found-handling ConfigFileNotFoundHandling   Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn)
       --config-name string                                          Name of the config file (without extension) to search for. (default "vtconfig")
-      --config-path strings                                         Paths to search for config files in. (default [<WORKDIR>])
+      --config-path strings                                         Paths to search for config files in. (default [/Users/matt/git/vitess])
       --config-persistence-min-interval duration                    minimum interval between persisting dynamic config changes back to disk (if no change has occurred, nothing is done). (default 1s)
       --config-type string                                          Config file type (omit to infer config type from file extension).
       --db-credentials-file string                                  db credentials file; send SIGHUP to reload this file
...


❯ export COBRADOC_VERSION_PAIRS="main:22.0"

❯ make generated-docs
go run ./tools/cobradocs/ --vitess-dir "/Users/matt/git/vitess" --version-pairs "main:22.0" mysqlctl
COMMIT_HASH=7386140b97; \
    	git add -u content && \
    	if ! git diff --cached --quiet HEAD --; then \
    	  git commit -s -m "Update cobradocs for $COMMIT_HASH for mysqlctl"; \
    	fi
[rohit/slimmer-docs fb7ce160] Update cobradocs for 7386140b97 for mysqlctl
 7 files changed, 7 insertions(+), 7 deletions(-)
...

COMMIT_HASH=$(shell cd $(VITESS_DIR) && git rev-parse --short HEAD) && \
git add -u content && git commit -s -m "Update cobradocs for $$COMMIT_HASH"
git add -u content && git commit -s -m "Update cobradocs for $$COMMIT_HASH for $(patsubst %-docs,%,$@)"

# Target to run them all.
.PHONY: generated-docs