Skip to content

Commit

Permalink
Add Cassandra 4.1 support (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 authored Oct 12, 2022
1 parent 6500631 commit bcd25c7
Show file tree
Hide file tree
Showing 13 changed files with 2,706 additions and 13 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
cassandra-version: ['4.0', '4.1']
include:
- cassandra-version: '4.1'
set-version: true
runs-on: ubuntu-latest

steps:
Expand All @@ -18,7 +25,15 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B package -DskipTests --file pom.xml
- name: run tests
- if: ${{ !matrix.set-version }}
name: Build with Maven (Cassandra 4.0 and lower)
run: mvn -B clean package -DskipTests --file pom.xml
- if: ${{ !matrix.set-version }}
name: run tests (Cassandra 4.0 and lower)
run: mvn -B test --file pom.xml
- if: ${{ matrix.set-version }}
name: Build with Maven (Cassandra 4.1 and newer)
run: mvn -B clean package -DskipTests --file pom.xml -Dcassandra.version=4.1-beta1
- if: ${{ matrix.set-version }}
name: run tests (Cassandra 4.1 and newer)
run: mvn -B test --file pom.xml -Dcassandra.version=4.1-beta1
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
RELEASE_VERSION="${RELEASE_VERSION:1}"
./make_package.sh "$RELEASE_VERSION"
./make_package.sh "$RELEASE_VERSION" 4.1-beta1
cd package-${RELEASE_VERSION}
assets=()
for asset in *.{gz,zip}; do
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ venv
.classpath
target
.vscode
dependency-reduced-pom.xml
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ workload and dashboards connected to kick the tires.
1. Download the [latest release](https://github.com/datastax/metric-collector-for-apache-cassandra/releases/latest) of the agent onto your Cassandra nodes.
The archive is self contained so no need do anything other than `tar -zxf latest.tar.gz`
into any location you prefer like `/usr/local` or `/opt`.

**NOTE:** For Cassandra 4.1.x and newer, you will need to use the release bundle with `-4.1-beta1` appended.
For Cassandra 4.0.x and lower, you will need to use the release bundle without the extra prefix.
See [below](#cassandra-version-supported) for more.

2. Add the following line into the `cassandra-env.sh` file:

Expand Down Expand Up @@ -81,7 +85,12 @@ workload and dashboards connected to kick the tires.

## Cassandra version supported:

The supported versions of Apache Cassandra: 2.2+ (2.2.X, 3.0.X, 3.11.X, 4.0)
The supported versions of Apache Cassandra: 2.2+ (2.2.X, 3.0.X, 3.11.X, 4.0, 4.1)

**NOTE:** There is a different install bundle for the agent for Cassandra 4.1 and newer.
For Cassandra 4.0.x and older, use the bundles without the `-4.1-beta1` suffix.
For Cassandra 4.1.x and newer, use the bundles with the `-4.1-beta1` suffix.
The Dashboard bundles can be used with any version of Cassandra.

## Kubernetes Support
Check out the [dashboards/k8s-build](dashboards/k8s-build) directory for a guide on using this project along with Kubernetes.
Expand Down
10 changes: 6 additions & 4 deletions make_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ if [ "$VERSION" == "" ]; then
exit 1
fi

PACKAGE_DIR=package-$VERSION
PROJECT_DIR_NAME=datastax-mcac-agent-$VERSION

OPTIONAL_MVN_ARGS=""
if [ -n "$CASSANDRA_VERSION" ]; then
OPTIONAL_MVN_ARGS="${OPTIONAL_MVN_ARGS} -Dcassandra.version=${CASSANDRA_VERSION}"
# make a different package for the specific Cassandra version
PROJECT_DIR_NAME=datastax-mcac-agent-$VERSION-${CASSANDRA_VERSION}
fi
if [ -n "$BUILD_PROFILE" ]; then
OPTIONAL_MVN_ARGS="${OPTIONAL_MVN_ARGS} --activate-profiles=${BUILD_PROFILE}"
fi

PACKAGE_DIR=package-$VERSION
PROJECT_DIR_NAME=datastax-mcac-agent-$VERSION

mkdir $PACKAGE_DIR
mkdir -p $PACKAGE_DIR

mvn -DskipTests clean package -Drevision=$VERSION $OPTIONAL_MVN_ARGS
mkdir -p $PACKAGE_DIR/$PROJECT_DIR_NAME/config
Expand Down
Binary file removed package-0.3.0/datastax-mcac-agent-0.3.0.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<name>DataStax Metrics Collector for Apache Cassandra</name>

<properties>
<revision>0.2.0</revision>
<revision>0.3.3</revision>
<dropwizard.version>1.0.2</dropwizard.version>
<!-- <cassandra.version>4.0-beta4</cassandra.version> -->
<cassandra.version>3.11.10</cassandra.version>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/build_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.3
10 changes: 9 additions & 1 deletion src/test/java/com/datastax/mcac/BaseIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ public abstract class BaseIntegrationTest
protected final String version;
protected static DockerHelper docker;

@Parameterized.Parameters
@Parameterized.Parameters(name = "{0}")
public static Iterable<String[]> functions()
{
String cassandraVersion = System.getProperty("cassandra.version");
if (cassandraVersion != null && cassandraVersion.startsWith("4.1"))
{
String[] versions = new String[]{"4.1"};
ArrayList<String[]> list = new ArrayList<>(1);
list.add(versions);
return list;
}
return Lists.newArrayList(
new String[]{"4.0"},
new String[]{"3.11"},
Expand Down
Loading

0 comments on commit bcd25c7

Please sign in to comment.