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

gujiaweijoe pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bifromq.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d049ec5e Update/add Apache BifroMQ plugin POM/BOM files and release 
script (#193)
5d049ec5e is described below

commit 5d049ec5e1abc341cc375ee5c06c5f74e467ac74
Author: Yonny(Yu) Hao <[email protected]>
AuthorDate: Thu Nov 27 17:56:54 2025 +0800

    Update/add Apache BifroMQ plugin POM/BOM files and release script (#193)
    
    1. add an aggregator POM for apache maven deployment
    2. add/update release scripts using gpg-agent during signing process
---
 bifromq-plugin/bifromq-plugin-archetype/pom.xml    |   4 +-
 .../bifromq-plugin-auth-provider/pom.xml           |   4 +-
 bifromq-plugin/bifromq-plugin-bom/pom.xml          |  78 +++++++++++++++
 .../bifromq-plugin-client-balancer/pom.xml         |   4 +-
 bifromq-plugin/bifromq-plugin-context/pom.xml      |   4 +-
 .../bifromq-plugin-event-collector/pom.xml         |   4 +-
 bifromq-plugin/bifromq-plugin-main/pom.xml         |   4 +-
 .../bifromq-plugin-resource-throttler/pom.xml      |   4 +-
 .../bifromq-plugin-setting-provider/pom.xml        |   4 +-
 .../pom.xml                                        |  32 ++++---
 bifromq-plugin/pom.xml                             |   1 +
 release/plugin-release.sh                          | 105 +++++++++++++++++++++
 release/release.sh                                 |  39 ++------
 release/sign-artifacts.sh                          |   9 +-
 14 files changed, 238 insertions(+), 58 deletions(-)

diff --git a/bifromq-plugin/bifromq-plugin-archetype/pom.xml 
b/bifromq-plugin/bifromq-plugin-archetype/pom.xml
index 57cb253b2..5fedf4323 100644
--- a/bifromq-plugin/bifromq-plugin-archetype/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-archetype/pom.xml
@@ -31,6 +31,8 @@
     <packaging>maven-archetype</packaging>
 
     <artifactId>bifromq-plugin-archetype</artifactId>
+    <name>Apache BifroMQ Plugin Archetype</name>
+    <description>Archetype for scaffolding Apache BifroMQ 
plugins.</description>
 
     <build>
         <extensions>
@@ -40,4 +42,4 @@
             </extension>
         </extensions>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-auth-provider/pom.xml 
b/bifromq-plugin/bifromq-plugin-auth-provider/pom.xml
index b5f2918e3..f5c4f58bd 100644
--- a/bifromq-plugin/bifromq-plugin-auth-provider/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-auth-provider/pom.xml
@@ -30,6 +30,8 @@
     </parent>
 
     <artifactId>bifromq-plugin-auth-provider</artifactId>
+    <name>Apache BifroMQ Plugin Auth Provider</name>
+    <description>Authentication provider plugin API for Apache 
BifroMQ.</description>
 
     <dependencies>
         <dependency>
@@ -57,4 +59,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-bom/pom.xml 
b/bifromq-plugin/bifromq-plugin-bom/pom.xml
new file mode 100644
index 000000000..0bc6c5150
--- /dev/null
+++ b/bifromq-plugin/bifromq-plugin-bom/pom.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xmlns="http://maven.apache.org/POM/4.0.0";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.bifromq</groupId>
+        <artifactId>bifromq-plugin</artifactId>
+        <version>${revision}</version>
+    </parent>
+
+    <artifactId>bifromq-plugin-bom</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache BifroMQ Plugin BOM</name>
+    <description>Bill of materials for Apache BifroMQ plugin APIs and 
archetype.</description>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- plugin APIs -->
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-auth-provider</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-client-balancer</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-event-collector</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-resource-throttler</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-setting-provider</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <!-- plugin main and context -->
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-context</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bifromq</groupId>
+                <artifactId>bifromq-plugin-main</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-client-balancer/pom.xml 
b/bifromq-plugin/bifromq-plugin-client-balancer/pom.xml
index 7225d656d..fabe61da3 100644
--- a/bifromq-plugin/bifromq-plugin-client-balancer/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-client-balancer/pom.xml
@@ -29,6 +29,8 @@
     </parent>
 
     <artifactId>bifromq-plugin-client-balancer</artifactId>
+    <name>Apache BifroMQ Plugin Client Balancer</name>
+    <description>Client balancer plugin API for Apache BifroMQ.</description>
     <dependencies>
         <dependency>
             <groupId>org.apache.bifromq</groupId>
@@ -43,4 +45,4 @@
             <artifactId>pf4j</artifactId>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-context/pom.xml 
b/bifromq-plugin/bifromq-plugin-context/pom.xml
index 1f2da87f5..1c5ba0157 100644
--- a/bifromq-plugin/bifromq-plugin-context/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-context/pom.xml
@@ -29,6 +29,8 @@
     </parent>
 
     <artifactId>bifromq-plugin-context</artifactId>
+    <name>Apache BifroMQ Plugin Context</name>
+    <description>Shared plugin runtime context for Apache 
BifroMQ.</description>
     <dependencies>
         <dependency>
             <groupId>org.pf4j</groupId>
@@ -36,4 +38,4 @@
             <scope>provided</scope>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-event-collector/pom.xml 
b/bifromq-plugin/bifromq-plugin-event-collector/pom.xml
index 141616ab1..1f6b642dd 100644
--- a/bifromq-plugin/bifromq-plugin-event-collector/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-event-collector/pom.xml
@@ -29,6 +29,8 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>bifromq-plugin-event-collector</artifactId>
+    <name>Apache BifroMQ Plugin Event Collector</name>
+    <description>Event collector plugin API for Apache BifroMQ.</description>
     <dependencies>
         <dependency>
             <groupId>org.apache.bifromq</groupId>
@@ -43,4 +45,4 @@
             <artifactId>pf4j</artifactId>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-main/pom.xml 
b/bifromq-plugin/bifromq-plugin-main/pom.xml
index 2d0480c0c..ef962903b 100644
--- a/bifromq-plugin/bifromq-plugin-main/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-main/pom.xml
@@ -29,6 +29,8 @@
     </parent>
 
     <artifactId>bifromq-plugin-main</artifactId>
+    <name>Apache BifroMQ Plugin Main</name>
+    <description>Bootstrap entrypoint for Apache BifroMQ plugin 
runtime.</description>
     <dependencies>
         <dependency>
             <groupId>org.apache.bifromq</groupId>
@@ -48,4 +50,4 @@
             <artifactId>testng</artifactId>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-resource-throttler/pom.xml 
b/bifromq-plugin/bifromq-plugin-resource-throttler/pom.xml
index d3f070d2b..15492c686 100644
--- a/bifromq-plugin/bifromq-plugin-resource-throttler/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-resource-throttler/pom.xml
@@ -29,6 +29,8 @@
     </parent>
 
     <artifactId>bifromq-plugin-resource-throttler</artifactId>
+    <name>Apache BifroMQ Plugin Resource Throttler</name>
+    <description>Resource throttling plugin API for Apache 
BifroMQ.</description>
     <dependencies>
         <dependency>
             <groupId>org.apache.bifromq</groupId>
@@ -39,4 +41,4 @@
             <artifactId>pf4j</artifactId>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-setting-provider/pom.xml 
b/bifromq-plugin/bifromq-plugin-setting-provider/pom.xml
index 022333ace..4779dde24 100644
--- a/bifromq-plugin/bifromq-plugin-setting-provider/pom.xml
+++ b/bifromq-plugin/bifromq-plugin-setting-provider/pom.xml
@@ -29,6 +29,8 @@
     </parent>
 
     <artifactId>bifromq-plugin-setting-provider</artifactId>
+    <name>Apache BifroMQ Plugin Setting Provider</name>
+    <description>Setting provider plugin API for Apache BifroMQ.</description>
     <dependencies>
         <dependency>
             <groupId>org.apache.bifromq</groupId>
@@ -44,4 +46,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/bifromq-plugin/bifromq-plugin-archetype/pom.xml 
b/bifromq-plugin/plugin-release/pom.xml
similarity index 59%
copy from bifromq-plugin/bifromq-plugin-archetype/pom.xml
copy to bifromq-plugin/plugin-release/pom.xml
index 57cb253b2..1ac7c4d3b 100644
--- a/bifromq-plugin/bifromq-plugin-archetype/pom.xml
+++ b/bifromq-plugin/plugin-release/pom.xml
@@ -22,22 +22,30 @@
          xmlns="http://maven.apache.org/POM/4.0.0";
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
+
     <parent>
         <groupId>org.apache.bifromq</groupId>
         <artifactId>bifromq-plugin</artifactId>
         <version>${revision}</version>
     </parent>
 
-    <packaging>maven-archetype</packaging>
-
-    <artifactId>bifromq-plugin-archetype</artifactId>
+    <artifactId>plugin-release</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache BifroMQ Plugin Release Aggregator</name>
+    <description>Aggregator for publishing Apache BifroMQ plugin artifacts to 
Maven Central.</description>
+    <properties>
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
 
-    <build>
-        <extensions>
-            <extension>
-                <groupId>org.apache.maven.archetype</groupId>
-                <artifactId>archetype-packaging</artifactId>
-            </extension>
-        </extensions>
-    </build>
-</project>
\ No newline at end of file
+    <modules>
+        <module>../bifromq-plugin-archetype</module>
+        <module>../bifromq-plugin-auth-provider</module>
+        <module>../bifromq-plugin-client-balancer</module>
+        <module>../bifromq-plugin-event-collector</module>
+        <module>../bifromq-plugin-resource-throttler</module>
+        <module>../bifromq-plugin-setting-provider</module>
+        <module>../bifromq-plugin-context</module>
+        <module>../bifromq-plugin-main</module>
+        <module>../bifromq-plugin-bom</module>
+    </modules>
+</project>
diff --git a/bifromq-plugin/pom.xml b/bifromq-plugin/pom.xml
index 9f0e604da..65a62f307 100644
--- a/bifromq-plugin/pom.xml
+++ b/bifromq-plugin/pom.xml
@@ -48,5 +48,6 @@
         <module>bifromq-plugin-main</module>
         <module>bifromq-plugin-archetype</module>
         <module>bifromq-plugin-context</module>
+        <module>bifromq-plugin-bom</module>
     </modules>
 </project>
\ No newline at end of file
diff --git a/release/plugin-release.sh b/release/plugin-release.sh
new file mode 100755
index 000000000..41cb075d1
--- /dev/null
+++ b/release/plugin-release.sh
@@ -0,0 +1,105 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+set -euo pipefail
+
+ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
+
+usage() {
+  cat <<'EOF'
+Usage: plugin-release.sh [options]
+Options:
+  --repo <path>          Deploy to local file repository (default: 
<root>/target/local-repo)
+  --staging              Deploy to apache staging (no local repo); 
incompatible with --repo
+  -h, --help             Show this help
+Examples:
+  plugin-release.sh
+  plugin-release.sh --repo /tmp/m2-repo
+  plugin-release.sh --staging
+EOF
+}
+
+ALT_DEPLOY_REPO="${ROOT_DIR}/target/local-repo"
+USE_STAGING=false
+
+while [[ $# -gt 0 ]]; do
+  case "$1" in
+    --repo)
+      shift
+      [[ $# -gt 0 ]] || { echo "Missing value for --repo" >&2; usage; exit 1; }
+      ALT_DEPLOY_REPO="$1"
+      USE_STAGING=false
+      ;;
+    --staging)
+      USE_STAGING=true
+      ALT_DEPLOY_REPO=""
+      ;;
+    -h|--help)
+      usage
+      exit 0
+      ;;
+    *)
+      echo "Unknown option: $1" >&2
+      usage
+      exit 1
+      ;;
+  esac
+  shift
+done
+
+if $USE_STAGING && [[ -n "${ALT_DEPLOY_REPO}" ]]; then
+  echo "Error: --repo and --staging cannot be used together." >&2
+  usage
+  exit 1
+fi
+
+ALT_DEPLOY_OPT=()
+SKIP_REMOTE_STAGING_OPT=()
+if $USE_STAGING; then
+  SKIP_REMOTE_STAGING_OPT+=("-DskipRemoteStaging=false")
+else
+  ALT_DEPLOY_OPT+=("-DaltDeploymentRepository=local::file:${ALT_DEPLOY_REPO}")
+  SKIP_REMOTE_STAGING_OPT+=("-DskipRemoteStaging=true")
+fi
+
+export GPG_TTY=${GPG_TTY:-$(tty 2>/dev/null || true)}
+GPG_OPT=("-Dgpg.useagent=true" "-Dgpg.executable=gpg")
+
+mvn -N -f "${ROOT_DIR}/pom.xml" \
+  -DskipTests \
+  "${SKIP_REMOTE_STAGING_OPT[@]}" \
+  "${ALT_DEPLOY_OPT[@]}" \
+  "${GPG_OPT[@]}" \
+  deploy
+
+mvn -N -f "${ROOT_DIR}/bifromq-plugin/pom.xml" \
+  -DskipTests \
+  "${SKIP_REMOTE_STAGING_OPT[@]}" \
+  "${ALT_DEPLOY_OPT[@]}" \
+  "${GPG_OPT[@]}" \
+  deploy
+
+mvn -f "${ROOT_DIR}/bifromq-plugin/plugin-release/pom.xml" \
+  -Papache-release \
+  -DskipTests \
+  "${SKIP_REMOTE_STAGING_OPT[@]}" \
+  "${ALT_DEPLOY_OPT[@]}" \
+  "${GPG_OPT[@]}" \
+  deploy
diff --git a/release/release.sh b/release/release.sh
index ac3de2f70..bf50178c3 100755
--- a/release/release.sh
+++ b/release/release.sh
@@ -23,10 +23,9 @@
 # Print usage information
 usage() {
   cat <<EOF
-Usage: $(basename "$0") <release-branch> [--upload] [--gpg-passphrase <pass>] 
[<svn-username> <svn-password>]
+Usage: $(basename "$0") <release-branch> [--upload] [<svn-username> 
<svn-password>]
   <release-branch>   Release branch in format release-v<major>.<minor>.x (e.g. 
release-v4.0.x)
   --upload           (Optional) Upload artifacts to Apache dist/dev SVN
-  --gpg-passphrase   (Optional) GPG passphrase used for signing
   <svn-username>      (Optional) SVN username for committing to Apache Dev repo
   <svn-password>      (Optional) SVN password for committing to Apache Dev repo
 
@@ -54,22 +53,13 @@ BRANCH="$1"
 UPLOAD=false
 USERNAME=""
 PASSWORD=""
-GPG_PASSPHRASE=""
 SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
 
 verify_gpg_access() {
-  local pass="$1"
-  local sign_cmd=(gpg --armor --batch --yes --pinentry-mode loopback --sign)
-  if [[ -n "$pass" ]]; then
-    if ! echo test | "${sign_cmd[@]}" --passphrase "$pass" >/dev/null 2>&1; 
then
-      echo "ERROR: Provided GPG passphrase is invalid or key is not 
accessible."
-      exit 1
-    fi
-  else
-    if ! echo test | "${sign_cmd[@]}" >/dev/null 2>&1; then
-      echo "ERROR: GPG passphrase required. Provide it via --gpg-passphrase or 
ensure gpg-agent has it cached."
-      exit 1
-    fi
+  local sign_cmd=(gpg --armor --sign)
+  if ! echo test | "${sign_cmd[@]}" >/dev/null 2>&1; then
+    echo "ERROR: GPG signing failed. Ensure gpg-agent is running and 
passphrase is cached."
+    exit 1
   fi
 }
 
@@ -80,16 +70,6 @@ while [[ $# -gt 0 ]]; do
       UPLOAD=true
       shift
       ;;
-    --gpg-passphrase)
-      shift
-      if [[ -z "${1:-}" ]]; then
-        echo "ERROR: --gpg-passphrase requires a value"
-        usage
-        exit 1
-      fi
-      GPG_PASSPHRASE="$1"
-      shift
-      ;;
     *)
       if [[ -z "$USERNAME" ]]; then
         USERNAME="$1"
@@ -118,7 +98,7 @@ trap 'rm -rf "$TMPDIR"' EXIT
 command -v gpg >/dev/null || { echo "GPG is required but not installed."; exit 
1; }
 export GPG_TTY=${GPG_TTY:-$(tty)}
 gpg --list-secret-keys --with-colons | grep -q '^sec' || { echo "ERROR: No GPG 
secret key found for signing."; exit 1; }
-verify_gpg_access "$GPG_PASSPHRASE"
+verify_gpg_access
 
 echo "Cloning repository to temp dir..."
 cd "$TMPDIR"
@@ -154,10 +134,7 @@ done
 
 echo "Running Maven build (build-release profile)..."
 echo "You may be prompted for GPG passphrase by gpg-agent/pinentry."
-MVN_ARGS=(-Pbuild-release -DskipTests)
-if [[ -n "$GPG_PASSPHRASE" ]]; then
-  MVN_ARGS+=("-Dgpg.passphrase=${GPG_PASSPHRASE}")
-fi
+MVN_ARGS=(-Pbuild-release -DskipTests -Dgpg.useagent=true)
 mvn "${MVN_ARGS[@]}" clean verify
 
 cd "$TMPDIR/repo"
@@ -170,7 +147,7 @@ for f in target/output/*; do
 done
 
 echo "Signing artifacts..."
-bash "${SCRIPT_DIR}/sign-artifacts.sh" "$WORKDIR" "$GPG_PASSPHRASE"
+bash "${SCRIPT_DIR}/sign-artifacts.sh" "$WORKDIR"
 
 if [ "$UPLOAD" = true ]; then
   SVN_TMP=$(mktemp -d)
diff --git a/release/sign-artifacts.sh b/release/sign-artifacts.sh
index bb8380da0..7291d0001 100755
--- a/release/sign-artifacts.sh
+++ b/release/sign-artifacts.sh
@@ -20,10 +20,9 @@
 
 set -euo pipefail
 
-# Usage: sign-artifacts.sh <output-dir> [<gpg-passphrase>]
+# Usage: sign-artifacts.sh <output-dir>
 
 out_dir="${1:?output dir required}"
-gpg_passphrase="${2:-}"
 
 shopt -s nullglob
 files=("${out_dir}"/*.tar.gz "${out_dir}"/*.zip)
@@ -35,10 +34,6 @@ if [[ ${#files[@]} -eq 0 ]]; then
 fi
 
 for f in "${files[@]}"; do
-  if [[ -n "${gpg_passphrase}" ]]; then
-    gpg --batch --yes --pinentry-mode loopback --passphrase 
"${gpg_passphrase}" --armor --detach-sign "$f"
-  else
-    gpg --batch --yes --pinentry-mode loopback --armor --detach-sign "$f"
-  fi
+  gpg --armor --detach-sign "$f"
   shasum -a 512 "$f" > "${f}.sha512"
 done

Reply via email to