Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2

- name: cache
uses: actions/cache@v4
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # 5.0.5
with:
path: |
~/.gradle/caches
Expand All @@ -21,16 +22,18 @@ jobs:
caches-

- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # 5.2.0
with:
distribution: 'temurin'
java-version: 21
java-version: 25
- name: Verify Gradle
uses: gradle/actions/wrapper-validation@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0

- name: Build with Gradle
run: ./gradlew build

- name: Upload-Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: artifact
path: build/libs/
Expand All @@ -49,27 +52,27 @@ jobs:
run: |
echo IMAGE_TAG=$([ "$GITHUB_REF" = "refs/heads/master" ] && echo "latest" || ([ "$GITHUB_EVENT_NAME" = 'pull_request' ] && echo pr-${{github.event.pull_request.number}} || echo ${GITHUB_REF##*/})) >> $GITHUB_ENV
echo IMAGE_NAME=${GITHUB_REPOSITORY,,} >>${GITHUB_ENV}

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
with:
name: artifact
path: build/libs/

- name: Copy build file
run: cp build/libs/galaxy-proxy-1.0-SNAPSHOT.jar docker/plugins

- name: Log in to the Container registry
uses: docker/login-action@v3
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # 4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build
run: docker build --build-arg BUILDKIT_INLINE_CACHE=1 --pull --cache-from $REGISTRY/$IMAGE_NAME:latest -t $REGISTRY/$IMAGE_NAME:$IMAGE_TAG .

- name: push
run: docker push $REGISTRY/$IMAGE_NAME:$IMAGE_TAG
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#syntax=docker/dockerfile:1
FROM eclipse-temurin:21-jre-alpine
FROM eclipse-temurin:25-jre-alpine
RUN apk add --no-cache bash
RUN mkdir /app && chown 1000:100 /app
USER 1000
Expand All @@ -8,7 +8,7 @@ WORKDIR /app
COPY --chown=1000 --link docker /app

# Download Velocity
ADD --chown=1000 --checksum=sha256:ef1a852bfae7397e84907837925e7ad21c6312066290edaae401b77f6f423ac3 --link https://fill-data.papermc.io/v1/objects/ef1a852bfae7397e84907837925e7ad21c6312066290edaae401b77f6f423ac3/velocity-3.4.0-SNAPSHOT-558.jar /app/velocity.jar
ADD --chown=1000 --checksum=sha256:25bfbee6155fbce24f709bf18f1bb915817c4151d6d418ca01282742ab1f123a --link https://fill-data.papermc.io/v1/objects/25bfbee6155fbce24f709bf18f1bb915817c4151d6d418ca01282742ab1f123a/velocity-3.5.0-SNAPSHOT-593.jar /app/velocity.jar

# Run Server
EXPOSE 25565
Expand Down
20 changes: 10 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "2.3.0"
kotlin("kapt") version "2.3.0"
id("com.gradleup.shadow") version "9.3.0"
kotlin("jvm") version "2.3.20"
kotlin("kapt") version "2.3.20"
id("com.gradleup.shadow") version "9.4.1"
}

group = "one.oktw"
Expand All @@ -22,19 +22,19 @@ repositories {
}

dependencies {
kapt("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
implementation("io.fabric8:kubernetes-client:7.4.0")
implementation("io.fabric8:kubernetes-httpclient-okhttp:7.4.0")
kapt("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
compileOnly("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
implementation("io.fabric8:kubernetes-client:7.6.1")
implementation("io.fabric8:kubernetes-httpclient-okhttp:7.6.1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

由於專案在 shadowJar 任務中啟用了 minimize() 功能(見第 48 行),建議將 io.fabric8:kubernetes-httpclient-okhttp 也加入排除名單。Fabric8 的 HTTP 客戶端實作通常是透過 ServiceLoader 機制動態載入的,若未顯式排除,最小化過程會因偵測不到直接引用而將其移除,導致程式執行時出現 No HTTP client implementation found 錯誤。

implementation("com.github.fkorotkov:k8s-kotlin-dsl:3.5.0")
implementation("io.lettuce:lettuce-core:6.8.2.RELEASE")
implementation("io.lettuce:lettuce-core:7.5.1.RELEASE")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Lettuce 官方自 6.0 版本起已停止在版本號中使用 .RELEASE 後綴。建議移除此後綴以符合目前的版本命名規範,並避免未來潛在的依賴解析問題。

    implementation("io.lettuce:lettuce-core:7.5.1")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gemini-code-assist 有來源嗎,我目前在最新版本中仍看到 .RELEASE 字樣

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

您說得對,Lettuce 確實仍在發布帶有 .RELEASE 後綴的版本(例如您提到的 7.5.1.RELEASE)。

我之前的建議是基於 Lettuce 專案在 GitHub Release 頁面 上逐漸減少使用該後綴的趨勢,以及許多現代 Java 專案傾向於簡化版本號的慣例。不過,既然官方 Maven 倉庫中確實存在 7.5.1.RELEASE,保留該後綴是完全正確且安全的做法,不會影響依賴解析。感謝您的指正。

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive")// lettuce need this
implementation("one.oktw:galaxy-lib:2235da5")
implementation("one.oktw:galaxy-lib:9546e40")
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
jvmTarget = JvmTarget.JVM_25
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.