Skip to content

fix(docker): handle JMX exporter release tag prefixes - #355

Merged
amuraru merged 2 commits into
mainfrom
fix/jmx-exporter-release-tag-build
Oct 13, 2026
Merged

amuraru merged 2 commits into
mainfrom
fix/jmx-exporter-release-tag-build

Conversation

@amuraru

@amuraru amuraru commented Oct 13, 2026 •

Copy link
Copy Markdown

Description

Fix JMX exporter image builds for upstream release tags with an optional v prefix.

The latest JMX publishing run failed because v1.6.0 was used to construct /tmp/jmx_exporter-v1.6.0, but the GitHub source archive extracts into jmx_exporter-1.6.0.

Extract the archive directly into /src with --strip-components=1, so the build does not depend on the archive directory name. Strip an optional leading v when locating the Maven artifact, then copy it to a stable filename for the final image. Preserve the operator-facing /jmx_prometheus_javaagent.jar symlink.

This also supports the upstream 1.7.0 update in #348. Publishing triggers and the pinned JMX exporter version are unchanged. No test script is included, as requested.

Replace the final-stage alpine:latest tag with alpine:3.24, retaining the existing digest (Alpine 3.24.2). This makes the release line explicit without changing base image contents and keeps Renovate tracking tag and digest updates.

Validation

Reproduced the original mv: cannot stat '/tmp/jmx_exporter-v1.6.0' failure before the fix:

docker build --progress=plain --build-arg JMX_EXPORTER_VERSION=v1.6.0 --target build docker/jmx_exporter

Result before the fix: failed with the same error as CI.

After the fix, ran:

set -e
image_id_file="$(mktemp)"
trap 'rm -f "$image_id_file"' EXIT
for version in 1.6.0 v1.6.0 1.7.0; do
  docker build --quiet --build-arg "JMX_EXPORTER_VERSION=$version" --iidfile "$image_id_file" docker/jmx_exporter
  image_id="$(< "$image_id_file")"
  docker run --rm "$image_id" sh -ec 'test -L /jmx_prometheus_javaagent.jar && test -s /jmx_prometheus_javaagent.jar && test -s /opt/jmx_exporter/jmx_prometheus_javaagent.jar'
  printf 'PASS: %s image build and JAR path checks\n' "$version"
done

Result: passed for all three release tags, including complete image builds and runtime checks for the JAR and symlink.

git diff --cached --check: passed.

make test / make lint: not run; this change only affects the JMX image Dockerfile. Local builds used the host architecture; the CI multi-platform publishing job was not rerun.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

amuraru and others added 2 commits October 13, 2026 14:58
Extract source archives without relying on their root directory name and normalize the Maven artifact version before copying the agent JAR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the existing digest while making the Alpine release line explicit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amuraru
amuraru merged commit 076d998 into main Oct 13, 2026
7 checks passed
@amuraru
amuraru deleted the fix/jmx-exporter-release-tag-build branch October 13, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant