本文へ移動
cccskills
無料GitHub で公開日本語紹介

package

SkyWalkingの変更をテスト前に配布物とOAPのDockerイメージへ反映し、古いJARが残っていないか確認するビルド手順を案内します。

原文原文の説明を見る

Rebuild the SkyWalking distribution and OAP Docker image after source changes. Use before running e2e tests so the image reflects your code changes. Avoids the "image looks updated but runtime has stale jars" trap.

apache/skywalkingスター 24,978(GitHub 24,978 + cccskills 0)
連携ツールDocker

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • OAPの変更をDockerイメージに反映したいとき
  • E2Eテスト前にJARの更新を確認したいとき
  • 変更内容に合う再ビルド手順を選びたいとき

日本語での紹介

できること

SkyWalkingのソース変更を、配布用アーカイブとOAPのDockerイメージへ正しく反映するための手順を案内します。Javaコードを変更した場合は、まずflatten:flattenを含めて配布物を再ビルドし、その後にイメージを作成する流れを示します。変更内容に応じて、全体を作り直す方法、バックエンドだけを更新する方法、Dockerfileやentrypointだけを変更した場合の方法を選べます。イメージの作成時刻だけでは更新を判断できないため、コンテナ内のJARを取り出し、変更を示すクラスや文字列を確認する方法も扱います。

こんなときに便利

OAPのソースを直した後、E2Eテストを実行する前に修正がイメージへ入ったか確かめたい場合に向いています。配布用アーカイブ、JAR、Dockerイメージのどの段階を作り直すべきか迷うときや、ビルドは成功したのに実行時の動作が古いままという問題を調べるときにも役立ちます。

使い方の例

  • 「OAPの変更をE2Eテスト用イメージに反映する手順を教えて」
  • 「Dockerfileだけ変更した場合のビルド方法を教えて」
  • 「修正したクラスがイメージ内のJARに入ったか確認したい」

注意点

Maven Wrapper、Make、Docker Buildxを使います。Javaソース変更では配布物の再ビルドが必要です。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md5.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Package OAP Distribution & Docker Image

Rebuilding the Docker image after a source-code change has a two-step dependency: rebuild the dist tarball, then rebuild the image. Skipping the first step silently produces an image with stale jars — the Docker build still "succeeds," the image has a fresh timestamp, but the embedded jar is the one from your previous build.

Why this matters

make docker.oap in the root Makefile is defined as:

