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

frankgh pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-sidecar.git


The following commit(s) were added to refs/heads/trunk by this push:
     new fbd2e55e CASSSIDECAR-472: Fix version in RPM/Deb builds (#362)
fbd2e55e is described below

commit fbd2e55ed4ea3bb7ee17e8a042cacc1907736bd5
Author: Francisco Guerrero <[email protected]>
AuthorDate: Tue Jun 16 12:12:20 2026 -0500

    CASSSIDECAR-472: Fix version in RPM/Deb builds (#362)
    
    Patch by Francisco Guerrero; reviewed by Stefan Miklosovic for 
CASSSIDECAR-472
---
 .circleci/config.yml     | 93 ++++++++++++++++++++++++++++++++++++++++++++++--
 .github/workflows/ci.yml | 51 ++++++++++++++++++++++++--
 CHANGES.txt              |  1 +
 build.gradle             |  1 +
 4 files changed, 140 insertions(+), 6 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 26ef5faa..e369d0db 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -48,6 +48,27 @@ commands:
           sudo bash -c 'for i in {2..20}; do echo 127.0.0.${i} localhost${i} 
>> /etc/hosts; done'
           cat /etc/hosts
 
+  restore_gradle_cache:
+    steps:
+      - run:
+          name: Compute Gradle cache key
+          command: |
+            { find . -type f \( -name 'build.gradle' -o -name 
'settings.gradle' -o -name 'gradle.properties' \) -not -path '*/build/*' -not 
-path './.gradle/*' | sort | xargs sha256sum;
+              sha256sum gradle/wrapper/gradle-wrapper.properties; } > 
.gradle-cache-key
+            cat .gradle-cache-key
+      - restore_cache:
+          keys:
+            - gradle-v1-{{ checksum ".gradle-cache-key" }}
+            - gradle-v1-
+
+  save_gradle_cache:
+    steps:
+      - save_cache:
+          paths:
+            - ~/.gradle/caches
+            - ~/.gradle/wrapper
+          key: gradle-v1-{{ checksum ".gradle-cache-key" }}
+
 jobs:
   # Runs java 8 tests on a docker image
   # We only produce client artifacts for java 8 builds
@@ -80,9 +101,11 @@ jobs:
       - setup_remote_docker
       - install_common
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - run: ./gradlew build -x integrationTest --stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -125,10 +148,12 @@ jobs:
     steps:
       - install_common
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - run: ./scripts/install-shaded-dtest-jar-local.sh
       - run: ./gradlew --no-daemon --max-workers=2 -PdtestVersion=4.0.16 
-Dcassandra.sidecar.versions_to_test="4.0" checkstyleIntegrationTest 
integrationTestLightWeight --stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -152,12 +177,14 @@ jobs:
       - install_common
       - setup_remote_docker
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - attach_workspace:
           at: cassandra-tarballs
       - run: ./scripts/install-shaded-dtest-jar-local.sh
       - run: ./gradlew --no-daemon -PdtestVersion=4.0.16 -PtarballVersion=4.0 
-Dcassandra.sidecar.versions_to_test="4.0" jar integrationTestHeavyWeight 
--stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -180,10 +207,12 @@ jobs:
     steps:
       - install_common
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - run: ./scripts/install-shaded-dtest-jar-local.sh
       - run: ./gradlew --no-daemon --max-workers=2 -PdtestVersion=5.0.3 
-Dcassandra.sidecar.versions_to_test="5.0" checkstyleIntegrationTest 
integrationTestLightWeight --stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -207,12 +236,14 @@ jobs:
       - install_common
       - setup_remote_docker
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - attach_workspace:
           at: cassandra-tarballs
       - run: ./scripts/install-shaded-dtest-jar-local.sh
       - run: ./gradlew --no-daemon -PdtestVersion=5.0.3 -PtarballVersion=5.0 
-Dcassandra.sidecar.versions_to_test="5.0" jar integrationTestHeavyWeight 
--stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -235,10 +266,12 @@ jobs:
     steps:
       - install_common
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - run: ./scripts/install-shaded-dtest-jar-local.sh
       - run: ./gradlew --no-daemon --max-workers=2 -PdtestVersion=5.1 
-Dcassandra.sidecar.versions_to_test="5.1" checkstyleIntegrationTest 
integrationTestLightWeight --stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -262,12 +295,14 @@ jobs:
       - install_common
       - setup_remote_docker
       - checkout
+      - restore_gradle_cache
       - attach_workspace:
           at: dtest-jars
       - attach_workspace:
           at: cassandra-tarballs
       - run: ./scripts/install-shaded-dtest-jar-local.sh
       - run: ./gradlew --no-daemon -PdtestVersion=5.1 -PtarballVersion=5.1 
-Dcassandra.sidecar.versions_to_test="5.1" jar integrationTestHeavyWeight 
--stacktrace
+      - save_gradle_cache
 
       - store_artifacts:
           path: build/reports
@@ -287,29 +322,81 @@ jobs:
     steps:
       - install_common
       - checkout
+      - restore_gradle_cache
       - run: sudo apt --fix-broken install
-      - run: ./gradlew --info clean buildDeb
+      - run:
+          name: Build DEB
+          command: |
+            ./gradlew --parallel clean buildDeb \
+              -x test -x integrationTest \
+              -x rat \
+              -x checkstyleMain -x checkstyleTest -x checkstyleTestFixtures \
+              -x spotbugsMain -x spotbugsTest \
+              -x javadoc \
+              -x asciidoctor -x copyDocs
       - run: DEBIAN_FRONTEND=noninteractive sudo apt install -y 
./build/distributions/apache-cassandra-sidecar*.deb
       - run: test -f /opt/apache-cassandra-sidecar/bin/cassandra-sidecar
       - run: test -f /opt/apache-cassandra-sidecar/conf/sidecar.yaml
       - run: test -f /opt/apache-cassandra-sidecar/conf/logback.xml
       - run: test -f /opt/apache-cassandra-sidecar/LICENSE.txt
       - run: test -f /opt/apache-cassandra-sidecar/lib/cassandra-sidecar-*.jar
+      - run:
+          name: Verify DEB package version
+          command: |
+            EXPECTED_UPSTREAM=$(grep "^version=" gradle.properties | cut -d'=' 
-f2 | tr '-' '~')
+            ACTUAL_VERSION=$(dpkg-query -W -f='${Version}' 
apache-cassandra-sidecar)
+            ACTUAL_UPSTREAM="${ACTUAL_VERSION%-*}"
+            ACTUAL_REVISION="${ACTUAL_VERSION##*-}"
+            echo "DEB: upstream=${ACTUAL_UPSTREAM}, 
revision=${ACTUAL_REVISION}, expected upstream=${EXPECTED_UPSTREAM}"
+            if [ -z "${ACTUAL_REVISION}" ] || [ "${ACTUAL_REVISION}" = 
"${ACTUAL_VERSION}" ]; then
+              echo "DEB has no Debian revision — yields trailing '-' style bug"
+              exit 1
+            fi
+            if [ "${ACTUAL_UPSTREAM}" != "${EXPECTED_UPSTREAM}" ]; then
+              echo "DEB upstream version mismatch: expected 
'${EXPECTED_UPSTREAM}', got '${ACTUAL_UPSTREAM}'"
+              exit 1
+            fi
 
   # ensures we can build and install rpm packages
   rpm_build_install:
     docker:
       - image: cimg/openjdk:11.0
     steps:
-      - run: sudo apt-get update && sudo apt install dnf
+      - run: sudo apt-get update && sudo apt-get install -y dnf rpm
       - checkout
-      - run: ./gradlew -i buildRpm
+      - restore_gradle_cache
+      - run:
+          name: Build RPM
+          command: |
+            ./gradlew --parallel buildRpm \
+              -x test -x integrationTest \
+              -x rat \
+              -x checkstyleMain -x checkstyleTest -x checkstyleTestFixtures \
+              -x spotbugsMain -x spotbugsTest \
+              -x javadoc \
+              -x asciidoctor -x copyDocs
       - run: sudo dnf install -y 
./build/distributions/apache-cassandra-sidecar*.rpm
       - run: test -f /opt/apache-cassandra-sidecar/bin/cassandra-sidecar
       - run: test -f /opt/apache-cassandra-sidecar/conf/sidecar.yaml
       - run: test -f /opt/apache-cassandra-sidecar/conf/logback.xml
       - run: test -f /opt/apache-cassandra-sidecar/LICENSE.txt
       - run: test -f /opt/apache-cassandra-sidecar/lib/cassandra-sidecar-*.jar
+      - run:
+          name: Verify RPM package version
+          command: |
+            EXPECTED_VERSION=$(grep "^version=" gradle.properties | cut -d'=' 
-f2 | tr '-' '~')
+            RPM_FILE=$(ls build/distributions/apache-cassandra-sidecar*.rpm | 
head -n1)
+            ACTUAL_VERSION=$(rpm -qp --queryformat '%{VERSION}' "${RPM_FILE}")
+            ACTUAL_RELEASE=$(rpm -qp --queryformat '%{RELEASE}' "${RPM_FILE}")
+            echo "RPM: version=${ACTUAL_VERSION}, release=${ACTUAL_RELEASE}, 
expected=${EXPECTED_VERSION}"
+            if [ -z "${ACTUAL_RELEASE}" ] || [ "${ACTUAL_RELEASE}" = "(none)" 
]; then
+              echo "RPM Release is empty — yields trailing '-' in 'yum list'"
+              exit 1
+            fi
+            if [ "${ACTUAL_VERSION}" != "${EXPECTED_VERSION}" ]; then
+              echo "RPM Version mismatch: expected '${EXPECTED_VERSION}', got 
'${ACTUAL_VERSION}'"
+              exit 1
+            fi
 
   docker_build:
     docker:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b5e57c48..b8bf8fe4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -432,7 +432,13 @@ jobs:
 
       - name: Build Debian package
         run: |
-          ./gradlew --info clean buildDeb
+          ./gradlew --parallel clean buildDeb \
+            -x test -x integrationTest \
+            -x rat \
+            -x checkstyleMain -x checkstyleTest -x checkstyleTestFixtures \
+            -x spotbugsMain -x spotbugsTest \
+            -x javadoc \
+            -x asciidoctor -x copyDocs
 
       - name: Install Debian package
         run: |
@@ -447,6 +453,22 @@ jobs:
           test -f /opt/apache-cassandra-sidecar/LICENSE.txt
           test -f /opt/apache-cassandra-sidecar/lib/cassandra-sidecar-*.jar
 
+      - name: Verify DEB package version
+        run: |
+          EXPECTED_UPSTREAM=$(grep "^version=" gradle.properties | cut -d'=' 
-f2 | tr '-' '~')
+          ACTUAL_VERSION=$(dpkg-query -W -f='${Version}' 
apache-cassandra-sidecar)
+          ACTUAL_UPSTREAM="${ACTUAL_VERSION%-*}"
+          ACTUAL_REVISION="${ACTUAL_VERSION##*-}"
+          echo "DEB: upstream=${ACTUAL_UPSTREAM}, revision=${ACTUAL_REVISION}, 
expected upstream=${EXPECTED_UPSTREAM}"
+          if [ -z "${ACTUAL_REVISION}" ] || [ "${ACTUAL_REVISION}" = 
"${ACTUAL_VERSION}" ]; then
+            echo "DEB has no Debian revision — yields trailing '-' style bug"
+            exit 1
+          fi
+          if [ "${ACTUAL_UPSTREAM}" != "${EXPECTED_UPSTREAM}" ]; then
+            echo "DEB upstream version mismatch: expected 
'${EXPECTED_UPSTREAM}', got '${ACTUAL_UPSTREAM}'"
+            exit 1
+          fi
+
   # Build and verify RPM package
   rpm-build-install:
     name: RPM package build and install
@@ -469,11 +491,17 @@ jobs:
 
       - name: Install dnf
         run: |
-          sudo apt-get update && sudo apt-get install -y dnf
+          sudo apt-get update && sudo apt-get install -y dnf rpm
 
       - name: Build RPM package
         run: |
-          ./gradlew -i buildRpm
+          ./gradlew --parallel buildRpm \
+            -x test -x integrationTest \
+            -x rat \
+            -x checkstyleMain -x checkstyleTest -x checkstyleTestFixtures \
+            -x spotbugsMain -x spotbugsTest \
+            -x javadoc \
+            -x asciidoctor -x copyDocs
 
       - name: Install RPM package
         run: |
@@ -487,6 +515,23 @@ jobs:
           test -f /opt/apache-cassandra-sidecar/LICENSE.txt
           test -f /opt/apache-cassandra-sidecar/lib/cassandra-sidecar-*.jar
 
+      - name: Verify RPM package version
+        run: |
+          EXPECTED_VERSION=$(grep "^version=" gradle.properties | cut -d'=' 
-f2 | tr '-' '~')
+          RPM_FILE=$(ls build/distributions/apache-cassandra-sidecar*.rpm | 
head -n1)
+          echo "Querying: ${RPM_FILE}"
+          ACTUAL_VERSION=$(rpm -qp --queryformat '%{VERSION}' "${RPM_FILE}")
+          ACTUAL_RELEASE=$(rpm -qp --queryformat '%{RELEASE}' "${RPM_FILE}")
+          echo "RPM: version=${ACTUAL_VERSION}, release=${ACTUAL_RELEASE}, 
expected=${EXPECTED_VERSION}"
+          if [ -z "${ACTUAL_RELEASE}" ] || [ "${ACTUAL_RELEASE}" = "(none)" ]; 
then
+            echo "RPM Release is empty — yields trailing '-' in 'yum list'"
+            exit 1
+          fi
+          if [ "${ACTUAL_VERSION}" != "${EXPECTED_VERSION}" ]; then
+            echo "RPM Version mismatch: expected '${EXPECTED_VERSION}', got 
'${ACTUAL_VERSION}'"
+            exit 1
+          fi
+
   # Build Docker image
   docker-build:
     name: Docker build
diff --git a/CHANGES.txt b/CHANGES.txt
index a26611c5..707df09c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 0.5.0
 -----
+ * RPM package is created with wrong version (CASSSIDECAR-472)
  * Define storage provider interface and Cassandra implementation to support 
durable job tracking (CASSSIDECAR-373)
  * Validate snapshot name during list snapshot (CASSSIDECAR-461)
 
diff --git a/build.gradle b/build.gradle
index ce310879..ef72ff8f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -381,6 +381,7 @@ gradle.taskGraph.whenReady { taskGraph ->
 ospackage {
     packageName = "apache-cassandra-sidecar"
     version = project.version
+    release = "1"
     // ospackage puts packages into /opt/[package] by default
     // which is _technically_ the right spot for packages
     link("/usr/local/bin/cassandra-sidecar", 
"/opt/${packageName}/bin/cassandra-sidecar")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to