Skip to content

Commit

Permalink
feat(ci): use automq version along with kafka version (#723)
Browse files Browse the repository at this point in the history
* feat(ci): use automq version along with kafka version

Signed-off-by: Curtis Wan <[email protected]>

* fix: get project version

Signed-off-by: Curtis Wan <[email protected]>

* fix: get project version

Signed-off-by: Curtis Wan <[email protected]>

* feat(ci): add prefix

Signed-off-by: Curtis Wan <[email protected]>

* fix: tgz name

Signed-off-by: Curtis Wan <[email protected]>

* fix: remove base scala version

Signed-off-by: Curtis Wan <[email protected]>

---------

Signed-off-by: Curtis Wan <[email protected]>
mooc9988 authored Jan 25, 2024

Verified

This commit was signed with the committer’s verified signature.
rexut Stephan Linz
1 parent ebcd7ab commit 8c631fa
Showing 5 changed files with 20 additions and 31 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -16,10 +16,6 @@ jobs:
permissions:
contents: write
steps:
- name: Get real Kafka version
id: get_real_version
run: |
echo "KAFKA_VERSION=$(echo ${{ github.ref_name }} | cut -d'-' -f1)" >> $GITHUB_OUTPUT
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.jdk }}
@@ -28,20 +24,21 @@ jobs:
java-version: ${{ matrix.jdk }}
distribution: "zulu"
- name: Setup Gradle
uses: gradle/[email protected]
uses: gradle/[email protected]
- name: Get project version
id: get_project_version
run: |
project_version=$(./gradlew properties | grep "version:" | awk '{print $2}')
echo "PROJECT_VERSION=${project_version}" >> $GITHUB_OUTPUT
- name: Build TarGz
run: |
./gradlew --build-cache --refresh-dependencies clean releaseTarGz
- name: Rename TarGz
run: |
mv ./core/build/distributions/kafka_2.13-${{ steps.get_real_version.outputs.KAFKA_VERSION }}.tgz ./core/build/distributions/kafka_2.13-${{ github.ref_name }}.tgz
mv ./core/build/distributions/kafka_2.13-${{ steps.get_real_version.outputs.KAFKA_VERSION }}-site-docs.tgz ./core/build/distributions/kafka_2.13-${{ github.ref_name }}-site-docs.tgz
./gradlew -Pprefix=automq-${{ github.ref_name }}_ --build-cache --refresh-dependencies clean releaseTarGz
# docker image release
- name: Cp TarGz to Docker Path
run: |
cp ./core/build/distributions/kafka_2.13-${{ github.ref_name }}.tgz ./docker/
cp ./core/build/distributions/automq-${{ github.ref_name }}_kafka-${{ steps.get_project_version.outputs.PROJECT_VERSION }}.tgz ./docker/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
14 changes: 3 additions & 11 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -16,10 +16,6 @@ jobs:
permissions:
contents: write
steps:
- name: Get real Kafka version
id: get_real_version
run: |
echo "KAFKA_VERSION=$(echo ${{ github.ref_name }} | cut -d'-' -f1)" >> $GITHUB_OUTPUT
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.jdk }}
@@ -28,20 +24,16 @@ jobs:
java-version: ${{ matrix.jdk }}
distribution: "zulu"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.9.0
uses: gradle/gradle-build-action@v2.12.0

- name: Build TarGz
run: |
./gradlew --build-cache --refresh-dependencies clean releaseTarGz
- name: Rename TarGz
run: |
mv ./core/build/distributions/kafka_2.13-${{ steps.get_real_version.outputs.KAFKA_VERSION }}.tgz ./core/build/distributions/kafka_2.13-${{ github.ref_name }}.tgz
mv ./core/build/distributions/kafka_2.13-${{ steps.get_real_version.outputs.KAFKA_VERSION }}-site-docs.tgz ./core/build/distributions/kafka_2.13-${{ github.ref_name }}-site-docs.tgz
./gradlew -Pprefix=automq-${{ github.ref_name }}_ --build-cache --refresh-dependencies clean releaseTarGz
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
draft: false
generate_release_notes: true
files: |
./core/build/distributions/kafka_*.tgz
./core/build/distributions/automq-*.tgz
6 changes: 0 additions & 6 deletions automq_release.py
Original file line number Diff line number Diff line change
@@ -140,12 +140,6 @@ def do_release(tag_version):
cmd("Checking out to release branch", 'git checkout -b %s' % new_branch)
print("Updating version numbers")
release_version = tag_version.split("-")[0]
replace("gradle.properties", "version", "version=%s" % release_version)

print("updating E2E settings")
replace("tests/kafkatest/__init__.py", "__version__", "__version__ = '%s'" % release_version)
regexReplace("./tests/kafkatest/version.py", "^DEV_VERSION =.*",
"DEV_VERSION = KafkaVersion(\"%s-SNAPSHOT\")" % release_version)

print("updating docker compose")
regexReplace("docker/docker-compose.yaml", "image: automqinc/kafka:.*$", "image: automqinc/kafka:%s" % tag_version)
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1144,15 +1144,21 @@ project(':core') {
':connect:runtime:genConnectMetricsDocs', ':connect:runtime:genConnectOpenAPIDocs',
':connect:mirror:genMirrorSourceConfigDocs', ':connect:mirror:genMirrorCheckpointConfigDocs',
':connect:mirror:genMirrorHeartbeatConfigDocs'], type: Tar) {
def prefix = project.findProperty('prefix') ?: ''
archiveBaseName = "${prefix}kafka"

archiveClassifier = 'site-docs'
compression = Compression.GZIP
from project.file("$rootDir/docs")
into 'site-docs'
into "${prefix}kafka-${archiveVersion.get()}-site-docs"
duplicatesStrategy 'exclude'
}

tasks.create(name: "releaseTarGz", dependsOn: configurations.archives.artifacts, type: Tar) {
into "kafka_${versions.baseScala}-${archiveVersion.get()}"
def prefix = project.findProperty('prefix') ?: ''
archiveBaseName = "${prefix}kafka"

into "${prefix}kafka-${archiveVersion.get()}"
compression = Compression.GZIP
from(project.file("$rootDir/bin")) { into "bin/" }
from(project.file("$rootDir/config")) { into "config/" }
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
AWS_DEFAULT_REGION=us-east-1 \
KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseZGC -XX:ZCollectionInterval=5"

COPY "./kafka_*.tgz" /opt/kafka/kafka.tgz
COPY "./automq-*.tgz" /opt/kafka/kafka.tgz
RUN tar -xzvf "/opt/kafka/kafka.tgz" -C /opt/kafka/ --one-top-level=kafka --strip-components 1 && rm "/opt/kafka/kafka.tgz"
COPY scripts /opt/kafka/scripts
RUN chmod +x /opt/kafka/scripts/*.sh

0 comments on commit 8c631fa

Please sign in to comment.