Skip to content

Ephemeral CI

Ephemeral CI #103

Workflow file for this run

name: K8s CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-k8s-cluster:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
- name: Build Local Target Docker Images
run: |
docker pull eclipse-temurin:25-jre
./gradlew jibDockerBuild -PjibDockerOnBuild=true
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.10.0
with:
cluster_name: kind
- name: Load local images into Kind
run: |
kind load docker-image aeroncache-cluster:latest --name kind
kind load docker-image aeroncache-http-clustertools:latest --name kind
kind load docker-image aeroncache-http:latest --name kind
kind load docker-image aeroncache-ws:latest --name kind
kind load docker-image aeroncache-sse:latest --name kind
kind load docker-image aeroncache-http-near:latest --name kind
kind load docker-image aeroncache-gateway:latest --name kind
- name: Install Backend Helm Charts
working-directory: ./k8s/helm
run: |
# The kind action creates cluster but sometimes local default namespaces need a moment
make install-backend
- name: Verify Cluster Component Readiness (Wait)
run: |
echo "Waiting for all pods to be in the Ready state..."
sleep 10
kubectl wait -n aeroncache --for=condition=ready pod --all --timeout=300s
- name: Port-forward Cache Interfaces
run: |
# Expose the clustered interface services on localhost so the integration suite can reach
# them. Ports match the standard interface ports the tests default to (see BackendTestLauncher).
kubectl port-forward -n aeroncache svc/aeroncache-http 7070:7070 &
kubectl port-forward -n aeroncache svc/aeroncache-ws 7071:7071 &
kubectl port-forward -n aeroncache svc/aeroncache-sse 7072:7072 &
kubectl port-forward -n aeroncache svc/aeroncache-http-near 7073:7073 &
sleep 5 # give port-forwarding a moment to establish
echo "Port-forwards established for http/ws/sse/http-near."
- name: Smoke Pre-Gate (fast fail before the full suite)
run: |
# A minimal create/put/get against the live HTTP interface, so an unhealthy deployment fails
# fast and clearly before we spend time launching the full integration suite.
echo "Checking liveness endpoint..."
curl --fail --retry 5 --retry-delay 3 --retry-connrefused http://localhost:7070/liveness/ || exit 1
echo -e "\nChecking readiness endpoint..."
curl --fail --retry 5 --retry-delay 3 --retry-connrefused http://localhost:7070/readiness/ || exit 1
echo -e "\nCreating cache..."
curl -s --fail -X POST http://localhost:7070/api/v1/cache \
-H 'Content-Type: application/json' \
-d '{"cacheId": "smoke-test-cache"}' || exit 1
echo -e "\nPutting item into cache..."
curl -s --fail -X POST http://localhost:7070/api/v1/cache/smoke-test-cache \
-H 'Content-Type: application/json' \
-d '{"key": "testKey", "value": "testValue"}' || exit 1
echo -e "\nRetrieving item from cache..."
RESPONSE=$(curl -s --fail -X GET http://localhost:7070/api/v1/cache/smoke-test-cache/testKey)
echo "Response: $RESPONSE"
if [[ "$RESPONSE" != *"testValue"* ]]; then
echo "Smoke pre-gate failed: Returned item value did not match 'testValue'."
exit 1
fi
echo -e "\nSmoke pre-gate passed. Running the full integration suite against the cluster..."
- name: Run Integration Suite Against Cluster
# Reuse the existing clustered integration suites against the already-running kind deployment.
# externalEnv=true makes BackendTestLauncher target the port-forwarded interfaces instead of
# starting TestContainers. Suites are limited to those matching the deployed topology
# (clustered/RAFT, static caches); shutdown/restart and dynamic-cache suites are excluded.
# timeout-minutes bounds the job so a blocked test can't run until the GitHub 6h limit; the
# per-test STARTED logging (enabled by externalEnv) then names the last test to start.
timeout-minutes: 25
run: |
./gradlew --console=plain --continue \
:cache-integration:clustered:http-integration-tests:test \
:cache-integration:clustered:http-near-integration-tests:test \
:cache-integration:clustered:ws-integration-tests:test \
:cache-integration:clustered:sse-integration-tests:test \
:cache-integration:clustered:multistream-integration-tests:test \
-PskipIntegrationTests=false \
-Daeroncache.integration.externalEnv=true
- name: Upload Integration Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: helm-ci-integration-test-reports
path: '**/build/reports/tests/test/'
if-no-files-found: ignore
- name: Debug cluster state on failure
if: failure()
run: |
echo "===== Nodes ====="
kubectl get nodes
echo "===== Pods ====="
kubectl get pods -A
echo "===== Events ====="
kubectl get events -n aeroncache --sort-by='.metadata.creationTimestamp'
echo "===== Pod Logs ====="
kubectl logs -n aeroncache -l app.kubernetes.io/name=aeroncache-cluster --tail=200 || true