Skip to content

DBZ-3226: Add step to verify the Debezium-server distribution #350

DBZ-3226: Add step to verify the Debezium-server distribution

DBZ-3226: Add step to verify the Debezium-server distribution #350

Workflow file for this run

#
# Copyright Debezium Authors
#
# Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
#
# Cross CI workflow is triggered on a `pull_request` event.
# It builds the Debezium core before building the Debezium Server basing on either the `main` branch or the `pull_request` branch.
# If a `pull_request` with same branch name is present in the Debezium's upstream core repository, then the core build of this `pull_request`
# will be based on `pull_request` branch of user's Debezium core repository.
# Otherwise the core build of this `pull_request` will be based on the `main` branch of Debezium's upstream core repository.
name: Cross Maven CI
on:
pull_request:
branches:
- main
- 1.*
- 2.*
paths-ignore:
- '*.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Debezium Server repository
uses: actions/checkout@v4
with:
path: server
- name: Check if pull request branch exists in debezium main repository
id: branch
env:
branch_name: ${{ github.head_ref }}
run: |
curl --silent -X "GET" https://api.github.com/repos/debezium/debezium/pulls | jq '.[] | {branch: .head.ref}' | jq -r '.branch' >> SORTED_PULLS.txt
while IFS=" " read -r BRANCH;
do
if grep -q "$branch_name" <<< "$BRANCH"; then
echo "BRANCH_FOUND=true" >> $GITHUB_OUTPUT
fi
done < SORTED_PULLS.txt
- name: Checkout core repository with pull request branch
if: ${{ steps.branch.outputs.BRANCH_FOUND == 'true' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.user.login }}/debezium
ref: ${{ github.head_ref }}
path: core
- name: Checkout core repository with default base branch
if: ${{ steps.branch.outputs.BRANCH_FOUND != 'true' }}
uses: actions/checkout@v4
with:
repository: debezium/debezium
ref: ${{ github.base_ref }}
path: core
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Maven build core
run: ./server/mvnw clean install -f core/pom.xml -DskipTests -DskipITs -Dformat.formatter.goal=validate -Dformat.imports.goal=check -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
- name: Maven build Debezium Server
run: ./server/mvnw clean install -fae -f server/pom.xml -Passembly -Dformat.formatter.goal=validate -Dformat.imports.goal=check -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -DskipNonCore
validate-distribution:
name: Verify debezium-server distribution
runs-on: ubuntu-latest
strategy:
matrix:
sink: [ redis ]
needs: build
steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkout Debezium Server repository
uses: actions/checkout@v4
- name: Validate sink '${{matrix.sink}}'
run: |
# Creating the distribution archives
DISTRIBUTION_FOLDER=./debezium-server-dist
SINK=${{matrix.sink}}
./mvnw clean package -DskipITs -DskipTests -Passembly
# Start Up dependant services
docker compose -f $DISTRIBUTION_FOLDER/src/test/resources/$SINK/docker-compose.yml up -d
# Copy configuration file
mkdir $DISTRIBUTION_FOLDER/target/config
cp $DISTRIBUTION_FOLDER/src/test/resources/$SINK/application.properties $DISTRIBUTION_FOLDER/target/config/application.properties
# Run debezium server at background
chmod +x $DISTRIBUTION_FOLDER/target/classes/distro/run.sh
docker run --name server-$SINK -d -v $DISTRIBUTION_FOLDER/target:/opt:z -p 8080:8080 --network debezium-backend -w /opt registry.access.redhat.com/ubi8/openjdk-21 /opt/classes/distro/run.sh
timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/q/health)" != "200" ]]; do sleep 5; done' || false
- name: Clean Up
if: always()
run: |
docker stop server-${{matrix.sink}}
docker compose -f ./debezium-server-dist/src/test/resources/${{matrix.sink}}/docker-compose.yml down