docker.% push.docker.%: $(CONTEXT)/$(DIST) $(SW_ROOT)/docker/%/*
    $(DOCKER_RULE)

It depends on $(CONTEXT)/$(DIST) (the dist tarball) as a file prerequisite. If that tarball already exists, make does not regenerate it — it just copies whatever is on disk into dist/docker_build/oap/ and runs docker buildx build. There is no dependency that rebuilds the tarball from source.

Only make docker triggers the full chain (init → build.all → docker.all). So:

CommandRebuilds source?Rebuilds tarball?Rebuilds image?
./mvnw -pl <module> packageonly that modulenono
./mvnw -pl apm-dist -am package -Pbackend,distall backend deps + distyesno
make docker.oapnono (uses whatever's on disk)yes
make dockeryes (build.all)yesyes (docker.all)

flatten:flatten — always run it before package/install

SkyWalking's poms use ${revision} as a placeholder version (e.g., 10.5.0-SNAPSHOT). The flatten-maven-plugin resolves ${revision} into concrete versions and writes a .flattened-pom.xml. Without it:

  • Installed artifacts carry the literal string ${revision} in their coordinates and cannot be resolved as dependencies.
  • Downstream modules (including apm-dist) see an inconsistent dependency graph.
  • Symptoms are subtle: -pl <module> -am may succeed in isolation but fail or pull in stale transitive artifacts when the same module is consumed by another build invocation in the same session.

Always run flatten:flatten in the same goal chain as package or install. The CI dist-tar job and the compile skill both do this. Example:

./mvnw clean flatten:flatten package -Pbackend,dist -DskipTests

Not optional — treat it as part of package.

Pick the right command

Changed OAP source → want a new image

# Recommended: full chain
make docker

or, faster and equivalent for backend-only changes (skips UI):

./mvnw -pl apm-dist -am -o clean flatten:flatten package -Pbackend,dist -DskipTests -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true
make docker.oap

Do not just run make docker.oap after a code edit — the image will look rebuilt but your change will not be in the jars. Do not skip flatten:flatten — see the section above.

Changed only the dist packaging (e.g., apm-dist/, log4j2.xml)

./mvnw -pl apm-dist -am -o clean flatten:flatten package -Pbackend,dist -DskipTests
make docker.oap

Changed only Dockerfile / entrypoint (docker/oap/*)

The tarball is untouched, so make docker.oap alone is correct:

make docker.oap

Verify the fix reached the image

Docker's "image created" timestamp updates even when the content is stale (because --no-cache is used). Don't trust the timestamp. Verify the jar contents directly:

# Copy the jar out of the container
docker cp <container-name>:/skywalking/oap-libs/<module>-<version>.jar /tmp/verify.jar

# Extract the specific class
cd /tmp && jar -xf verify.jar <path/to/YourClass.class>

# Grep for a string your fix introduced (unique literal, method name, etc.)
grep -oa "myFixSignature" <path/to/YourClass.class>

If grep finds nothing, the image does not contain your fix — you forgot to rebuild the dist. Re-run with the correct chain.

Common pitfalls

  • make docker.oap after ./mvnw package: The module jar is fresh in oap-server/.../target/, but the dist tarball at dist/apache-skywalking-apm-bin.tar.gz is untouched. Image uses the old jar.
  • Cancelling a make docker mid-flight: leaves the dist half-rebuilt. Re-run make docker or delete dist/ first.
  • Stale buildx cache: not usually the issue (the Makefile passes --no-cache), but if you suspect it, run docker buildx prune.
  • Trusting image timestamps: docker images shows when the image was tagged, not when its content actually changed. A no-op rebuild still updates the timestamp.
  • Interactive buildx hangs: if docker buildx build sits silent for minutes with no stdout, kill it and retry. The buildx container driver occasionally stalls; a restart is faster than waiting.

The golden rule

After any Java source edit that affects code shipped in oap-libs/, run one of:

  1. make docker (full, safest)
  2. ./mvnw -pl apm-dist -am -o package -Pbackend,dist -DskipTests -Dcheckstyle.skip=true && make docker.oap (fast)

Then verify the fix is in the image's jar before running e2e. Don't assume.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

ci-e2e-debug

無料概要あり

GitHub Actions のE2Eテストが失敗したとき、実行ログを取得して各コンポーネントのエラーを調べ、原因を整理するスキルです。

  • GitHub ActionsのE2E失敗を調べたいとき
  • OAPや各コンポーネントのログを確認したいとき
  • テスト用の別プロセスの失敗を追いたいとき
apache/skywalking2.5万2026年10月29日 更新

compile

無料概要あり

SkyWalking OAPサーバーのビルド、Javadoc検査、Checkstyleを実行し、PR提出前に変更がビルドやコード規約を満たすか確かめます。

  • PR前に全体ビルドを確認したいとき
  • Javadocのエラーを確認したいとき
  • 変更したモジュールだけをビルドしたいとき
apache/skywalking2.5万2026年10月29日 更新

generate-classes

無料概要あり

SkyWalkingのDSLスクリプトをコンパイルし、MAL・OAL・LAL・Hierarchyから生成されたクラスファイルを調査用に出力します。

  • MAL式の生成クラスを調べたいとき
  • OALのメトリクス関連クラスを確認したいとき
  • LALやHierarchyの出力を調査したいとき
apache/skywalking2.5万2026年10月29日 更新

gh-pull-request

無料概要あり

変更をコンパイルやライセンス表記などの事前確認に通し、PRブランチへコミット・プッシュします。PRがなければ所定の形式で作成するスキルです。

  • PR提出前に変更を確認したいとき
  • ブランチの変更をコミット・送信したいとき
  • 現在のブランチからPRを作成したいとき
apache/skywalking2.5万2026年10月29日 更新

license

無料概要あり

Apache 2.0のライセンスヘッダーと依存ライセンスを確認し、不備のあるヘッダーを修正します。PR提出前のライセンス確認に使うスキルです。

  • PR前にApacheライセンス表記を確認したいとき
  • 不足したライセンスヘッダーを直したいとき
  • 依存ライセンス一覧の差分を確認したいとき
apache/skywalking2.5万2026年10月29日 更新

new-monitoring-feature

無料概要あり

SkyWalking OAPに新しい監視対象を追加する際、信号に応じた拡張方法や設定・UI・ドキュメントの更新箇所を整理し、実装の道筋を示します。

  • 新しい監視対象を追加したいとき
  • メトリクスやログの拡張先を選びたいとき
  • Layer追加に伴う更新箇所を整理したいとき
apache/skywalking2.5万2026年10月29日 更新

apache のスキルをすべて見る

このスキルの問題を報告する