operator-framework / operator-framework/java-operator-sdk

Colliding root-level version.properties can misreport the SDK version

オープン
#3,627 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Java
スター
944
フォーク
242
平均マージ
1日 4時間
マージ済み PR(30日)
43

説明

Bug Report

What did you do?

Built an operator as a single shaded jar depending on both io.javaoperatorsdk:operator-framework-core (5.6.1) and io.javaoperatorsdk:kubernetes-webhooks-framework-core (3.0.4). Both artifacts generate a root-level version.properties via the git-commit-id-maven-plugin, so the two files collide at the same jar entry path.

What did you expect to see?

The operator startup log reports operator-framework-core's commit id and build time, which Utils.loadFromProperties() reads from version.properties.

What did you see instead? Under which circumstances?

ClassLoader.getResourceAsStream returns the first match, so Utils can silently report the webhooks framework's commit id and build time as the SDK version. This only surfaces when the jars are merged into one (or the classpath puts the webhooks jar first), which is probably why it went unnoticed: setups that keep the jars separate, such as Quarkus, usually resolve the operator-framework-core copy first.

Possible Solution

Give each artifact a uniquely named properties file:

  • operator-framework-core: operator-sdk-version.properties, updating the lookup in Utils.loadFromProperties() (its only reader)
  • kubernetes-webhooks-framework-core: for example kubernetes-webhooks-framework-version.properties (nothing reads it today, so it is only a rename); I can file a companion issue there

Happy to contribute PRs (for both repos if needed).

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Utils.loadFromProperties() と version.properties を作成する git-commit-id-maven-plugin の設定を探します。operator-framework-core のリソース名を変更してその検索処理を更新し、続いて両方の framework アーティファクトを含む shaded jar をビルドし、起動ログに operator framework の commit id と build time が出力されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, kubernetes
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
72/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。