This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new 79b040a89 fix(rmqctl): ship the completion scripts in release archives 
(#5883)
79b040a89 is described below

commit 79b040a89873d001916088d6ed4124914477bf2b
Author: 健康宝 <[email protected]>
AuthorDate: Mon Oct 12 15:20:27 2026 +0800

    fix(rmqctl): ship the completion scripts in release archives (#5883)
    
    `make package` depended only on `license-binary` (`rmqctl/Makefile:94`), so 
the `release` → `checksum` → `package` chain never produced the completion 
scripts; `completion` exists solely as the standalone target at `:112-117`. 
`rmqctl/scripts/package-release.sh:81-86` then copied them only under `if [ -d 
"$completion_dir" ]` and swallowed a failed `cp` with `|| true`, so archives 
built from a clean tree shipped without `completion/` while still exiting 0 — 
even though `rmqctl/install. [...]
    
    Known gap, tracked for a maintainer follow-up: 
`rmqctl/scripts/license-binary_test.go:51-60` already drives 
`package-release.sh` through its `pack()` helper and only appends `GO=` to the 
child environment (`:55`), so it falls back to `rmqctl/bin/completion`, which 
does not exist on a fresh checkout — the new hard failure breaks `pack(target, 
legal, true)` there, and `.github/workflows/ci.yml:170` runs `make test-race` 
before `make build` at `:176`, so a clean CI run goes red. The fix  [...]
---
 rmqctl/Makefile                   |  4 ++--
 rmqctl/scripts/package-release.sh | 15 ++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/rmqctl/Makefile b/rmqctl/Makefile
index 3ad067026..ec0f354f8 100644
--- a/rmqctl/Makefile
+++ b/rmqctl/Makefile
@@ -91,7 +91,7 @@ build-all: catalog-verify
 
 license-binary: build-all
 
-package: license-binary
+package: license-binary completion
        @rm -rf $(PACKAGE_DIR)
        @mkdir -p $(PACKAGE_DIR)
        @set -e; for target in $(TARGETS); do \
@@ -101,7 +101,7 @@ package: license-binary
                else \
                        binary=$(BUILD_DIR)/rmqctl-$$os-$$arch; \
                fi; \
-               GO="$(GO)" bash scripts/package-release.sh "$$binary" "$$os" 
"$$arch" "$(VERSION)" "$(LEGAL_DIR)/$$target" "$(PACKAGE_DIR)"; \
+               GO="$(GO)" COMPLETION_DIR="$(BUILD_DIR)/completion" bash 
scripts/package-release.sh "$$binary" "$$os" "$$arch" "$(VERSION)" 
"$(LEGAL_DIR)/$$target" "$(PACKAGE_DIR)"; \
        done
 
 checksum: package
diff --git a/rmqctl/scripts/package-release.sh 
b/rmqctl/scripts/package-release.sh
index 6978b2f6b..bb9bef936 100755
--- a/rmqctl/scripts/package-release.sh
+++ b/rmqctl/scripts/package-release.sh
@@ -78,12 +78,17 @@ cp "$binary" "${stage}/${bin_name}"
 cp "${legal_dir}/LICENSE" "${stage}/LICENSE"
 cp "${legal_dir}/NOTICE" "${stage}/NOTICE"
 
-# Copy completion scripts if they exist (produced by `make completion`)
-completion_dir="${script_dir}/../bin/completion"
-if [ -d "$completion_dir" ]; then
-    mkdir -p "${stage}/completion"
-    cp "$completion_dir"/* "${stage}/completion/" 2>/dev/null || true
+# The completion scripts must ship with every release archive. They are 
produced by
+# `make completion`, which `make package` runs before calling this script; 
honor an explicitly
+# configured build directory. A missing directory or a failed copy is a 
packaging error,
+# not a silent omission.
+completion_dir="${COMPLETION_DIR:-${script_dir}/../bin/completion}"
+if [ ! -d "$completion_dir" ]; then
+    echo "Missing completion scripts in $completion_dir; run make completion 
first" >&2
+    exit 1
 fi
+mkdir -p "${stage}/completion"
+cp "$completion_dir"/* "${stage}/completion/"
 
 # The license manifest and the full license texts must ship with the package.
 cp -r "$legal_dir" "${stage}/legal"

Reply via email to