Skip to content

Commit dca9f7d

Browse files
committed
Build against custom lettuce version
1 parent b5b4f22 commit dca9f7d

File tree

4 files changed

+142
-26
lines changed

4 files changed

+142
-26
lines changed

.github/workflows/integration.yaml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,51 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- name: Checkout repository
14+
- name: Checkout lettuce-test-app repository
1515
uses: actions/checkout@v4
16+
with:
17+
path: lettuce-test-app
18+
19+
- name: Checkout lettuce-core custom branch
20+
uses: actions/checkout@v4
21+
with:
22+
repository: redis/lettuce
23+
ref: feature/maintenance-events
24+
path: lettuce-core
1625

1726
- name: Set up JDK 17
1827
uses: actions/setup-java@v3
1928
with:
2029
distribution: 'temurin'
2130
java-version: '17'
22-
cache: 'maven' # Caches dependencies to speed up builds
31+
cache: 'maven'
32+
33+
- name: Build and install custom lettuce-core
34+
working-directory: lettuce-core
35+
run: |
36+
echo "Building REQUIRED custom lettuce-core from feature/maintenance-events branch"
37+
mvn versions:set -DnewVersion=7.0.0.MAINT-SNAPSHOT
38+
mvn -B clean install -DskipTests
39+
echo "Custom lettuce-core 7.0.0.MAINT-SNAPSHOT installed to local repository"
40+
41+
- name: Verify lettuce-core installation
42+
working-directory: lettuce-core
43+
run: |
44+
echo "Verifying lettuce-core installation:"
45+
ls -la ~/.m2/repository/io/lettuce/lettuce-core/7.0.0.MAINT-SNAPSHOT/
46+
2347
- name: Check code formatting
48+
working-directory: lettuce-test-app
2449
run: mvn formatter:validate
25-
- name: Build and verify
26-
run: mvn -B clean verify
50+
51+
- name: Build and verify lettuce-test-app with REQUIRED custom lettuce-core
52+
working-directory: lettuce-test-app
53+
run: |
54+
echo "Building lettuce-test-app with REQUIRED custom lettuce-core version 7.0.0.MAINT-SNAPSHOT"
55+
mvn -B clean verify -Dlettuce.version=7.0.0.MAINT-SNAPSHOT
56+
57+
- name: Run integration tests
58+
working-directory: lettuce-test-app
59+
run: |
60+
echo "Running integration tests with REQUIRED custom lettuce-core"
61+
mvn test -Dlettuce.version=7.0.0.MAINT-SNAPSHOT

README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@
22

33
A workload runner for testing Lettuce client fault tolerance against Redis database upgrades.
44

5+
> **⚠️ IMPORTANT**: This project requires a custom build of lettuce-core from the `feature/maintenance-events` branch. Use `./scripts/build.sh` to build the project correctly.
6+
57
## Build
68

9+
> **⚠️ IMPORTANT**: This project REQUIRES a custom build of lettuce-core from the `feature/maintenance-events` branch to function properly. The standard lettuce-core release will not work.
10+
11+
### Building the Project
12+
13+
Use the provided build script to automatically build and install the required custom lettuce-core version:
14+
715
```sh
8-
mvn clean package
16+
./scripts/build.sh
917
```
18+
19+
The build script will:
20+
1. Clone the lettuce-core repository from the `feature/maintenance-events` branch
21+
2. Build and install the custom lettuce-core version (7.0.0.MAINT-SNAPSHOT) to your local Maven repository
22+
3. Build and test the lettuce-test-app using the custom lettuce-core version
23+
24+
### CI/CD Integration
25+
The GitHub Actions workflow automatically builds with the custom lettuce-core version from the `feature/maintenance-events` branch. See `.github/workflows/integration.yaml` for details.
1026
## Usage
1127
Basic usage with specified runner configuration file and custom log directory:
1228
```sh
@@ -144,30 +160,17 @@ Example query for visualising throughput per second of get on 10s window
144160
| `redis.command.errors` | Counter | Counts the number of failed Redis command API calls that completed with an exception. | `command`: Redis command (e.g., `GET`, `SET`) |
145161

146162
### Lettuce App Custom Metrics
147-
Modified version of lettuce with additional metrics is available at [lettuce-metrics](https://github.com/ggivo/lettuce/tree/lettuce-observability)
148-
To use this version, you need to build the project and replace the lettuce version in the `pom.xml` file with the built jar file.
163+
This project uses a modified version of lettuce-core with additional metrics from the `feature/maintenance-events` branch.
164+
165+
**Building with Custom Lettuce-Core:**
166+
The build script automatically handles building and using the required custom lettuce-core version:
149167

150-
**Steps to build and replace the lettuce jar file:**
151-
```shell
152-
git clone -b lettuce-observability https://github.com/ggivo/lettuce/ lettuce-observability
153-
cd lettuce-observability
154-
mvn clean install -DskipTests
155-
```
156-
Write down the version of the built jar file. It will be used in the next step.
157-
158-
**Make sure lettuce version in the `pom.xml` file is updated to the built jar file.**
159-
```xml
160-
<dependency>
161-
<groupId>io.lettuce</groupId>
162-
<artifactId>lettuce-core</artifactId>
163-
<version>{PROVIDE_CUSTOM_LETTUCE_VERSION}</version>
164-
</dependency>
165-
```
166-
**Last step is to build the lettuce-test-app with the updated lettuce jar file.**
167168
```shell
168-
mvn clean package
169+
./scripts/build.sh
169170
```
170171

172+
This is the only supported way to build the project, as it requires the custom lettuce-core implementation.
173+
171174
Additional metrics aer enabled/disabled via configuration property in the `runner-config.yaml` file:
172175
```yaml
173176
runner:

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<properties>
1818
<java.version>17</java.version>
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
<lettuce.version>7.0.0.MAINT-SNAPSHOT</lettuce.version>
2021
</properties>
2122

2223
<repositories>
@@ -77,7 +78,7 @@
7778
<dependency>
7879
<groupId>io.lettuce</groupId>
7980
<artifactId>lettuce-core</artifactId>
80-
<version>7.0.0-SNAPSHOT</version>
81+
<version>${lettuce.version}</version>
8182
</dependency>
8283
<dependency>
8384
<groupId>com.fasterxml.jackson.dataformat</groupId>

scripts/build.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
# Script to build lettuce-test-app with REQUIRED custom lettuce-core from feature/maintenance-events branch
4+
# This project REQUIRES the custom lettuce-core build to function properly
5+
# Usage: ./scripts/build.sh
6+
7+
set -e
8+
9+
# Configuration
10+
LETTUCE_REPO="https://github.com/redis/lettuce.git"
11+
LETTUCE_BRANCH="feature/maintenance-events"
12+
LETTUCE_VERSION="7.0.0.MAINT-SNAPSHOT"
13+
TEMP_DIR="$(mktemp -d)"
14+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
16+
17+
echo "=========================================="
18+
echo "Building lettuce-test-app with REQUIRED custom lettuce-core"
19+
echo "=========================================="
20+
echo "Lettuce repository: $LETTUCE_REPO"
21+
echo "Lettuce branch: $LETTUCE_BRANCH"
22+
echo "Lettuce version: $LETTUCE_VERSION"
23+
echo "Temp directory: $TEMP_DIR"
24+
echo "Project root: $PROJECT_ROOT"
25+
echo "=========================================="
26+
27+
# Function to cleanup temp directory
28+
cleanup() {
29+
echo "Cleaning up temporary directory: $TEMP_DIR"
30+
rm -rf "$TEMP_DIR"
31+
}
32+
trap cleanup EXIT
33+
34+
# Step 1: Clone lettuce-core repository
35+
echo "Step 1: Cloning lettuce-core repository..."
36+
cd "$TEMP_DIR"
37+
git clone --branch "$LETTUCE_BRANCH" --depth 1 "$LETTUCE_REPO" lettuce-core
38+
cd lettuce-core
39+
40+
# Step 2: Build and install custom lettuce-core
41+
echo "Step 2: Building and installing custom lettuce-core..."
42+
echo "Setting version to $LETTUCE_VERSION"
43+
mvn versions:set -DnewVersion="$LETTUCE_VERSION" -DgenerateBackupPoms=false
44+
45+
echo "Building and installing lettuce-core..."
46+
mvn clean install -DskipTests -B
47+
48+
echo "Verifying installation..."
49+
if [ -d "$HOME/.m2/repository/io/lettuce/lettuce-core/$LETTUCE_VERSION" ]; then
50+
echo "✅ Custom lettuce-core $LETTUCE_VERSION successfully installed"
51+
ls -la "$HOME/.m2/repository/io/lettuce/lettuce-core/$LETTUCE_VERSION/"
52+
else
53+
echo "❌ Failed to install custom lettuce-core"
54+
exit 1
55+
fi
56+
57+
# Step 3: Build lettuce-test-app with custom version
58+
echo "Step 3: Building lettuce-test-app with custom lettuce-core..."
59+
cd "$PROJECT_ROOT"
60+
61+
echo "Checking code formatting..."
62+
mvn formatter:validate
63+
64+
echo "Building lettuce-test-app with lettuce.version=$LETTUCE_VERSION..."
65+
mvn clean verify -Dlettuce.version="$LETTUCE_VERSION" -B
66+
67+
echo "Running tests..."
68+
mvn test -Dlettuce.version="$LETTUCE_VERSION"
69+
70+
echo "=========================================="
71+
echo "✅ Successfully built lettuce-test-app with custom lettuce-core $LETTUCE_VERSION"
72+
echo "=========================================="
73+
echo ""
74+
echo "To run the application with the custom lettuce-core version:"
75+
echo " java -jar target/lettuce-test-app-0.0.1-SNAPSHOT.jar"
76+
echo ""java -jar target/lettuce-test-app-0.0.1-SNAPSHOT.jar
77+
echo "=========================================="

0 commit comments

Comments
 (0)